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 152:9a2c7ed27744, committed 2014-09-02
- Comitter:
- mfiore
- Date:
- Tue Sep 02 18:38:55 2014 +0000
- Parent:
- 151:483208276759
- Commit message:
- Wifi: fix compatibility break with old shields by checking for both old and new style responses to "show connection" command
Changed in this revision
wifi/Wifi.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/wifi/Wifi.cpp Thu Aug 28 20:17:36 2014 +0000 +++ b/wifi/Wifi.cpp Tue Sep 02 18:38:55 2014 +0000 @@ -363,9 +363,14 @@ return socketOpened; } std::string response = sendCommand("show connection", 2000, "\n"); - // response to "show connection" always starts with 8 + // response to "show connection" always starts with "8" // http://ww1.microchip.com/downloads/en/DeviceDoc/rn-wiflycr-ug-v1.2r.pdf int start = response.find("8"); + // but for some reason the old wifi sheilds give back a response starting with "f" + // perhaps a different firmware version + if (start == string::npos) { + start = response.find("f"); + } if(start != string::npos && response.size() >= (start + 3)) { if(response[start + 3] == '1') { socketOpened = true;