Simple detection for LE910-NA1 modules

Fork of MTS-Cellular by MultiTech

Revision:
22:c1004a807490
Parent:
19:f6261f1c3dd4
Child:
26:2b769ed8de4f
--- a/Cellular/UIP.cpp	Tue Jun 17 22:02:22 2014 +0000
+++ b/Cellular/UIP.cpp	Thu Jun 19 14:59:35 2014 +0000
@@ -127,8 +127,8 @@
 
 bool UIP::isConnected()
 {
-    //1) Check if APN was set if we're on a HSPA radio
-    if (type == MTSMC_H5_IP) {
+    //1) Check if APN was set if we're on an HSPA radio
+    if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3) {
         if(apn.size() == 0) {
             logDebug("APN is not set");
             return false;
@@ -583,6 +583,11 @@
     for (int i = 0; i < PINGNUM; i++) {
         response = sendCommand("AT#PING", PINGDELAY * 1000);
         if (response.find("alive") != std::string::npos) {
+            /* the "OK" that comes on a new line doesn't come right after this reply
+             * wait a couple seconds to make sure we get it here, otherwise it could be read
+             * as the response to the next AT command sent
+             */
+            wait(2);
             return true;
         }
     }