Damien Frost / WiflyInterface

Dependents:   IoT_Ex BatteryModelTester BatteryModelTester

Fork of WiflyInterface by Components

Revision:
30:2c704a72d88a
Parent:
29:c991041e766e
Child:
31:2846355deb7e
--- a/Wifly/Wifly.cpp	Wed May 04 14:31:22 2016 +0000
+++ b/Wifly/Wifly.cpp	Wed May 04 22:09:22 2016 +0000
@@ -480,8 +480,12 @@
     string checking;
     Timer tmr;
     int result = 0;
-
-    DBG("Will send: %s, looking for ACK: %s",str, ACK);
+    
+    if(ACK == NULL){
+        DBG("Will send: %s, no ACK requested.",str);
+    }else{
+        DBG("Will send: %s, looking for ACK: %s",str, ACK);
+    }
 
     attach_rx(false);
 
@@ -578,4 +582,21 @@
     attach_rx(true);
     DBG("result: %d", result)
     return result;
+}
+
+int Wifly::checkNetworkStatus(void){
+    int status = 0;   
+    char rcv[128];
+    
+    if(!sendCommand("show c", 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;
+        exit(); // Quit command mode
+    }
+    
+    return status;
 }
\ No newline at end of file