-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweatherbug.h
74 lines (58 loc) · 1.68 KB
/
weatherbug.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 __WeatherBug_H__
#define __WeatherBug_H__
#include "WeatherSink.h"
#include <curl/curl.h>
#define WEATHERBUG_STRING_SIZE (512)
#define WEATHERBUG_RT_URL "http://data.backyard2.weatherbug.com/data/livedata.aspx"
class WeatherBug: public WeatherSink
{
public:
WeatherBug( Config cfg, WeatherData *wd );
~WeatherBug();
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[WEATHERBUG_STRING_SIZE];
};
#endif //__WeatherBug_H__
#ifndef __WeatherBug_H__
#define __WeatherBug_H__
#include "WeatherSink.h"
#include <curl/curl.h>
#define WEATHERBUG_STRING_SIZE (512)
#define WEATHERBUG_RT_URL "http://data.backyard2.weatherbug.com/data/livedata.aspx"
class WeatherBug: public WeatherSink
{
public:
WeatherBug( Config cfg, WeatherData *wd );
~WeatherBug();
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[WEATHERBUG_STRING_SIZE];
};
#endif //__WeatherBug_H__