- Added setBaud() function - Added CheckNetworkStatus() function - Improved messaging system
Dependents: IoT_Ex BatteryModelTester BatteryModelTester
Fork of WiflyInterface by
Diff: Wifly/Wifly.cpp
- Revision:
- 12:1aaea7f302e6
- Parent:
- 11:fc3d86645d23
- Child:
- 13:8846f12fa277
--- a/Wifly/Wifly.cpp Tue Jun 03 18:43:14 2014 +0000 +++ b/Wifly/Wifly.cpp Thu Feb 18 12:05:53 2016 +0000 @@ -68,6 +68,7 @@ bool Wifly::join() { char cmd[20]; + pc.printf("Got to 0\n\r"); for (int i= 0; i < MAX_TRY_JOIN; i++) { @@ -141,7 +142,7 @@ //key step if (state.sec != NONE) { - if (state.sec == WPA) + if ((state.sec == WPA)||(state.sec == WPA2)) sprintf(cmd, "set w p %s\r", phrase); else if (state.sec == WEP_128) sprintf(cmd, "set w k %s\r", phrase); @@ -168,8 +169,13 @@ exit(); + pc.printf("Got to 10\n\r"); + state.associated = true; INFO("\r\nssid: %s\r\nphrase: %s\r\nsecurity: %s\r\n\r\n", this->ssid, this->phrase, getStringSecurity()); + + + pc.printf("\r\nssid: %s\r\nphrase: %s\r\nsecurity: %s\r\n\r\n", this->ssid, this->phrase, getStringSecurity()); return true; } return false; @@ -219,6 +225,8 @@ { char rcv[20]; char cmd[20]; + + // try to open sprintf(cmd, "open %s %d\r", host, port); @@ -227,6 +235,7 @@ state.cmd_mode = false; return true; } + // if failed, retry and parse the response if (sendCommand(cmd, NULL, rcv, 5000)) { @@ -245,6 +254,7 @@ } else { return false; } + state.tcp = true; state.cmd_mode = false;