-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParsingResult4.ino
40 lines (35 loc) · 986 Bytes
/
ParsingResult4.ino
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
35
36
37
38
39
40
//here we basically parse the result obtain from the previous calss and implement the following metods on to the LightLEDS.. class
/*all parameters and functions
fron the ArduinoJson.h library
to parse the actual results and get
only the desired outputs (pipeline-id
and -status)
*/
String getPipelineStatus(String document) {
Serial.println("Parsing start: ");
DynamicJsonDocument jsonBuffer(2048);
deserializeJson(jsonBuffer, document);
int id = jsonBuffer[0]["id"];
const char* status = jsonBuffer[0]["status"];
// Output to serial monitor
Serial.print("id: ");
Serial.println(id);
Serial.print("status: ");
Serial.println(status);
if (strcmp(status , "success") == 0)
{
pState = PASSED;// PASSED case
}
else if (strcmp(status , "failed") == 0)
{
pState = FAILED;// FAILED case
}
else if (strcmp(status , "running") == 0)
{
pState = RUNNING;// RUNNING case
}
else
{
pState = UNKNOWN;// UNKNOWN case
}
}