-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPFFIAPUploadAgent.h
52 lines (43 loc) · 1.33 KB
/
PFFIAPUploadAgent.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
//
// 2011/09/19 ver.1 H.Inoue & H.Ochiai
//
// --------- FIAPUploadAgent.h (begin) ---------
#ifndef __FIAPUploadAgent__
#define __FIAPUploadAgent__
#define FIAP_RESPONSE_TIMEOUT 500000 // 500ms
// return code of post method
#define FIAP_UPLOAD_OK 0 // Succeeded
#define FIAP_UPLOAD_CONNFAIL 1 // Connection faild (Socket I/O error)
#define FIAP_UPLOAD_DNSERR 2 // DNS error
#define FIAP_UPLOAD_HTTPERR 3 // HTTP Server error (The response was not "200 OK")
#define FIAP_UPLOAD_FIAPERR 4 // FIAP Server error
#define FIAP_UPLOAD_HTTPTOERR 5 // HTTP Timeout error
#include <Arduino.h>
#include "TimeLib.h"
#include "LocalTimeLib.h"
// point element
struct fiap_element {
const char* cid; // ポイントIDのポストフィックス
char* value; // 値(文字列)
time_t time;
TimeZone* timezone; // タイムゾーン
};
// class definition
class FIAPUploadAgent {
public:
void begin(
String server_host,
String server_path,
unsigned short server_port,
String fiap_id_prefix);
int post(struct fiap_element* v, byte esize);
private:
char *element_time_to_str(struct fiap_element* e);
private:
String server_host;
String server_path;
unsigned short server_port;
String fiap_id_prefix;
};
#endif // #ifndef FIAPUploadAgent
// --------- FIAPUploadAgent.h (end) ---------