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
tests/test_SMS.h@39:6e94520a3217, 2013-12-19 (annotated)
- Committer:
- mfiore
- Date:
- Thu Dec 19 19:49:58 2013 +0000
- Revision:
- 39:6e94520a3217
- Parent:
- 19:38794784e009
- Child:
- 115:b26176f23e89
add mts namespace to files in cellular/, io/, and utils/ directories; prepend CELL_ to some enums in cellular.h to avoid conflict with HTTPClient class; added AxedaWrapper class for sending data to Axeda backend
Who changed what in which revision?
User | Revision | Line number | New 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 | |
mfiore | 39:6e94520a3217 | 13 | if(code != Cellular::CELL_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 |