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

Dependents:   mtsas mtsas mtsas mtsas

Files at this revision

API Documentation at this revision

Comitter:
Vanger
Date:
Fri Aug 01 15:51:49 2014 +0000
Parent:
44:bf07f3d85822
Child:
46:56ab41157957
Commit message:
Changed the response code parsing at the end of sendCommand() in Cellular.cpp to also check for UIP responses; (Removed apn from EasyIP.h example code section)

Changed in this revision

Cellular/Cellular.cpp Show annotated file Show diff for this revision Revisions of this file
Cellular/EasyIP.h Show annotated file Show diff for this revision Revisions of this file
--- a/Cellular/Cellular.cpp	Thu Jul 31 21:04:28 2014 +0000
+++ b/Cellular/Cellular.cpp	Fri Aug 01 15:51:49 2014 +0000
@@ -211,31 +211,39 @@
             result.append(tmp, size);
         }
         
-        //If there is a response, check that the response is not finished with a response code
+        //Check for a response to signify the completion of the AT command
         //OK, ERROR, CONNECT are the 3 most likely responses
         if(result.size() > (command.size() + 2)) {
-            if(result.find("OK") != std::string::npos) {
-                //Found OK
-                done = true;
-            } else if(result.find("ERROR") != std::string::npos) {
-                //Found ERROR
-                done = true;
-            } else if(result.find("CONNECT") != std::string::npos) {
-                //Found CONNECT]
-                ////Could add socketOpened flag check here if CONNECT is found
-                done = true;
-            } else if(result.find("NO CARRIER") != std::string::npos) {
-                //Found NO CARRIER
-                done = true;
-            } else if(result.find("RING") != std::string::npos) {
-                done = true;
-            } else if(result.find("NO DIALTONE") != std::string::npos) {
-                done = true;
-            } else if(result.find("BUSY") != std::string::npos) {
-                done = true;
-            } else if(result.find("NO ANSWER") != std::string::npos) {
-                done = true;
-            }
+                if(result.find("OK") != std::string::npos) {
+                    //Found OK
+                    done = true;
+                } else if (result.find("ERROR") != std::string::npos) {
+                    //Found ERROR
+                    done = true;
+                } else if (result.find("NO CARRIER") != std::string::npos) {
+                    //Found NO CARRIER
+                    done = true;
+                } else if (result.find("RING") != std::string::npos) {
+                    done = true;
+                } else if (result.find("BUSY") != std::string::npos) {
+                    done = true;
+                } else if (result.find("NO ANSWER") != std::string::npos) {
+                    done = true;
+                }
+                
+                if(type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_EV3 || type == MTSMC_C2) {
+                    if (result.find("CONNECT") != std::string::npos) {
+                        //Found CONNECT
+                        //Could add socketOpened flag check here if CONNECT is found
+                        done = true;
+                    } else if(result.find("NO DIALTONE") != std::string::npos) {
+                        done = true;
+                    } 
+                } else if (type == MTSMC_H5_IP || type == MTSMC_EV3_IP || type == MTSMC_C2_IP) {
+                    if (result.find("Ok_Info_")) {
+                        done = true;
+                    }
+                }
         }
         
         if(tmr.read_ms() >= timeoutMillis) {
--- a/Cellular/EasyIP.h	Thu Jul 31 21:04:28 2014 +0000
+++ b/Cellular/EasyIP.h	Fri Aug 01 15:51:49 2014 +0000
@@ -30,7 +30,7 @@
     *
     * int main(){
     *   //Modify to match your apn if you are using an HSPA radio with a SIM card
-    *   const char APN[] = "internet";
+    *   const char APN[] = "";
     *
     *   //Sets the log level to INFO, which is about midway on priority levels
     *   //Possible levels: FATAL, ERROR, WARNING, INFO, DEBUG, TRACE, NONE