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:
Thu Jan 02 18:11:25 2014 +0000
Revision:
124:6d964b4343c8
Parent:
115:b26176f23e89
Child:
141:571e0ef6c8dc
finish cleaning up test directory; socket, socket echo, and ping tests can be run on wifi or cellular by changing #define value in each test header; test_main.cpp has commented out main function with all tests ready to go

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 124:6d964b4343c8 10 std::string sPhoneNum( /* your 10-digit phone number prepended with a 1, e.g. 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