28 lines
No EOL
535 B
C++
28 lines
No EOL
535 B
C++
#ifndef Weather_h
|
|
#define Weather_h
|
|
#include <Arduino.h>
|
|
|
|
#define WEATHER_URL "http://api.openweathermap.org/data/2.5/weather?lat=%s&lon=%s&appid=%s"
|
|
|
|
enum WeatherCondition
|
|
{
|
|
Clear,
|
|
Rain,
|
|
Thunder,
|
|
Other
|
|
};
|
|
|
|
class Weather{
|
|
char _url[120];
|
|
int _cloudCover;
|
|
WeatherCondition _condition;
|
|
String getWeatherJson();
|
|
WeatherCondition parseCondition(int weatherId);
|
|
|
|
public:
|
|
Weather(char *lat, char *lon);
|
|
void update();
|
|
int getCloudCover() { return _cloudCover; }
|
|
WeatherCondition getCondition() { return _condition; }
|
|
};
|
|
#endif |