File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 25
25
* SOFTWARE.
26
26
*/
27
27
#include " InfluxDbClient.h"
28
+ #include < core_version.h>
29
+
30
+ #define STRHELPER (x ) #x
31
+ #define STR (x ) STRHELPER(x) // stringifier
32
+
33
+ #define INFLUXDB_CLIENT_USER_AGENT " influxdb-client-arduino/" INFLUXDB_CLIENT_VERSION
34
+
35
+ #if defined(ESP8266)
36
+ # define INFLUXDB_CLIENT_PLATFORM " ESP8266"
37
+ # define INFLUXDB_CLIENT_PLATFORM_VERSION STR (ARDUINO_ESP8266_GIT_DESC)
38
+ #elif defined(ESP32)
39
+ # define INFLUXDB_CLIENT_PLATFORM " ESP32"
40
+ # define INFLUXDB_CLIENT_PLATFORM_VERSION STR (ARDUINO_ESP32_GIT_DESC)
41
+ #endif
42
+
28
43
29
44
// Uncomment bellow in case of a problem and rebuild sketch
30
45
// #define INFLUXDB_CLIENT_DEBUG
@@ -206,6 +221,9 @@ bool InfluxDBClient::init() {
206
221
_wifiClient = new WiFiClient;
207
222
}
208
223
_httpClient.setReuse (false );
224
+
225
+ String userAgent (INFLUXDB_CLIENT_USER_AGENT " (" INFLUXDB_CLIENT_PLATFORM " " INFLUXDB_CLIENT_PLATFORM_VERSION " )" );
226
+ _httpClient.setUserAgent (userAgent);
209
227
return true ;
210
228
}
211
229
You can’t perform that action at this time.
0 commit comments