diff --git a/client/client/include/forte_sensor.hpp b/client/client/include/ForteSensor.hpp similarity index 71% rename from client/client/include/forte_sensor.hpp rename to client/client/include/ForteSensor.hpp index 36c4e75a451ab562aa5a32c3f62eb01958409f4c..d322213ea9c89554540b75ea158ddb99e4886e2f 100644 --- a/client/client/include/forte_sensor.hpp +++ b/client/client/include/ForteSensor.hpp @@ -1,13 +1,13 @@ #ifndef _FORTE_SENSOR #define _FORTE_SENSOR -// #include "Message.hpp" +#include "Message.hpp" template <class T> class Forte_Sensor { public: virtual T read_data() = 0; virtual void setup() = 0; - // virtual Message build_message() = 0; + virtual Message build_message() = 0; private: }; diff --git a/client/client/lib/dr26_analogue/src/dr26.hpp b/client/client/lib/dr26_analogue/src/dr26.hpp index 6105c296c983266ec86026e0664ed4df6144b02a..dcc3089c6b032ff2e6aa26bba9f1f4085c66ab2d 100644 --- a/client/client/lib/dr26_analogue/src/dr26.hpp +++ b/client/client/lib/dr26_analogue/src/dr26.hpp @@ -1,18 +1,18 @@ #ifndef _DR26 #define _DR26 +#include "ForteSensor.hpp" #include "Message.hpp" -#include "forte_sensor.hpp" #include "pinout.hpp" #include <Adafruit_ADS1X15.h> #include <Wire.h> class Forte_DR26 : public Forte_Sensor<float> { public: - void setup(); - float read_data(); + void setup() override; + float read_data() override; void change_Gain(adsGain_t gain); - Message build_message(); + Message build_message() override; private: }; diff --git a/client/client/lib/drs26_digital/drs26.hpp b/client/client/lib/drs26_digital/drs26.hpp index 1c5116dc966403eafbe2b83a2c6ccf14093ee75b..9214112549bb2cbbfa82786273416440dd818efc 100644 --- a/client/client/lib/drs26_digital/drs26.hpp +++ b/client/client/lib/drs26_digital/drs26.hpp @@ -1,9 +1,9 @@ #ifndef _DRS26 #define _DRS26 +#include "ForteSensor.hpp" #include "Message.hpp" #include "Wire.h" -#include "forte_sensor.hpp" #include "pinout.hpp" #include <SDI12.h> @@ -15,9 +15,9 @@ struct out_data_drs26 { class Forte_DRS26 : public Forte_Sensor<out_data_drs26> { public: - void setup(); - out_data_drs26 read_data(); - Message build_message(); + void setup() override; + out_data_drs26 read_data() override; + Message build_message() override; private: SDI12 drs26; diff --git a/client/client/lib/espnow/src/Message.cpp b/client/client/lib/espnow/src/Message.cpp index c4bfb3f765350c6ad51aa28ad605a7a13ae9c2e4..382f2a7561991aa71ce882a1c916de8f661ca29e 100644 --- a/client/client/lib/espnow/src/Message.cpp +++ b/client/client/lib/espnow/src/Message.cpp @@ -44,4 +44,8 @@ Message ::Message(ClientDataPackage old_data) data = old_data; // memcpy(&data, &old_data, sizeof(data)); get_host_mac(recipient); -} \ No newline at end of file +} +ClientDataPackage Message::getData() +{ + return data; +} diff --git a/client/client/lib/espnow/src/Message.hpp b/client/client/lib/espnow/src/Message.hpp index ee00f7fd7365a15c25a32d9ad81b575fb5edde3b..cc3dfa359add38ed7dca533230941d2d7af51dea 100644 --- a/client/client/lib/espnow/src/Message.hpp +++ b/client/client/lib/espnow/src/Message.hpp @@ -12,9 +12,10 @@ class Message { public: Message(); - Message(ClientDataPackage old_data); + explicit Message(ClientDataPackage old_data); void add_data(float value, int identifier); esp_err_t send(); + ClientDataPackage getData(); private: ClientDataPackage data; diff --git a/client/client/lib/ina219/ina219.hpp b/client/client/lib/ina219/ina219.hpp index cd964cc8c63ff3eac93526484d0d9ca57bdc8ba5..26d3f6edcfda36b1a8b13bf766651ccfbf9806ba 100644 --- a/client/client/lib/ina219/ina219.hpp +++ b/client/client/lib/ina219/ina219.hpp @@ -1,9 +1,9 @@ #ifndef _INA219 #define _INA219 +#include "ForteSensor.hpp" #include "Message.hpp" #include "Wire.h" -#include "forte_sensor.hpp" #include "pinout.hpp" #include <INA219_WE.h> @@ -18,9 +18,9 @@ struct out_data_ina219 { class Forte_INA219 : public Forte_Sensor<out_data_ina219> { public: - void setup(); - out_data_ina219 read_data(); - Message build_message(); + void setup() override; + out_data_ina219 read_data() override; + Message build_message() override; private: INA219_WE ina219; diff --git a/client/client/lib/scd30/scd30.hpp b/client/client/lib/scd30/scd30.hpp index c3bf69725f82ad61df06d2ba02643074ff105955..74147043cd9151c6a8ef8f27b2523cf257eca31e 100644 --- a/client/client/lib/scd30/scd30.hpp +++ b/client/client/lib/scd30/scd30.hpp @@ -1,9 +1,9 @@ #ifndef _SCD30 #define _SCD30 +#include "ForteSensor.hpp" #include "Message.hpp" #include "NoDataAvailableException.hpp" -#include "forte_sensor.hpp" #include "pinout.hpp" #include <SparkFun_SCD30_Arduino_Library.h> #include <Wire.h> @@ -16,9 +16,9 @@ struct out_data_scd30 { class Forte_SCD30 : public Forte_Sensor<out_data_scd30> { public: - void setup(); - out_data_scd30 read_data(); - Message build_message(); + void setup() override; + out_data_scd30 read_data() override; + Message build_message() override; private: SCD30 airSensor; diff --git a/client/client/platformio.ini b/client/client/platformio.ini index 08a880b1fed6366c59e978a41906e6b1b9864da3..31c0f4c30dbdf7f351f570e12b172ee18590d5d1 100644 --- a/client/client/platformio.ini +++ b/client/client/platformio.ini @@ -24,3 +24,4 @@ lib_deps = Adafruit_I2CDevice SPI envirodiy/SDI-12@^2.1.4 + fbiego/ESP32Time@^2.0.0 diff --git a/client/client/src/main.cpp b/client/client/src/main.cpp index a9cdb27408f274d9daf802dd981138c2af6ce2a6..9106c962fa31c1d4f06f7b9f5cef75e9d6b90603 100644 --- a/client/client/src/main.cpp +++ b/client/client/src/main.cpp @@ -15,7 +15,7 @@ void setup() void loop() { - out_data_drs26 data; + out_data_drs26 data{}; try { data = drs26.read_data();