forked from ThingPulse/esp8266-weather-station
-
Notifications
You must be signed in to change notification settings - Fork 1
/
WundergroundClient.h
137 lines (104 loc) · 4.07 KB
/
WundergroundClient.h
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/**The MIT License (MIT)
Copyright (c) 2015 by Daniel Eichhorn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
See more at http://blog.squix.ch
*/
#pragma once
#include <JsonListener.h>
#include <JsonStreamingParser.h>
#define MAX_FORECAST_PERIODS 12 // Changed from 7 to 12 to support 6 day / 2 screen forecast (Neptune)
class WundergroundClient: public JsonListener {
private:
String currentKey;
String currentParent = "";
long localEpoc = 0;
int gmtOffset = 1;
long localMillisAtUpdate;
String date = "-";
boolean isMetric = true;
String currentTemp;
// JJG added ... ////////////////////////////////// define returns /////////////////////////////////
String moonPctIlum; // not used
String moonAge; // make this a long?
String moonPhase;
String sunriseTime;
String sunsetTime;
String moonriseTime;
String moonsetTime;
String windSpeed;
String windDir;
// end JJG add ////////////////////////////////////////////////////////////////////////////////////
String weatherIcon;
String weatherText;
String humidity;
String pressure;
String dewPoint;
String precipitationToday;
void doUpdate(String url);
// forecast
boolean isForecast = false;
boolean isSimpleForecast = true;
int currentForecastPeriod;
String forecastIcon [MAX_FORECAST_PERIODS];
String forecastTitle [MAX_FORECAST_PERIODS];
String forecastLowTemp [MAX_FORECAST_PERIODS];
String forecastHighTemp [MAX_FORECAST_PERIODS];
public:
WundergroundClient(boolean isMetric);
void updateConditions(String apiKey, String language, String country, String city);
void updateForecast(String apiKey, String language, String country, String city);
void updateAstronomy(String apiKey, String language, String country, String city);
// JJG added
String getHours();
String getMinutes();
String getSeconds();
String getDate();
// JJG added ... ///////////////////function name to string ////////////////////////////
String getMoonPctIlum();
String getMoonAge();
String getMoonPhase();
String getSunriseTime();
String getSunsetTime();
String getMoonriseTime();
String getMoonsetTime();
String getWindSpeed();
String getWindDir();
// end JJG add ///////////////////////////////////////////////////////////////////////
long getCurrentEpoch();
String getCurrentTemp();
String getTodayIcon();
String getTodayIconText();
String getMeteoconIcon(String iconText);
String getWeatherText();
String getHumidity();
String getPressure();
String getDewPoint();
String getPrecipitationToday();
String getForecastIcon(int period);
String getForecastTitle(int period);
String getForecastLowTemp(int period);
String getForecastHighTemp(int period);
virtual void whitespace(char c);
virtual void startDocument();
virtual void key(String key);
virtual void value(String value);
virtual void endArray();
virtual void endObject();
virtual void endDocument();
virtual void startArray();
virtual void startObject();
};