@@ -31,16 +31,17 @@ See more at http://blog.squix.ch
3131WundergroundAstronomy::WundergroundAstronomy (boolean _usePM) {
3232 usePM = _usePM;
3333}
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" );
3636}
3737// end JJG add ////////////////////////////////////////////////////////////////////
3838
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" );
4141}
4242
43- void WundergroundAstronomy::doUpdate (String url) {
43+ void WundergroundAstronomy::doUpdate (WGAstronomy *astronomy, String url) {
44+ this ->astronomy = astronomy;
4445 JsonStreamingParser parser;
4546 parser.setListener (this );
4647 WiFiClient client;
@@ -100,15 +101,15 @@ void WundergroundAstronomy::key(String key) {
100101void WundergroundAstronomy::value (String value) {
101102
102103 if (currentKey == " ageOfMoon" ) {
103- moonAge = value;
104+ astronomy-> moonAge = value;
104105 }
105106
106107 if (currentKey == " phaseofMoon" ) {
107- moonPhase = value;
108+ astronomy-> moonPhase = value;
108109 }
109110
110111 if (currentKey == " percentIlluminated" ) {
111- moonPctIlum = value;
112+ astronomy-> moonPctIlum = value;
112113 }
113114
114115
@@ -122,13 +123,13 @@ void WundergroundAstronomy::value(String value) {
122123 else isPM = false ;
123124 char tempHourBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
124125 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
126127 // sunriseTime = value;
127128 }
128129 if (currentKey == " minute" ) {
129130 char tempMinBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
130131 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
132133 if (isPM) sunriseTime += " pm" ;
133134 else if (usePM) sunriseTime += " am" ;
134135 }
@@ -145,13 +146,13 @@ void WundergroundAstronomy::value(String value) {
145146 else isPM = false ;
146147 char tempHourBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
147148 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
149150 // sunsetTime = value;
150151 }
151152 if (currentKey == " minute" ) {
152153 char tempMinBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
153154 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
155156 if (isPM) sunsetTime += " pm" ;
156157 else if (usePM) sunsetTime += " am" ;
157158 }
@@ -167,13 +168,13 @@ void WundergroundAstronomy::value(String value) {
167168 else isPM = false ;
168169 char tempHourBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
169170 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
171172 // moonriseTime = value;
172173 }
173174 if (currentKey == " minute" ) {
174175 char tempMinBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
175176 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
177178 if (isPM) moonriseTime += " pm" ;
178179 else if (usePM) moonriseTime += " am" ;
179180 }
@@ -183,12 +184,12 @@ void WundergroundAstronomy::value(String value) {
183184 if (currentKey == " hour" ) {
184185 char tempHourBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
185186 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
187188 }
188189 if (currentKey == " minute" ) {
189190 char tempMinBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
190191 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
192193 }
193194 }
194195
@@ -214,33 +215,3 @@ void WundergroundAstronomy::endDocument() {
214215void WundergroundAstronomy::startArray () {
215216
216217}
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