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

Dependents:   mtsas mtsas mtsas mtsas

Revision:
13:e443e7e2b605
Parent:
11:4e428f689069
Child:
14:614952fb3af3
--- a/Cellular/UIP.cpp	Thu May 22 15:05:37 2014 +0000
+++ b/Cellular/UIP.cpp	Thu May 22 14:05:49 2014 -0500
@@ -88,7 +88,11 @@
     } while(tmr.read() < 30);
 
     //AT#CONNECTIONSTART: Make a PPP connection
-    logDebug("Making PPP Connection Attempt. APN[%s]", apn.c_str());
+    if (type == MTSMC_H5_IP) {
+        logDebug("Making PPP Connection Attempt. APN[%s]", apn.c_str());
+    } else {
+        logDebug("Making PPP Connection Attempt");
+    }
     std::string pppResult = sendCommand("AT#CONNECTIONSTART", 120000);
     std::vector<std::string> parts = Text::split(pppResult, "\r\n");
 
@@ -127,18 +131,20 @@
 
 bool UIP::isConnected()
 {
-    //1) Check if APN was set
-    if(apn.size() == 0) {
-        logDebug("APN is not set");
-        return false;
+    //1) Check if APN was set if we're on a HSPA radio
+    if (type == MTSMC_H5_IP) {
+        if(apn.size() == 0) {
+            logDebug("APN is not set");
+            return false;
+        }
     }
 
-    //1) Check that we do not have a live connection up
+    //2) Check that we do not have a live connection up
     if(socketOpened) {
         logDebug("Socket is opened");
         return true;
     }
-    //2) Query the radio
+    //3) Query the radio
     std::string result = sendCommand("AT#VSTATE", 3000);
     if(result.find("CONNECTED") != std::string::npos) {
         if(pppConnected == false) {