This commit is contained in:
michael
2026-01-17 02:49:32 +01:00
parent a1ccda2e88
commit 4905663933
283 changed files with 32074 additions and 15759 deletions

View File

@@ -1,6 +1,5 @@
#ifdef ENABLE_INFLUXDB
#pragma once
#ifndef INTERFACE_INFLUXDB_H
#define INTERFACE_INFLUXDB_H
@@ -8,13 +7,12 @@
#include <map>
#include <functional>
#include <string>
#include "esp_http_client.h"
#include "esp_log.h"
enum InfluxDBVersion {
enum InfluxDBVersion
{
INFLUXDB_V1,
INFLUXDB_V2
};
@@ -22,61 +20,62 @@ enum InfluxDBVersion {
/**
* @class InfluxDB
* @brief A class to handle connections and data publishing to InfluxDB servers.
*
*
* This class supports both InfluxDB v1.x and v2.x versions. It provides methods to initialize
* the connection parameters, publish data, and destroy the connection.
*
*
* @private
* @var std::string influxDBURI
* URI for the InfluxDB server.
*
*
* @var std::string database
* Database name for InfluxDB v1.x.
*
*
* @var std::string user
* Username for InfluxDB v1.x.
*
*
* @var std::string password
* Password for InfluxDB v1.x.
*
*
* @var std::string bucket
* Bucket name for InfluxDB v2.x.
*
*
* @var std::string org
* Organization name for InfluxDB v2.x.
*
*
* @var std::string token
* Token for InfluxDB v2.x.
*
*
* @var InfluxDBVersion version
* Version of the InfluxDB server (v1.x or v2.x).
*
*
* @var esp_http_client_handle_t httpClient
* HTTP client handle for making requests to the InfluxDB server.
*
*
* @var void connectHTTP()
* Establishes an HTTP connection to the InfluxDB server.
*
*
* @public
* @fn void InfluxDBInitV1(std::string _influxDBURI, std::string _database, std::string _user, std::string _password)
* Initializes the connection parameters for InfluxDB v1.x.
*
*
* @fn void InfluxDBInitV2(std::string _influxDBURI, std::string _bucket, std::string _org, std::string _token)
* Initializes the connection parameters for InfluxDB v2.x.
*
*
* @fn void InfluxDBdestroy()
* Destroys the InfluxDB connection.
*
*
* @fn void InfluxDBPublish(std::string _measurement, std::string _key, std::string _content, long int _timeUTC)
* Publishes data to the InfluxDB server.
*
*
* @param _measurement The measurement name.
* @param _key The key for the data point.
* @param _content The content or value of the data point.
* @param _timeUTC The timestamp in UTC for the data point.
*/
class InfluxDB {
class InfluxDB
{
private:
// Information for InfluxDB v1.x
std::string influxDBURI = "";
@@ -107,7 +106,4 @@ public:
void InfluxDBPublish(std::string _measurement, std::string _key, std::string _content, long int _timeUTC);
};
#endif //INTERFACE_INFLUXDB_H
#endif //ENABLE_INFLUXDB
#endif // INTERFACE_INFLUXDB_H