-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathCoolingSettingsService.cpp
More file actions
34 lines (31 loc) · 985 Bytes
/
CoolingSettingsService.cpp
File metadata and controls
34 lines (31 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <CoolingSettingsService.h>
CoolingSettingsService::CoolingSettingsService(AsyncWebServer *server, FS *fs)
: BrewListService(server, fs,
GET_COOLING_SETTINGS_SERVICE_PATH,
POST_COOLING_SETTINGS_SERVICE_PATH,
COOLING_SETTINGS_FILE) {}
bool CoolingSettingsService::jsonSchemaIsValid(JsonDocument &jsonObj, String &messages)
{
JsonArray steps = jsonObj["st"];
bool validJson = true;
for (int i = 0; i < steps.size(); i++)
{
JsonObject step = steps[i];
if (step["n"] == "")
{
validJson = false;
messages += "Name could not be null. ";
}
if (step["t"] <= 0)
{
validJson = false;
messages += "Temperature could not be zero. ";
}
if (step["tm"] <= 0)
{
validJson = false;
messages += "Time could not be zero.";
};
}
return validJson;
}