A library for talking to Multi-Tech's Cellular SocketModem Devices.

Dependents:   M2X_dev axeda_wrapper_dev MTS_M2x_Example1 MTS_Cellular_Connect_Example ... more

Revision:
121:5a7fba896c98
Parent:
119:544578fd290c
Child:
122:5f95f81a8b03
--- a/wifi/Wifi.cpp	Tue Dec 31 22:58:53 2013 +0000
+++ b/wifi/Wifi.cpp	Tue Dec 31 23:41:59 2013 +0000
@@ -332,7 +332,7 @@
             return false;
         }
     }
-    
+
     wait(1); //Wait so the subsequent isOpen calls return correctly.
     io->rxClear();
     io->txClear();
@@ -428,6 +428,17 @@
 
 void Wifi::reset()
 {
+    sendCommand("reboot", 2000);
+    wifiConnected = false;
+    _ssid = "";
+    mode = TCP;
+    socketOpened = false;
+    socketCloseable = true;
+    local_port = 0;
+    local_address = "";
+    host_port = 0;
+    cmdOn = false;
+    wait(10);
 }
 
 Code Wifi::setDeviceIP(std::string address)
@@ -650,7 +661,9 @@
             }
         }
         if(timer >= timeoutMillis) {
-            printf("[WARNING] sendCommand [%s] timed out after %d milliseconds\r\n", command.c_str(), timeoutMillis);
+            if(command.compare("reboot") != 0) {
+                printf("[WARNING] sendCommand [%s] timed out after %d milliseconds\r\n", command.c_str(), timeoutMillis);
+            }
             done = true;
         }
     } while (!done);