Alcatel-Lucent IoT Development / MTS-Cellular

Dependents:   mtsas

Fork of MTS-Cellular by MultiTech

Files at this revision

API Documentation at this revision

Comitter:
mfiore
Date:
Thu Jun 19 14:59:35 2014 +0000
Parent:
21:916ef2da10f1
Child:
23:8333593dd86f
Commit message:
add other HSPA devices to check for APN in isConnected; wait for entire reply from radio to come before returning from ping

Changed in this revision

Cellular/UIP.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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;
         }
     }