Axeda Ready Demo for Freescale FRDM-KL46Z as accident alert system

Dependencies:   FRDM_MMA8451Q KL46Z-USBHost MAG3110 SocketModem TSI mbed FATFileSystem

Fork of AxedaGo-Freescal_FRDM-KL46Z by Axeda Corp

Committer:
AxedaCorp
Date:
Wed Jul 02 19:57:37 2014 +0000
Revision:
2:2f9019c5a9fc
Parent:
0:65004368569c
ip switch

Who changed what in which revision?

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