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

Dependents:   mtsas mtsas mtsas mtsas

Revision:
18:fa0d8120f81f
Parent:
17:dee902f7d00e
Child:
19:f6261f1c3dd4
--- a/Cellular/UIP.cpp	Thu Jun 05 17:29:32 2014 +0000
+++ b/Cellular/UIP.cpp	Mon Jun 16 13:50:28 2014 +0000
@@ -116,7 +116,7 @@
     }
 
     Code code = sendBasicCommand("AT#CONNECTIONSTOP", 10000);
-    if(code == SUCCESS) {
+    if(code == MTS_SUCCESS) {
         logDebug("Successfully closed PPP Connection");
     } else {
         logError("Closing PPP Connection [%d].  Continuing ...", (int)code);
@@ -222,7 +222,7 @@
         //Attempt to set local port
         sprintf(buffer, "AT#OUTPORT=%d", local_port);
         Code code = sendBasicCommand(buffer, 1000);
-        if(code != SUCCESS) {
+        if(code != MTS_SUCCESS) {
             logWarning("Unable to set local port (%d) [%d]", local_port, (int) code);
         }
     }
@@ -231,7 +231,7 @@
     if(mode == TCP) {
         if(socketCloseable) {
             Code code = sendBasicCommand("AT#DLEMODE=1,1", 1000);
-            if(code != SUCCESS) {
+            if(code != MTS_SUCCESS) {
                 logWarning("Unable to set socket closeable [%d]", (int) code);
             }
         }
@@ -241,7 +241,7 @@
     } else {
         if(socketCloseable) {
             Code code = sendBasicCommand("AT#UDPDLEMODE=1", 1000);
-            if(code != SUCCESS) {
+            if(code != MTS_SUCCESS) {
                 logWarning("Unable to set socket closeable [%d]", (int) code);
             }
         }
@@ -250,13 +250,13 @@
         addressCode = sendBasicCommand("AT#UDPSERV=\"" + address + "\"", 1000);
     }
 
-    if(portCode == SUCCESS) {
+    if(portCode == MTS_SUCCESS) {
         host_port = port;
     } else {
         logError("Host port could not be set");
     }
 
-    if(addressCode == SUCCESS) {
+    if(addressCode == MTS_SUCCESS) {
         host_address = address;
     } else {
         logError("Host address could not be set");
@@ -531,7 +531,7 @@
 {
     disconnect();
     Code code = sendBasicCommand("AT#RESET=0", 10000);
-    if(code != SUCCESS) {
+    if(code != MTS_SUCCESS) {
         logError("Socket Modem did not accept RESET command\n\r");
     } else {
         logWarning("Socket Modem is resetting, allow 30 seconds for it to come back\n\r");
@@ -548,10 +548,10 @@
     Code code;
     if (state) {
         code = sendBasicCommand("ATE0", 1000);
-        echoMode = (code == SUCCESS) ? false : echoMode;
+        echoMode = (code == MTS_SUCCESS) ? false : echoMode;
     } else {
         code = sendBasicCommand("ATE1", 1000);
-        echoMode = (code == SUCCESS) ? true : echoMode;
+        echoMode = (code == MTS_SUCCESS) ? true : echoMode;
     }
     return code;
 }
@@ -562,19 +562,19 @@
     Code code;
 
     code = sendBasicCommand("AT#PINGREMOTE=\"" + address + "\"", 1000);
-    if (code != SUCCESS) {
+    if (code != MTS_SUCCESS) {
         return false;
     }
 
     sprintf(buffer, "AT#PINGNUM=%d", 1);
     code = sendBasicCommand(buffer , 1000);
-    if (code != SUCCESS) {
+    if (code != MTS_SUCCESS) {
         return false;
     }
 
     sprintf(buffer, "AT#PINGDELAY=%d", PINGDELAY);
     code = sendBasicCommand(buffer , 1000);
-    if (code != SUCCESS) {
+    if (code != MTS_SUCCESS) {
         return false;
     }
 
@@ -591,15 +591,15 @@
 Code UIP::setSocketCloseable(bool enabled)
 {
     if(socketCloseable == enabled) {
-        return SUCCESS;
+        return MTS_SUCCESS;
     }
 
     if(socketOpened) {
         logError("socket is already opened. Can not set closeable");
-        return ERROR;
+        return MTS_ERROR;
     }
 
     socketCloseable = enabled;
 
-    return SUCCESS;
+    return MTS_SUCCESS;
 }