Example program demonstrating sending and reading SMS messages from the cellular modem using the MTSAS library.

Dependencies:   mbed-src mtsas

Revision:
2:d0d6e939ba70
Parent:
1:1f5c9497a125
Child:
3:7fac2f012338
--- a/main.cpp	Fri Jul 25 16:47:08 2014 +0000
+++ b/main.cpp	Tue Aug 05 14:27:36 2014 +0000
@@ -46,8 +46,12 @@
     //Sets the baudrate for communicating with the radio
     io->baud(115200); 
     
-    //Creates an instance of the radio interface called "radio"
+    //Creates a radio object
     Cellular* radio = CellularFactory::create(io);
+    radio->configureSignals(D4,D7,RESET);
+    Transport::setTransport(radio);
+    
+    //Set radio APN
     for (int i = 0; i < 10; i++) {
         if (i >= 10) {
             logError("Failed to set APN\n");
@@ -76,14 +80,15 @@
     // Send SMS message to phone
     for (int i = 1; i < 10; i++) {
         if(radio->sendSMS(txtmsg) == MTS_SUCCESS) {
-            logInfo("Sent SMS successfully:\n%s\n", txtmsg.message.c_str());
+            logInfo("Sent SMS successfully:<%s>\n", txtmsg.message.c_str());
             break;
         } else {
-            logError("Failed to send SMS\n%s\n", txtmsg.message.c_str());
+            logError("Failed to send SMS<%s>\n", txtmsg.message.c_str());
         }
     }
     
-    for (int i = 0; i < 10; i++) {
+    //Checking for received SMS message
+    for (int i = 0; i < 4; i++) {
         logInfo("Checking for received messages");
         vector<Cellular::Sms> recv = radio->getReceivedSms();
         if(recv.size() > 0) {