summaryrefslogtreecommitdiff
path: root/src/localtemp.h
diff options
context:
space:
mode:
authorGaspar Fernandez <gaspar.fernandez@totaki.com>2016-08-12 01:29:28 +0200
committerGaspar Fernandez <gaspar.fernandez@totaki.com>2016-08-12 01:29:28 +0200
commite463cfd3cbd419dc38583fe25b93be36b330a606 (patch)
treeadd192be35a2e37ace95ee6f33a0a65d612dad9b /src/localtemp.h
parentf5932870164b72d2a67352495f3062f31f1fc5fd (diff)
downloaddwgo-e463cfd3cbd419dc38583fe25b93be36b330a606.tar.gz
dwgo-e463cfd3cbd419dc38583fe25b93be36b330a606.tar.bz2
dwgo-e463cfd3cbd419dc38583fe25b93be36b330a606.zip
Version 0.4d
Diffstat (limited to 'src/localtemp.h')
-rw-r--r--src/localtemp.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/localtemp.h b/src/localtemp.h
new file mode 100644
index 0000000..19173d3
--- /dev/null
+++ b/src/localtemp.h
@@ -0,0 +1,57 @@
+#include <string.h>
+#include <strings.h>
+#include "errors.h"
+
+#define METAR_URL "http://weather.noaa.gov/pub/data/observations/metar/decoded/%s.TXT"
+
+class localtemp {
+public:
+ enum ESky
+ {
+ undef_sky,
+ clear, // CAVOK, SKC, CLR
+ cloudy, // FEW, SCT
+ brkovc, // Broken, Overcast (BKN, OVC)
+ tcu // TCU (Towering CUmulus)
+ };
+ enum ERain
+ {
+ undef_rain,
+ rain, // Rainy (DZ, RA)
+ snow, // Snowy (SN, SG)
+ hail // Hail (GS, GR)
+ };
+ enum EFog
+ {
+ undef_fog,
+ fog, // (BR, FG)
+ dust, // (DU, DS)
+ other // (FC, FU, HZ, SA, SS, VA)
+ };
+
+ struct TMetar
+ {
+ ESky sky;
+ bool CB; // Cumulonimbus
+ ERain rain;
+ EFog fog;
+ };
+ std::string metar;
+ std::string location_name;
+ std::string long_location;
+ std::string ob; // ob: line, METAR info.
+ int error, celsius, fahrenheit;
+ int theme; // º theme to use
+ short humidity;
+ bool loaded;
+ string sky;
+ TMetar mInfo;
+ time_t info_time; // Time stored in file
+ time_t get_time; // Time when we got the file
+ localtemp(char* metar, char* location_name);
+ bool getInfo();
+private:
+ void set_temp(std::string temp);
+ void set_humidity(std::string hum);
+ void get_ob_info();
+};