Cellular library for MTS Socket Modem Arduino Shield devices from Multi-Tech Systems

Dependents:   mtsas mtsas mtsas mtsas

Revision:
35:257eb41405e1
Parent:
25:817e9d94bfd7
Child:
36:948d06b3e23c
diff -r 7d412c989964 -r 257eb41405e1 Test/TestSMS.h
--- a/Test/TestSMS.h	Wed Jul 16 15:05:10 2014 +0000
+++ b/Test/TestSMS.h	Mon Jul 21 20:14:18 2014 +0000
@@ -22,7 +22,7 @@
 TestSMS::TestSMS() : TestCollection("TestSMS") {}
 
 void TestSMS::run() {
-    const char APN[] = "";
+    const char APN[] = "b2b.tmobile.com";
     
     string number;
     string response;
@@ -56,6 +56,18 @@
         }
     }
     
+    //For determining when the SIM card is ready
+    std::string result;
+    for (int i = 0; i < 25; i++) {
+        if (i >= 25) {
+            Test::assertTrue(false);
+        }
+        if(radio->sendBasicCommand("AT+CMGD=1,4", 1000) == MTS_SUCCESS) {
+            break;
+        }
+        wait(1);
+    }
+    
     Test::assertTrue(radio->deleteAllReceivedSms() == MTS_SUCCESS);
     Test::assertTrue(radio->getReceivedSms().size() == 0);
     Test::end();
@@ -67,16 +79,17 @@
         if (response.find("ERROR") == string::npos && response.find("error") == string::npos) {
             break;
         }
-        
         wait(1);
     }
-    if (response.find("My Number") != string::npos) {
+    //Response doesn't contain "My Number", and thus will always fail
+    //Code seems to not be the same for UIP versus EasyIP
+    if (response.find("+CNUM:") != string::npos) {
         parts = Text::split(response, ",");
         number = parts[1];
         size_t fquote = number.find("\"");
         size_t bquote = number.rfind("\"");
         number = number.substr(fquote + 1, bquote - 1);
-        logInfo("my phone number: [%s]", number.c_str());
+        logInfo("My phone number: [%s]", number.c_str());
     } else {
         Test::assertTrue(false);
     }