Skip to content

Commit b2b932c

Browse files
committed
add conditionals from esp8266 only
1 parent 1b949d8 commit b2b932c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

InfluxDb.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ void Influxdb::setVersion(uint16_t version){
8181
begin();
8282
}
8383

84+
#if defined(ESP8266)
8485
/**
8586
* Set servers finger print for HTTPS v2 Influx proto
8687
* @param version accepts 1 for version 1.x or 2 for version 2.x
@@ -89,15 +90,20 @@ void Influxdb::setFingerPrint(char *fingerPrint){
8990
_fingerPrint = fingerPrint;
9091
begin();
9192
}
93+
#endif
9294

9395
void Influxdb::begin() {
9496
// TODO: recreate HttpClient on db change?
9597
if(_db_v == 2){
98+
#if defined(ESP8266)
9699
if (_port == 443) {
97100
if (_fingerPrint)
98101
client.setFingerprint(_fingerPrint);
99102
http.begin(client, _host, _port, "/api/v2/write?org=" + _org + "&bucket=" + _bucket, true);
100-
} else {
103+
}
104+
else
105+
#endif
106+
{
101107
http.begin(_host, _port, "/api/v2/write?org=" + _org + "&bucket=" + _bucket);
102108
}
103109
} else {

InfluxDb.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ class Influxdb {
3131
void setOrg(String org);
3232
void setToken(String token);
3333
void setPort(uint16_t port);
34+
#if defined(ESP8266)
3435
void setFingerPrint(char *fingerPrint);
36+
#endif
3537

3638
void prepare(InfluxData data);
3739
boolean write();
@@ -41,7 +43,9 @@ class Influxdb {
4143

4244
private:
4345
HTTPClient http;
46+
#if defined(ESP8266)
4447
WiFiClientSecure client;
48+
#endif
4549
String _host;
4650
uint16_t _port;
4751
String _db;
@@ -51,7 +55,9 @@ class Influxdb {
5155
String _org;
5256
String _token;
5357
uint16_t _db_v;
58+
#if defined(ESP8266)
5459
char *_fingerPrint;
60+
#endif
5561

5662
std::list<InfluxData> prepared;
5763

0 commit comments

Comments
 (0)