@@ -31,16 +31,17 @@ See more at http://blog.squix.ch
31
31
WundergroundAstronomy::WundergroundAstronomy (boolean _usePM) {
32
32
usePM = _usePM;
33
33
}
34
- void WundergroundAstronomy::updateAstronomy (String apiKey, String language, String country, String city) {
35
- doUpdate (" /api/" + apiKey + " /astronomy/lang:" + language + " /q/" + country + " /" + city + " .json" );
34
+ void WundergroundAstronomy::updateAstronomy (WGAstronomy *astronomy, String apiKey, String language, String country, String city) {
35
+ doUpdate (astronomy, " /api/" + apiKey + " /astronomy/lang:" + language + " /q/" + country + " /" + city + " .json" );
36
36
}
37
37
// end JJG add ////////////////////////////////////////////////////////////////////
38
38
39
- void WundergroundAstronomy::updateAstronomyPWS (String apiKey, String language, String pws) {
40
- doUpdate (" /api/" + apiKey + " /astronomy/lang:" + language + " /q/pws:" + pws + " .json" );
39
+ void WundergroundAstronomy::updateAstronomyPWS (WGAstronomy *astronomy, String apiKey, String language, String pws) {
40
+ doUpdate (astronomy, " /api/" + apiKey + " /astronomy/lang:" + language + " /q/pws:" + pws + " .json" );
41
41
}
42
42
43
- void WundergroundAstronomy::doUpdate (String url) {
43
+ void WundergroundAstronomy::doUpdate (WGAstronomy *astronomy, String url) {
44
+ this ->astronomy = astronomy;
44
45
JsonStreamingParser parser;
45
46
parser.setListener (this );
46
47
WiFiClient client;
@@ -100,15 +101,15 @@ void WundergroundAstronomy::key(String key) {
100
101
void WundergroundAstronomy::value (String value) {
101
102
102
103
if (currentKey == " ageOfMoon" ) {
103
- moonAge = value;
104
+ astronomy-> moonAge = value;
104
105
}
105
106
106
107
if (currentKey == " phaseofMoon" ) {
107
- moonPhase = value;
108
+ astronomy-> moonPhase = value;
108
109
}
109
110
110
111
if (currentKey == " percentIlluminated" ) {
111
- moonPctIlum = value;
112
+ astronomy-> moonPctIlum = value;
112
113
}
113
114
114
115
@@ -122,13 +123,13 @@ void WundergroundAstronomy::value(String value) {
122
123
else isPM = false ;
123
124
char tempHourBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
124
125
sprintf (tempHourBuff, " %2d" , tempHour); // fowlerk add for formatting, 12/22/16
125
- sunriseTime = String (tempHourBuff); // fowlerk add for formatting, 12/22/16
126
+ astronomy-> sunriseTime = String (tempHourBuff); // fowlerk add for formatting, 12/22/16
126
127
// sunriseTime = value;
127
128
}
128
129
if (currentKey == " minute" ) {
129
130
char tempMinBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
130
131
sprintf (tempMinBuff, " %02d" , value.toInt ()); // fowlerk add for formatting, 12/22/16
131
- sunriseTime += " :" + String (tempMinBuff); // fowlerk add for formatting, 12/22/16
132
+ astronomy-> sunriseTime += " :" + String (tempMinBuff); // fowlerk add for formatting, 12/22/16
132
133
if (isPM) sunriseTime += " pm" ;
133
134
else if (usePM) sunriseTime += " am" ;
134
135
}
@@ -145,13 +146,13 @@ void WundergroundAstronomy::value(String value) {
145
146
else isPM = false ;
146
147
char tempHourBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
147
148
sprintf (tempHourBuff, " %2d" , tempHour); // fowlerk add for formatting, 12/22/16
148
- sunsetTime = String (tempHourBuff); // fowlerk add for formatting, 12/22/16
149
+ astronomy-> sunsetTime = String (tempHourBuff); // fowlerk add for formatting, 12/22/16
149
150
// sunsetTime = value;
150
151
}
151
152
if (currentKey == " minute" ) {
152
153
char tempMinBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
153
154
sprintf (tempMinBuff, " %02d" , value.toInt ()); // fowlerk add for formatting, 12/22/16
154
- sunsetTime += " :" + String (tempMinBuff); // fowlerk add for formatting, 12/22/16
155
+ astronomy-> sunsetTime += " :" + String (tempMinBuff); // fowlerk add for formatting, 12/22/16
155
156
if (isPM) sunsetTime += " pm" ;
156
157
else if (usePM) sunsetTime += " am" ;
157
158
}
@@ -167,13 +168,13 @@ void WundergroundAstronomy::value(String value) {
167
168
else isPM = false ;
168
169
char tempHourBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
169
170
sprintf (tempHourBuff, " %2d" , tempHour); // fowlerk add for formatting, 12/22/16
170
- moonriseTime = String (tempHourBuff); // fowlerk add for formatting, 12/22/16
171
+ astronomy-> moonriseTime = String (tempHourBuff); // fowlerk add for formatting, 12/22/16
171
172
// moonriseTime = value;
172
173
}
173
174
if (currentKey == " minute" ) {
174
175
char tempMinBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
175
176
sprintf (tempMinBuff, " %02d" , value.toInt ()); // fowlerk add for formatting, 12/22/16
176
- moonriseTime += " :" + String (tempMinBuff); // fowlerk add for formatting, 12/22/16
177
+ astronomy-> moonriseTime += " :" + String (tempMinBuff); // fowlerk add for formatting, 12/22/16
177
178
if (isPM) moonriseTime += " pm" ;
178
179
else if (usePM) moonriseTime += " am" ;
179
180
}
@@ -183,12 +184,12 @@ void WundergroundAstronomy::value(String value) {
183
184
if (currentKey == " hour" ) {
184
185
char tempHourBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
185
186
sprintf (tempHourBuff, " %2d" , value.toInt ()); // fowlerk add for formatting, 12/22/16
186
- moonsetTime = String (tempHourBuff); // fowlerk add for formatting, 12/22/16
187
+ astronomy-> moonsetTime = String (tempHourBuff); // fowlerk add for formatting, 12/22/16
187
188
}
188
189
if (currentKey == " minute" ) {
189
190
char tempMinBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
190
191
sprintf (tempMinBuff, " %02d" , value.toInt ()); // fowlerk add for formatting, 12/22/16
191
- moonsetTime += " :" + String (tempMinBuff); // fowlerk add for formatting, 12/22/16
192
+ astronomy-> moonsetTime += " :" + String (tempMinBuff); // fowlerk add for formatting, 12/22/16
192
193
}
193
194
}
194
195
@@ -214,33 +215,3 @@ void WundergroundAstronomy::endDocument() {
214
215
void WundergroundAstronomy::startArray () {
215
216
216
217
}
217
-
218
-
219
- // JJG added ... /////////////////////////////////////////////////////////////////////////////////////////
220
- String WundergroundAstronomy::getMoonPctIlum () {
221
- return moonPctIlum;
222
- }
223
-
224
- String WundergroundAstronomy::getMoonAge () {
225
- return moonAge;
226
- }
227
-
228
- String WundergroundAstronomy::getMoonPhase () {
229
- return moonPhase;
230
- }
231
-
232
- String WundergroundAstronomy::getSunriseTime () {
233
- return sunriseTime;
234
- }
235
-
236
- String WundergroundAstronomy::getSunsetTime () {
237
- return sunsetTime;
238
- }
239
-
240
- String WundergroundAstronomy::getMoonriseTime () {
241
- return moonriseTime;
242
- }
243
-
244
- String WundergroundAstronomy::getMoonsetTime () {
245
- return moonsetTime;
246
- }
0 commit comments