Scott Vincent / GUI

Files at this revision

API Documentation at this revision

Comitter:
khaiminhvn
Date:
Thu Mar 25 02:29:16 2021 +0000
Parent:
4:4643a545bcf9
Commit message:
Minor changes

Changed in this revision

GUI.cpp Show annotated file Show diff for this revision Revisions of this file
GUI.h Show annotated file Show diff for this revision Revisions of this file
--- a/GUI.cpp	Thu Mar 25 01:17:19 2021 +0000
+++ b/GUI.cpp	Thu Mar 25 02:29:16 2021 +0000
@@ -32,6 +32,12 @@
     }
 }
 
+bool GUI::isConnected(bool *flag){
+    nsapi_connection_status_t ind = eth->get_connection_status();
+    *flag = (ind == NSAPI_STATUS_DISCONNECTED) ? false : true;
+    return *flag;
+}
+
 bool GUI::receives(int *survivalSpeed, bool *activeTracking, bool *powerOn, float *sunAngle)
 {
     char recvSer[500];
--- a/GUI.h	Thu Mar 25 01:17:19 2021 +0000
+++ b/GUI.h	Thu Mar 25 02:29:16 2021 +0000
@@ -15,6 +15,7 @@
     //Functions
     void refreshConnection(char *GUI_URL, bool* flag);
     bool receives(int *survivalSpeed, bool *activeTracking, bool *powerOn, float *sunAngle); //Read messages from GUI and reurns JSON to main
+    bool isConnected(bool *flag); //Check if there is connection
     void windSpeed(float windSpeed); //Send wind speed to the GUI
     void state(int mode); //Send state to GUI
     void survivalSpeed(int survivalSpeed); //Send new wind survival speedto GUI