Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: IoT_Ex BatteryModelTester BatteryModelTester
Fork of WiflyInterface by
Revision 31:2846355deb7e, committed 2016-05-09
- Comitter:
- defrost
- Date:
- Mon May 09 11:39:08 2016 +0000
- Parent:
- 30:2c704a72d88a
- Child:
- 32:ab206f7f5090
- Commit message:
- - Fixed checkNetworkStatus() function, works properly
Changed in this revision
| Wifly/Wifly.cpp | Show annotated file Show diff for this revision Revisions of this file |
| Wifly/Wifly.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/Wifly/Wifly.cpp Wed May 04 22:09:22 2016 +0000
+++ b/Wifly/Wifly.cpp Mon May 09 11:39:08 2016 +0000
@@ -587,14 +587,28 @@
int Wifly::checkNetworkStatus(void){
int status = 0;
char rcv[128];
+ unsigned int ConnectionReg;
- if(!sendCommand("show c", NULL, rcv, 5000)){
+ if(!sendCommand("show c\r", NULL, rcv, 5000)){
status = 0;
// the sendCommand function quits command mode if there is an error
}else{
// check the response:
- INFO("Wifly Check network response: %s; %d", rcv, rcv);
- status = 1;
+ sscanf(rcv, "%x%*s", &ConnectionReg);
+ if(((ConnectionReg & CC_ASSOCIATION)>0) && ((ConnectionReg & CC_AUTHENTICATION)>0)){
+ // Associated and Authenticated:
+ status = 3;
+ }else if((ConnectionReg & CC_ASSOCIATION)>0){
+ // Associated:
+ status = 1;
+ }else if((ConnectionReg & CC_AUTHENTICATION)>0){
+ // Athenticated:
+ status = 2;
+ }else{
+ // Disconnected:
+ status = 0;
+ }
+ INFO("Wifly Check network response: 0x%x, Status: %d", ConnectionReg, status);
exit(); // Quit command mode
}
--- a/Wifly/Wifly.h Wed May 04 22:09:22 2016 +0000 +++ b/Wifly/Wifly.h Mon May 09 11:39:08 2016 +0000 @@ -33,6 +33,9 @@ #include "CBuffer.h" #define DEFAULT_WAIT_RESP_TIMEOUT 500 +// Connection command register: +#define CC_ASSOCIATION 0x0010 +#define CC_AUTHENTICATION 0x0020 extern Serial pc;
