forked from tobiasschuerg/InfluxDB-Client-for-Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInfluxDb.h
More file actions
65 lines (52 loc) · 1.17 KB
/
InfluxDb.h
File metadata and controls
65 lines (52 loc) · 1.17 KB
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
/**
ESP8266 InfluxDb: Influxdb.h
Purpose: Helps with sending measurements to an Influx database.
@author Tobias Schürg
*/
#if defined(ESP8266)
#include <ESP8266HTTPClient.h>
#include <WiFiClientSecure.h>
#elif defined(ESP32)
#include <WiFi.h>
#include <HTTPClient.h>
#endif
#include <list>
#include "Arduino.h"
#include "InfluxData.h"
class Influxdb {
public:
Influxdb(String host, uint16_t port = 8086);
void setDb(String db);
void setDbAuth(String db, String user, String pass);
void setVersion(uint16_t version);
void setBucket(String bucket);
void setOrg(String org);
void setToken(String token);
void setPort(uint16_t port);
#if defined(ESP8266)
void setFingerPrint(char *fingerPrint);
#endif
void prepare(InfluxData data);
boolean write();
boolean write(InfluxData data);
boolean write(String data);
private:
HTTPClient http;
#if defined(ESP8266)
WiFiClientSecure client;
#endif
String _host;
uint16_t _port;
String _db;
String _user;
String _pass;
String _bucket;
String _org;
String _token;
uint16_t _db_v;
#if defined(ESP8266)
char *_fingerPrint;
#endif
std::list<InfluxData> prepared;
void begin();
};