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:
kranjan
Date:
Sat Jan 04 05:28:45 2014 +0000
Revision:
141:571e0ef6c8dc
Parent:
124:6d964b4343c8
Added licensing header to all files in the library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kranjan 141:571e0ef6c8dc 1 /* Universal Socket Modem Interface Library
kranjan 141:571e0ef6c8dc 2 * Copyright (c) 2013 Multi-Tech Systems
kranjan 141:571e0ef6c8dc 3 *
kranjan 141:571e0ef6c8dc 4 * Licensed under the Apache License, Version 2.0 (the "License");
kranjan 141:571e0ef6c8dc 5 * you may not use this file except in compliance with the License.
kranjan 141:571e0ef6c8dc 6 * You may obtain a copy of the License at
kranjan 141:571e0ef6c8dc 7 *
kranjan 141:571e0ef6c8dc 8 * http://www.apache.org/licenses/LICENSE-2.0
kranjan 141:571e0ef6c8dc 9 *
kranjan 141:571e0ef6c8dc 10 * Unless required by applicable law or agreed to in writing, software
kranjan 141:571e0ef6c8dc 11 * distributed under the License is distributed on an "AS IS" BASIS,
kranjan 141:571e0ef6c8dc 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
kranjan 141:571e0ef6c8dc 13 * See the License for the specific language governing permissions and
kranjan 141:571e0ef6c8dc 14 * limitations under the License.
kranjan 141:571e0ef6c8dc 15 */
sgodinez 17:2d7c4ea7491b 16
sgodinez 17:2d7c4ea7491b 17 #ifndef _TEST_SMS_H_
sgodinez 17:2d7c4ea7491b 18 #define _TEST_SMS_H_
sgodinez 17:2d7c4ea7491b 19
mfiore 115:b26176f23e89 20 using namespace mts;
mfiore 115:b26176f23e89 21
sgodinez 19:38794784e009 22 void sendSms() {
mfiore 115:b26176f23e89 23 Code code;
sgodinez 17:2d7c4ea7491b 24 std::string sMsg("Hello from Multi-Tech MBED!");
mfiore 124:6d964b4343c8 25 std::string sPhoneNum( /* your 10-digit phone number prepended with a 1, e.g. 12228675309 */);
sgodinez 17:2d7c4ea7491b 26
sgodinez 17:2d7c4ea7491b 27 printf("Sending message [%s] to [%s]\r\n", sMsg.c_str(), sPhoneNum.c_str());
sgodinez 19:38794784e009 28 code = Cellular::getInstance()->sendSMS(sPhoneNum, sMsg);
sgodinez 17:2d7c4ea7491b 29
mfiore 115:b26176f23e89 30 if(code != SUCCESS) {
sgodinez 17:2d7c4ea7491b 31 printf("Error during SMS send [%d]\r\n", (int)code);
sgodinez 17:2d7c4ea7491b 32 } else {
sgodinez 17:2d7c4ea7491b 33 printf("Success!\r\n");
sgodinez 17:2d7c4ea7491b 34 }
sgodinez 17:2d7c4ea7491b 35 }
sgodinez 17:2d7c4ea7491b 36
sgodinez 19:38794784e009 37 void receiveSms() {
sgodinez 17:2d7c4ea7491b 38 printf("Checking Received Messages\r\n");
sgodinez 19:38794784e009 39 std::vector<Cellular::Sms> vSms = Cellular::getInstance()->getReceivedSms();
sgodinez 17:2d7c4ea7491b 40 printf("\r\n");
sgodinez 17:2d7c4ea7491b 41 for(unsigned int i = 0; i < vSms.size(); i++) {
sgodinez 17:2d7c4ea7491b 42 printf("[%d][%s][%s][%s]\r\n", i, vSms[i].timestamp.c_str(),
sgodinez 17:2d7c4ea7491b 43 vSms[i].phoneNumber.c_str(), vSms[i].message.c_str());
sgodinez 17:2d7c4ea7491b 44 }
sgodinez 17:2d7c4ea7491b 45 }
sgodinez 17:2d7c4ea7491b 46
sgodinez 17:2d7c4ea7491b 47 #endif
kranjan 141:571e0ef6c8dc 48