mirror of
https://github.com/Lemonochrme/clover.git
synced 2025-06-09 01:00:49 +02:00
27 lines
No EOL
586 B
C++
27 lines
No EOL
586 B
C++
#include "DataHandler.hpp"
|
|
|
|
DataHandler::DataHandler() {}
|
|
|
|
DataHandler::~DataHandler() {}
|
|
|
|
void DataHandler::updateTemperatureData(float temp) {
|
|
temperature = temp;
|
|
}
|
|
|
|
void DataHandler::updateHumidityData(float hum) {
|
|
humidity = hum;
|
|
}
|
|
|
|
String DataHandler::getJsonData() {
|
|
return buildJson();
|
|
}
|
|
|
|
String DataHandler::buildJson() {
|
|
StaticJsonDocument<200> document; // Taille = 200
|
|
document["temperature"] = temperature;
|
|
document["humidity"] = humidity;
|
|
|
|
String jsonFormattedData;
|
|
serializeJson(document, jsonFormattedData);
|
|
return jsonFormattedData;
|
|
} |