Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions ESPinfluxdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions ESPinfluxdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down