EEN for Chris

Fork of MTS-Cellular by MultiTech

Files at this revision

API Documentation at this revision

Comitter:
Vanger
Date:
Fri Aug 01 21:54:36 2014 +0000
Parent:
47:16a9297b59ba
Child:
49:1fc51c53cebf
Commit message:
Added '>' case for exiting sendCommand() due to how sendSMS() in Cellular.cpp works.; Modified testSMS.h slightly to make test sections clearer.

Changed in this revision

Cellular/Cellular.cpp Show annotated file Show diff for this revision Revisions of this file
Test/TestSMS.h Show annotated file Show diff for this revision Revisions of this file
--- a/Cellular/Cellular.cpp	Fri Aug 01 16:19:39 2014 +0000
+++ b/Cellular/Cellular.cpp	Fri Aug 01 21:54:36 2014 +0000
@@ -231,6 +231,12 @@
                     done = true;
                 }
                 
+                if (command.find("AT+CMGS=") != string::npos) {
+                    if (result.find('>') != string::npos) {
+                        done = true;
+                    }
+                }
+                
                 if(type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_EV3 || type == MTSMC_C2) {
                     if (result.find("CONNECT") != std::string::npos) {
                         //Found CONNECT
@@ -240,7 +246,7 @@
                         done = true;
                     } 
                 } else if (type == MTSMC_H5_IP || type == MTSMC_EV3_IP || type == MTSMC_C2_IP) {
-                    if (result.find("Ok_Info_")) {
+                    if (result.find("Ok_Info_") != std::string::npos) {
                         done = true;
                     }
                 }
@@ -286,7 +292,7 @@
     cmd.append(phoneNumber);
     cmd.append("\",145");
     for (int i = 0; i < 5; i++) {
-        string response1 = sendCommand(cmd, 1000);
+        string response1 = sendCommand(cmd, 2000);
         if (response1.find('>') != string::npos) {
             break;
         }
@@ -368,7 +374,7 @@
             break;
         }
         //Check for the start of the next SMS message
-        size_t bodyEnd = received.find("\r\n+CMGL: ", pos);
+        size_t bodyEnd = received.find("\r\n+CMGL:", pos);
         if(bodyEnd == std::string::npos) {
             //This must be the last SMS message
             bodyEnd = received.find("\r\n\r\nOK", pos);
--- a/Test/TestSMS.h	Fri Aug 01 16:19:39 2014 +0000
+++ b/Test/TestSMS.h	Fri Aug 01 21:54:36 2014 +0000
@@ -72,7 +72,7 @@
     Test::assertTrue(radio->getReceivedSms().size() == 0);
     Test::end();
     
-    Test::start("Send SMS");
+    Test::start("Send SMS 1");
     logInfo("finding my phone number");
     while (true) {
         response = radio->sendCommand("AT+CNUM", 1000);
@@ -95,6 +95,8 @@
     }
     
     Test::assertTrue(radio->sendSMS(number, smessages[0]) == MTS_SUCCESS);
+    Test::end();
+    Test::start("Send SMS 2");
     Test::assertTrue(radio->sendSMS(number, smessages[1]) == MTS_SUCCESS);
     Test::end();