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, committed 2013-12-31
- Comitter:
- jengbrecht
- Date:
- Tue Dec 31 23:41:59 2013 +0000
- Parent:
- 120:3051dd49fa3a
- Child:
- 122:5f95f81a8b03
- Child:
- 124:6d964b4343c8
- Commit message:
- Added the reset function to Wifi.
Changed in this revision
wifi/Wifi.cpp | Show annotated file Show diff for this revision Revisions of this file |
wifi/Wifi.h | Show annotated file Show diff for this revision Revisions of this file |
--- 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);
--- a/wifi/Wifi.h Tue Dec 31 22:58:53 2013 +0000 +++ b/wifi/Wifi.h Tue Dec 31 23:41:59 2013 +0000 @@ -139,6 +139,11 @@ virtual unsigned int readable(); virtual unsigned int writeable(); + /** This method performs a soft reboot of the device by issuing the + * reboot command. If the module is not able to respond to commands + * this will not work. This method also waits 10 seconds for the + * module to perform the reset and return. + */ virtual void reset(); /** A method for sending a generic text command to the radio. Note that you cannot