diff --git a/ESPinfluxdb.cpp b/ESPinfluxdb.cpp index e781ae3..d51284e 100644 --- a/ESPinfluxdb.cpp +++ b/ESPinfluxdb.cpp @@ -11,11 +11,26 @@ #define _DEBUG #endif +Influxdb::Influxdb() +{ + // empty constructor so that host and port can be initialized later +} + Influxdb::Influxdb(const char *host, uint16_t port) { _port = String(port); _host = String(host); } +void Influxdb::setHost(const char *host) +{ + _host = String(host); +} + +void Influxdb::setPort(uint16_t port) +{ + _port = String(port); +} + DB_RESPONSE Influxdb::opendb(String db, String user, String password) { _db = db + "&u=" + user + "&p=" + password; } diff --git a/ESPinfluxdb.h b/ESPinfluxdb.h index cd056e7..dd4040f 100644 --- a/ESPinfluxdb.h +++ b/ESPinfluxdb.h @@ -40,8 +40,12 @@ String _tag; class Influxdb { public: +Influxdb(); Influxdb(const char* host, uint16_t port); +void setHost(const char* host); +void setPort(uint16_t port); + DB_RESPONSE opendb(String db); DB_RESPONSE opendb(String db, String user, String password); DB_RESPONSE write(dbMeasurement data);