Simple detection for LE910-NA1 modules

Fork of MTS-Cellular by MultiTech

Revision:
52:2cb58398a4f9
Parent:
51:ffc556ba33f7
Child:
54:a6c738bfc391
--- a/Cellular/UIP.cpp	Tue Aug 05 18:35:22 2014 +0000
+++ b/Cellular/UIP.cpp	Mon Aug 11 16:03:19 2014 +0000
@@ -46,6 +46,14 @@
 
 bool UIP::connect()
 {
+    //Check if APN is not set, if it is not, connect will not work.
+    if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3) {
+        if(apn.size() == 0) {
+            logDebug("APN is not set");
+            return false;
+        }
+    }
+    
     //Check if socket is open
     if(socketOpened) {
         return true;
@@ -91,7 +99,6 @@
     }
     std::string pppResult = sendCommand("AT#CONNECTIONSTART", 120000);
     
-
     if(pppResult.find("Ok_Info_GprsActivation") != std::string::npos) {
         std::vector<std::string> parts = Text::split(pppResult, "\r\n");
         if(parts.size() >= 2) {
@@ -314,8 +321,6 @@
         return false;
     }
 
-
-
     if(io->write(ETX, 1000) != 1) {
         logError("Timed out attempting to close socket");
         return false;