Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion WundergroundClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,23 @@ void WundergroundClient::updateConditions(String apiKey, String language, String
doUpdate("/api/" + apiKey + "/conditions/lang:" + language + "/q/zmw:" + zmwCode + ".json");
}

void WundergroundClient::updateConditionsPWS(String apiKey, String language, String pws) {
isForecast = false;
doUpdate("/api/" + apiKey + "/conditions/lang:" + language + "/q/pws:" + pws + ".json");
}

void WundergroundClient::updateForecast(String apiKey, String language, String country, String city) {
isForecast = true;
doUpdate("/api/" + apiKey + "/forecast10day/lang:" + language + "/q/" + country + "/" + city + ".json");
}

void WundergroundClient::updateForecast(String apiKey, String language, String zmwCode) {

void WundergroundClient::updateForecastPWS(String apiKey, String language, String pws) {
isForecast = true;
doUpdate("/api/" + apiKey + "/forecast10day/lang:" + language + "/q/pws:" + pws + ".json");
}

void WundergroundClient::updateForecastZMW(String apiKey, String language, String zmwCode) {
isForecast = true;
doUpdate("/api/" + apiKey + "/forecast10day/lang:" + language + "/q/zmw:" + zmwCode + ".json");
}
Expand All @@ -68,6 +79,10 @@ void WundergroundClient::updateAstronomy(String apiKey, String language, String
}
// end JJG add ////////////////////////////////////////////////////////////////////

void WundergroundClient::updateAstronomyPWS(String apiKey, String language, String pws) {
isForecast = true;
doUpdate("/api/" + apiKey + "/astronomy/lang:" + language + "/q/pws:" + pws + ".json");
}
// fowlerk added
void WundergroundClient::updateAlerts(String apiKey, String language, String country, String city) {
currentAlert = 0;
Expand All @@ -87,6 +102,23 @@ void WundergroundClient::updateAlerts(String apiKey, String language, String cou
}
// end fowlerk add

void WundergroundClient::updateAlertsPWS(String apiKey, String language, String country, String pws) {
currentAlert = 0;
activeAlertsCnt = 0;
isForecast = false;
isSimpleForecast = false;
isCurrentObservation = false;
isAlerts = true;
if (country == "US") {
isAlertUS = true;
isAlertEU = false;
} else {
isAlertUS = false;
isAlertEU = true;
}
doUpdate("/api/" + apiKey + "/alerts/lang:" + language + "/q/pws:" + pws + ".json");
}

void WundergroundClient::doUpdate(String url) {
JsonStreamingParser parser;
parser.setListener(this);
Expand Down
53 changes: 28 additions & 25 deletions WundergroundClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,15 @@ class WundergroundClient: public JsonListener {
WundergroundClient(boolean isMetric);
void updateConditions(String apiKey, String language, String country, String city);
void updateConditions(String apiKey, String language, String zmwCode);
void updateConditionsPWS(String apiKey, String language, String pws);
void updateForecast(String apiKey, String language, String country, String city);
void updateForecast(String apiKey, String language, String zmwCode);
void updateForecastPWS(String apiKey, String language, String pws);
void updateForecastZMW(String apiKey, String language, String zmwCode);
void updateAstronomy(String apiKey, String language, String country, String city);
void updateAlerts(String apiKey, String language, String country, String city); // Added by fowlerk, 18-Dec-2016
void initMetric(boolean isMetric); // Added by fowlerk, 12/22/16, as an option to change metric setting other than at instantiation

void updateAstronomyPWS(String apiKey, String language, String pws);
void updateAlerts(String apiKey, String language, String country, String city); // Added by fowlerk, 18-Dec-2016
void updateAlertsPWS(String apiKey, String language, String country, String pws);
void initMetric(boolean isMetric); // Added by fowlerk, 12/22/16, as an option to change metric setting other than at instantiation
// JJG added
String getHours();
String getMinutes();
Expand Down Expand Up @@ -146,13 +149,13 @@ class WundergroundClient: public JsonListener {
String getDewPoint();

String getPrecipitationToday();
// fowlerk added...
String getFeelsLike();
// fowlerk added...
String getFeelsLike();

String getUV();
String getUV();

String getObservationTime(); // fowlerk add, 04-Dec-2016
// end fowlerk add
String getObservationTime(); // fowlerk add, 04-Dec-2016
// end fowlerk add

String getForecastIcon(int period);

Expand All @@ -161,36 +164,36 @@ class WundergroundClient: public JsonListener {
String getForecastLowTemp(int period);

String getForecastHighTemp(int period);
// fowlerk added...
String getForecastDay(int period);
// fowlerk added...
String getForecastDay(int period);

String getForecastMonth(int period);
String getForecastMonth(int period);

String getForecastText(int period);
String getForecastText(int period);

String getPoP(int period);
String getPoP(int period);

int getActiveAlertsCnt();
int getActiveAlertsCnt();

String getActiveAlerts(int alertIndex);
String getActiveAlerts(int alertIndex);

String getActiveAlertsText(int alertIndex);
String getActiveAlertsText(int alertIndex);

String getActiveAlertsMessage(int alertIndex);
String getActiveAlertsMessage(int alertIndex);

bool getActiveAlertsMessageTrunc(int alertIndex);
bool getActiveAlertsMessageTrunc(int alertIndex);

String getActiveAlertsStart(int alertIndex);
String getActiveAlertsStart(int alertIndex);

String getActiveAlertsEnd(int alertIndex);
String getActiveAlertsEnd(int alertIndex);

String getActiveAlertsPhenomena(int alertIndex);
String getActiveAlertsPhenomena(int alertIndex);

String getActiveAlertsSignificance(int alertIndex);
String getActiveAlertsSignificance(int alertIndex);

String getActiveAlertsAttribution(int alertIndex);
String getActiveAlertsAttribution(int alertIndex);

// end fowlerk add
// end fowlerk add

virtual void whitespace(char c);

Expand Down