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 2525 * SOFTWARE.
2626*/
2727#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+
2843
2944// Uncomment bellow in case of a problem and rebuild sketch
3045// #define INFLUXDB_CLIENT_DEBUG
@@ -206,6 +221,9 @@ bool InfluxDBClient::init() {
206221 _wifiClient = new WiFiClient;
207222 }
208223 _httpClient.setReuse (false );
224+
225+ String userAgent (INFLUXDB_CLIENT_USER_AGENT " (" INFLUXDB_CLIENT_PLATFORM " " INFLUXDB_CLIENT_PLATFORM_VERSION " )" );
226+ _httpClient.setUserAgent (userAgent);
209227 return true ;
210228}
211229
You can’t perform that action at this time.
0 commit comments