-
Notifications
You must be signed in to change notification settings - Fork 0
/
wunderground.h
40 lines (29 loc) · 900 Bytes
/
wunderground.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef __WUNDERGROUND_H__
#define __WUNDERGROUND_H__
#include "WeatherSink.h"
#include <curl/curl.h>
#define WUNDERGROUND_STRING_SIZE (512)
#define WUNDERGROUND_RT_URL "http://rtupdate.wunderground.com/weatherstation/updateweatherstation.php"
class Wunderground: public WeatherSink
{
public:
Wunderground( Config cfg, WeatherData *wd );
~Wunderground();
void newData();
void main();
static size_t curl_write( void *buffer, size_t size, size_t nmemb, void* userp );
private:
bool appendData( const char * format, WeatherData::PROPERTY, float divider = 1 );
void generatePacket( void );
void uploadPacket( void );
private:
pthread_mutex_t notify;
CURL *curl;
CURLcode res;
int failureCount;
float updateFrequency;
Now uploadTime;
char curlErrorBuf[CURL_ERROR_SIZE];
char uploadString[WUNDERGROUND_STRING_SIZE];
};
#endif //__WUNDERGROUND_H__