Paperd.Ink Library 0.0.5
Library for interacting with Paperd.Ink devices.
Loading...
Searching...
No Matches
weather_parser.cpp
Go to the documentation of this file.
1#include "weather.h"
2#include "weather_parser.h"
3
5static WEATHER_STATE key_state;
6
10
12{
13 //weather_count = 0;
14 key_state = NOT_FOUND;
15}
16
18{
19 switch (key_state) {
20 case NOT_FOUND:
21 if (key.equals("dt")) {
22 //if(weather_count == (FORECAST_HOURS/3)){
23 key_state = FOUND_TIME;
24 //}
25 //weather_count++;
26 }
27 break;
28 case FOUND_TIME:
29 if (key.equals("weather"))
30 key_state = FOUND_WEATHER;
31 break;
32 case FOUND_WEATHER:
33 if (key.equals("main"))
34 key_state = FOUND_MAIN;
35 break;
36 }
37}
38
40{
41 if (key_state == FOUND_MAIN) {
42 DEBUG.printf("Got weather: %s\r\n", value);
43 strncpy(Paperdink_Weather.weather_string, (char *)value.c_str(), 10);
44 //key_state = NOT_FOUND;
45 key_state = COMPLETED;
46 }
47}
48
52
56
60
64
char weather_string[10]
Definition weather.h:13
virtual void endDocument()
virtual void startObject()
virtual void key(String key)
virtual void endArray()
virtual void startDocument()
virtual void endObject()
virtual void startArray()
virtual void whitespace(char c)
virtual void value(String value)
@ NOT_FOUND
#define DEBUG
@ FOUND_WEATHER
@ FOUND_TIME
@ FOUND_MAIN
PaperdinkUIWeatherClass Paperdink_Weather
Definition weather.cpp:195
WEATHER_STATE
@ FOUND_WEATHER
@ FOUND_TIME
@ COMPLETED
@ NOT_FOUND
@ FOUND_MAIN