From b2ead915ef7beaa756437fd3b348d569cc513935 Mon Sep 17 00:00:00 2001 From: Niels Date: Thu, 6 Jun 2024 13:59:38 +0200 Subject: [PATCH] added comments to Connectivity class --- code/arduino/Movement-sensor-code/Connectivity.cpp | 5 +++-- code/arduino/Movement-sensor-code/Connectivity.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/code/arduino/Movement-sensor-code/Connectivity.cpp b/code/arduino/Movement-sensor-code/Connectivity.cpp index 5bdaa9e..d4c5837 100644 --- a/code/arduino/Movement-sensor-code/Connectivity.cpp +++ b/code/arduino/Movement-sensor-code/Connectivity.cpp @@ -23,6 +23,7 @@ void Connectivity::connectWiFi(char* ssid, char* pass){ const char* getServerURL = "http://145.92.8.132:443/get-ip"; String ipAddress = ""; // string that will hold the server's IP address +/** Fetch the IP address of pepper from the server */ const char* Connectivity::fetchIPAddress() { char* ipAddress = NULL; // Declare ipAddress as a char* if (WiFi.status() == WL_CONNECTED) { @@ -41,14 +42,14 @@ const char* Connectivity::fetchIPAddress() { ipAddress = strdup(ip); } } else { - Serial.printf("GET request failed, error: %s\n", http.errorToString(httpCode).c_str()); + Serial.printf("GET request failed, error: %s\n", http.errorToString(httpCode).c_str()); } http.end(); } else { Serial.println("WiFi not connected"); } - return ipAddress; // Add this return statement + return ipAddress; } /** Send a POST request to a server with provided data */ diff --git a/code/arduino/Movement-sensor-code/Connectivity.h b/code/arduino/Movement-sensor-code/Connectivity.h index 3df3524..ae711e7 100644 --- a/code/arduino/Movement-sensor-code/Connectivity.h +++ b/code/arduino/Movement-sensor-code/Connectivity.h @@ -14,8 +14,8 @@ #include - -class Connectivity { +// declare the class Connectivity with all functions +class Connectivity { public: void connectWiFi(char* ssid, char* pass); void websocketSetup(char* ip, uint16_t port, char* adress);