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:
sgodinez
Date:
Mon Dec 16 23:02:22 2013 +0000
Revision:
19:38794784e009
Parent:
test_SMS.h@17:2d7c4ea7491b
Child:
39:6e94520a3217
Changed Cellular class to singleton (not thread safe)

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
sgodinez 19:38794784e009 5 void sendSms() {
sgodinez 17:2d7c4ea7491b 6 Cellular::Code code;
sgodinez 17:2d7c4ea7491b 7 std::string sMsg("Hello from Multi-Tech MBED!");
sgodinez 17:2d7c4ea7491b 8 std::string sPhoneNum("16514085259");
sgodinez 17:2d7c4ea7491b 9
sgodinez 17:2d7c4ea7491b 10 printf("Sending message [%s] to [%s]\r\n", sMsg.c_str(), sPhoneNum.c_str());
sgodinez 19:38794784e009 11 code = Cellular::getInstance()->sendSMS(sPhoneNum, sMsg);
sgodinez 17:2d7c4ea7491b 12
sgodinez 17:2d7c4ea7491b 13 if(code != Cellular::OK) {
sgodinez 17:2d7c4ea7491b 14 printf("Error during SMS send [%d]\r\n", (int)code);
sgodinez 17:2d7c4ea7491b 15 } else {
sgodinez 17:2d7c4ea7491b 16 printf("Success!\r\n");
sgodinez 17:2d7c4ea7491b 17 }
sgodinez 17:2d7c4ea7491b 18 }
sgodinez 17:2d7c4ea7491b 19
sgodinez 19:38794784e009 20 void receiveSms() {
sgodinez 17:2d7c4ea7491b 21 printf("Checking Received Messages\r\n");
sgodinez 19:38794784e009 22 std::vector<Cellular::Sms> vSms = Cellular::getInstance()->getReceivedSms();
sgodinez 17:2d7c4ea7491b 23 printf("\r\n");
sgodinez 17:2d7c4ea7491b 24 for(unsigned int i = 0; i < vSms.size(); i++) {
sgodinez 17:2d7c4ea7491b 25 printf("[%d][%s][%s][%s]\r\n", i, vSms[i].timestamp.c_str(),
sgodinez 17:2d7c4ea7491b 26 vSms[i].phoneNumber.c_str(), vSms[i].message.c_str());
sgodinez 17:2d7c4ea7491b 27 }
sgodinez 17:2d7c4ea7491b 28 }
sgodinez 17:2d7c4ea7491b 29
sgodinez 17:2d7c4ea7491b 30 #endif