-
Notifications
You must be signed in to change notification settings - Fork 0
/
pwsweather.h
74 lines (58 loc) · 1.67 KB
/
pwsweather.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef __PWSWeather_H__
#define __PWSWeather_H__
#include "WeatherSink.h"
#include <curl/curl.h>
#define PWSWEATHER_STRING_SIZE (512)
#define PWSWEATHER_RT_URL "http://www.pwsweather.com/pwsupdate/pwsupdate.php"
class PWSWeather: public WeatherSink
{
public:
PWSWeather( Config cfg, WeatherData *wd );
~PWSWeather();
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[PWSWEATHER_STRING_SIZE];
};
#endif //__PWSWeather_H__
#ifndef __PWSWeather_H__
#define __PWSWeather_H__
#include "WeatherSink.h"
#include <curl/curl.h>
#define PWSWEATHER_STRING_SIZE (512)
#define PWSWEATHER_RT_URL "http://www.pwsweather.com/pwsupdate/pwsupdate.php"
class PWSWeather: public WeatherSink
{
public:
PWSWeather( Config cfg, WeatherData *wd );
~PWSWeather();
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[PWSWEATHER_STRING_SIZE];
};
#endif //__PWSWeather_H__