diff --git a/client/client/lib/dr26_analogue/dr26.cpp b/client/client/lib/dr26_analogue/dr26.cpp index e8d4555fff9470023788f92abfcd8af61d8aa905..fe9eb142ee2020c0f23ee4bc5d18d2716e49dffa 100644 --- a/client/client/lib/dr26_analogue/dr26.cpp +++ b/client/client/lib/dr26_analogue/dr26.cpp @@ -46,7 +46,11 @@ void ForteDR26 ::changeGain(adsGain_t gain) std::list<Message> ForteDR26::buildMessages() { - throw "Not implemented"; + std::list<Message> messages; + float data = readData(); + MeasurementData IncrementData{data, 0, {}, "CIRCUMFERENCE_INCREMENT"}; + messages.emplace_back((IncrementData, sensorInformation, Time::getInstance().getEpochSeconds())); + return messages; } SensorInformation ForteDR26::getSensorInformation() const { diff --git a/client/client/lib/scd30/scd30.cpp b/client/client/lib/scd30/scd30.cpp index 507d815ea7c401a4872aec3f7a4e2567409d3ddb..7cff381af4ac4034d955366bf571a89b7e551ddf 100644 --- a/client/client/lib/scd30/scd30.cpp +++ b/client/client/lib/scd30/scd30.cpp @@ -24,8 +24,20 @@ out_data_scd30 ForteSCD30 ::readData() std::list<Message> ForteSCD30::buildMessages() { - throw "Not yet implemented"; + std::list<Message> messages; + + out_data_scd30 data = readData(); + MeasurementData CO2Data{data.C02, 0, {}, "CO2"}; + MeasurementData TempData{data.Temperature, 0, {}, "Temperature"}; + MeasurementData HumidData{data.Humidity, 0, {}, "Humidity"}; + + messages.emplace_back(Message(CO2Data, sensorInformation, Time::getInstance().getEpochSeconds())); + messages.emplace_back(Message(TempData, sensorInformation, Time::getInstance().getEpochSeconds())); + messages.emplace_back(Message(HumidData, sensorInformation, Time::getInstance().getEpochSeconds())); + + return messages; } + SensorInformation ForteSCD30::getSensorInformation() const { return sensorInformation; diff --git a/client/client/lib/time/src/Time.cpp b/client/client/lib/time/src/Time.cpp index 8fdf4b4decd253a197cda680a6613529daa2b127..5cc3dbcdb7086eb1a27bcf98dccef1e49e78beaf 100644 --- a/client/client/lib/time/src/Time.cpp +++ b/client/client/lib/time/src/Time.cpp @@ -17,7 +17,7 @@ String Time::getTime(String format) { return this->rtc.getTime(std::move(format)); } -long Time::getEpochSeconds() +unsigned long Time::getEpochSeconds() { return this->rtc.getEpoch(); } diff --git a/client/client/lib/time/src/Time.hpp b/client/client/lib/time/src/Time.hpp index d53adb159f8f5deb092bcffa3977f550f59fcd1d..783bdef40ead148d61271c7cf92aeabb8f3242d7 100644 --- a/client/client/lib/time/src/Time.hpp +++ b/client/client/lib/time/src/Time.hpp @@ -45,7 +45,7 @@ class Time { /*! @brief get the current epoch seconds as long */ - long getEpochSeconds(); + unsigned long getEpochSeconds(); /*! @brief get the current milliseconds as long