A library for talking to Multi-Tech's Cellular SocketModem Devices.

Dependents:   M2X_dev axeda_wrapper_dev MTS_M2x_Example1 MTS_Cellular_Connect_Example ... more

Committer:
mfiore
Date:
Tue Dec 31 21:47:11 2013 +0000
Revision:
115:b26176f23e89
Parent:
39:6e94520a3217
Child:
124:6d964b4343c8
add Transport.h to include_me.h; start cleaning up test directory - not finished yet

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sgodinez 17:2d7c4ea7491b 1
sgodinez 17:2d7c4ea7491b 2 #ifndef _TEST_SMS_H_
sgodinez 17:2d7c4ea7491b 3 #define _TEST_SMS_H_
sgodinez 17:2d7c4ea7491b 4
mfiore 115:b26176f23e89 5 using namespace mts;
mfiore 115:b26176f23e89 6
sgodinez 19:38794784e009 7 void sendSms() {
mfiore 115:b26176f23e89 8 Code code;
sgodinez 17:2d7c4ea7491b 9 std::string sMsg("Hello from Multi-Tech MBED!");
mfiore 115:b26176f23e89 10 std::string sPhoneNum(""); // insert your phone number prepended with a 1, if you number is 222-867-5309 you'd put 12228675309
sgodinez 17:2d7c4ea7491b 11
sgodinez 17:2d7c4ea7491b 12 printf("Sending message [%s] to [%s]\r\n", sMsg.c_str(), sPhoneNum.c_str());
sgodinez 19:38794784e009 13 code = Cellular::getInstance()->sendSMS(sPhoneNum, sMsg);
sgodinez 17:2d7c4ea7491b 14
mfiore 115:b26176f23e89 15 if(code != SUCCESS) {
sgodinez 17:2d7c4ea7491b 16 printf("Error during SMS send [%d]\r\n", (int)code);
sgodinez 17:2d7c4ea7491b 17 } else {
sgodinez 17:2d7c4ea7491b 18 printf("Success!\r\n");
sgodinez 17:2d7c4ea7491b 19 }
sgodinez 17:2d7c4ea7491b 20 }
sgodinez 17:2d7c4ea7491b 21
sgodinez 19:38794784e009 22 void receiveSms() {
sgodinez 17:2d7c4ea7491b 23 printf("Checking Received Messages\r\n");
sgodinez 19:38794784e009 24 std::vector<Cellular::Sms> vSms = Cellular::getInstance()->getReceivedSms();
sgodinez 17:2d7c4ea7491b 25 printf("\r\n");
sgodinez 17:2d7c4ea7491b 26 for(unsigned int i = 0; i < vSms.size(); i++) {
sgodinez 17:2d7c4ea7491b 27 printf("[%d][%s][%s][%s]\r\n", i, vSms[i].timestamp.c_str(),
sgodinez 17:2d7c4ea7491b 28 vSms[i].phoneNumber.c_str(), vSms[i].message.c_str());
sgodinez 17:2d7c4ea7491b 29 }
sgodinez 17:2d7c4ea7491b 30 }
sgodinez 17:2d7c4ea7491b 31
sgodinez 17:2d7c4ea7491b 32 #endif