- Auto reconnect - Added is_associated
Fork of WiflyInterface by
Diff: Wifly/Wifly.cpp
- Revision:
- 10:9fc0bb21c723
- Parent:
- 9:c77799a03294
diff -r c77799a03294 -r 9fc0bb21c723 Wifly/Wifly.cpp --- a/Wifly/Wifly.cpp Tue Jan 28 11:00:48 2014 +0200 +++ b/Wifly/Wifly.cpp Fri Dec 16 02:55:12 2016 +0000 @@ -71,8 +71,8 @@ for (int i= 0; i < MAX_TRY_JOIN; i++) { - // no auto join - if (!sendCommand("set w j 0\r", "AOK")) + // force auto join + if (!sendCommand("set w j 1\r", "AOK")) continue; //no echo @@ -84,7 +84,7 @@ continue; // set size - if (!sendCommand("set c s 1024\r", "AOK")) + if (!sendCommand("set c s 1420\r", "AOK")) continue; // red led on when tcp connection active @@ -122,6 +122,11 @@ if (!sendCommand(cmd, "AOK")) continue; + //tcp + sprintf(cmd, "set comm idle 5%d\r", state.sec); + if (!sendCommand(cmd, "AOK")) + continue; + // if no dhcp, set ip, netmask and gateway if (!state.dhcp) { DBG("not dhcp\r"); @@ -342,6 +347,13 @@ } +bool Wifly::is_associated() +{ + bool flag=sendCommand("show c\r", "8630", NULL, 1000); + exit(); + return flag; +} + bool Wifly::is_connected() { return (tcp_status.read() == 1) ? true : false;