Skip to content
Snippets Groups Projects
Verified Commit facc1cc7 authored by Zoe Michaela Dietmar Pfister's avatar Zoe Michaela Dietmar Pfister :gay_pride_flag:
Browse files

one timestamp per sensor instead of one per measurement

parent 38f64f22
No related branches found
No related tags found
2 merge requests!39Merge Develop into Main,!36Make the host send to the actual API of our server
Pipeline #112657 passed
......@@ -76,11 +76,13 @@ void DR26::setChannel(ADS1115_MUX newChannel) {
std::list<Message> DR26::buildMessages() {
std::list<Message> messages;
auto data = readData();
messages.emplace_back(data, sensorInformation, Time::getInstance().getEpochSeconds());
auto time = Time::getInstance().getEpochSeconds();
messages.emplace_back(data, sensorInformation, time);
return messages;
}
SensorInformation DR26::getSensorInformation() const {
return sensorInformation;
}
DR26::DR26(ADS1115_MUX channel, ADS1115_RANGE voltageRange) : channel(channel), voltageRange(voltageRange) {}
......@@ -27,7 +27,9 @@ Measurement DS18B20::readData() {
std::list<Message> DS18B20::buildMessages() {
std::list<Message> messages;
auto measurement = readData();
messages.emplace_back(measurement, getSensorInformation(), Time::getInstance().getEpochSeconds());
auto time = Time::getInstance().getEpochSeconds();
messages.emplace_back(measurement, getSensorInformation(), time);
return messages;
}
......
......@@ -21,9 +21,11 @@ outDataSolarRadiation SEM228A::readData() {
std::list<Message> SEM228A::buildMessages() {
auto messages = std::list<Message>();
auto data = readData();
auto time = Time::getInstance().getEpochSeconds();
Measurement solarRadiation{data.solarRadiation, address, NO_I2C_ADDRESS, MeasurementType::SOLAR_RADIATION,
data.solarError};
messages.emplace_back(Message{solarRadiation, getSensorInformation(), Time::getInstance().getEpochSeconds()});
messages.emplace_back(Message{solarRadiation, getSensorInformation(), time});
return messages;
}
......
......@@ -50,9 +50,11 @@ SensorInformation SEM404::getSensorInformation() const {
std::list<Message> SEM404::buildMessages() {
auto messages = std::list<Message>();
auto data = getInstantaneousPrecipitation();
auto time = Time::getInstance().getEpochSeconds();
Measurement precipitationMeasurement{data.precipitation, address, NO_I2C_ADDRESS, MeasurementType::PRECIPITATION,
data.precipitationError};
messages.emplace_back(precipitationMeasurement, getSensorInformation(), Time::getInstance().getEpochSeconds());
messages.emplace_back(precipitationMeasurement, getSensorInformation(), time);
return messages;
}
outDataRainGauge SEM404::readData() {
......
......@@ -68,7 +68,9 @@ void TEROS10::setChannel(ADS1115_MUX newChannel) {
std::list<Message> TEROS10::buildMessages() {
std::list<Message> messages;
auto data = readData();
messages.emplace_back(data, sensorInformation, Time::getInstance().getEpochSeconds());
auto time = Time::getInstance().getEpochSeconds();
messages.emplace_back(data, sensorInformation, time);
return messages;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment