Get weather Information
Diff: WeatherHacks.cpp
- Revision:
- 3:6618936f930a
- Parent:
- 2:76b812680942
--- a/WeatherHacks.cpp Sun Jul 05 08:11:40 2015 +0000 +++ b/WeatherHacks.cpp Sun Nov 22 08:50:49 2015 +0000 @@ -19,6 +19,12 @@ #define ERR(x, ...) std::printf("[WeatherHacks : ERR]"x"\r\n", ##__VA_ARGS__); +#if 0 +#define TERMINAL(x, ...) std::printf("[WeatherHacks :]"x"\r\n", ##__VA_ARGS__); +#else +#define TERMINAL(x, ...) +#endif + extern HTTPClient httpClient; void WH_init(void) @@ -77,7 +83,7 @@ time_t ctTime; ctTime = time(NULL) + JST ; t = *localtime(&ctTime); - printf("% 2d:%02d => ", t.tm_hour, t.tm_min) ; + TERMINAL("Time: % 2d:%02d => ", t.tm_hour, t.tm_min) ; const char *p ; if(t.tm_hour >= 12) { @@ -88,7 +94,7 @@ p = getHiTemp(p, hi) ; p = getLoTemp(p, lo) ; p = getPrec(p, prec) ; - printf("Hi=%s, Lo=%s, Prec=%s\n", hi, lo, prec) ; + TERMINAL("Hi=%s, Lo=%s, Prec=%s\n", hi, lo, prec) ; } #define FREE(p) if(p)free(p) @@ -101,15 +107,15 @@ ret = httpClient.get(RSS_URL, buff, size); if (!ret) { - //DBG("Result: %s\n", recv); + DBG("Result: %s\n", buff); } else { ERR("Error %s\n- ret = %d - HTTP return code = %d\n", RSS_URL, ret, httpClient.getHTTPResponseCode()); } - getLink(buff, link) ; printf("link=%s\n", link) ; + getLink(buff, link) ; DBG("link=%s\n", link) ; ret = httpClient.get(link, buff, size) ; if (!ret) { - //DBG("Result: %s\n", recv); + DBG("Result: %s\n", buff) ; } else { ERR("Error %s\n- ret = %d - HTTP return code = %d\n", link, ret, httpClient.getHTTPResponseCode()); }