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

Dependents:   mtsas mtsas mtsas mtsas

Revision:
30:1326b623919a
Parent:
27:ec44d5a9544f
Child:
41:8b9b5098696f
--- a/Cellular/CellularFactory.cpp	Wed Jul 02 15:06:03 2014 +0000
+++ b/Cellular/CellularFactory.cpp	Mon Jul 14 17:33:24 2014 +0000
@@ -11,7 +11,7 @@
     std::string reply;
     Cellular::Radio type;
     Cellular* cell;
-
+    
     /* wait for radio to get into a good state */
     while (true) {
         if (sendCommand(io, "AT", 1000).find("OK") != string::npos) {
@@ -20,14 +20,13 @@
         } else {
             logTrace("waiting on radio...");
         }
-
         wait(1);
     }
-
+    
     /* "ATI4" gets us the model (HE910, DE910, etc) */
     for (int i = 0; i < 5; i++) {
         model = sendCommand(io, "ATI4", 2000);
-        if (model.find("error") == string::npos && model.find("ERROR") == string::npos) {
+        if (model.find("error") == string::npos && model.find("ERROR") == string::npos && !model.empty()) {
             /* didn't get an error - keep going */
             break;
         }