28 lines
1.1 KiB
C
28 lines
1.1 KiB
C
// File: include/net_influx.h
|
|
#pragma once
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include "esp_err.h"
|
|
|
|
typedef struct {
|
|
const char* url_base; // "http://host:8086" oder "https://host"
|
|
const char* org;
|
|
const char* bucket;
|
|
const char* token;
|
|
bool use_tls; // optional; wenn true => TLS erzwingen
|
|
const char* ca_cert_pem; // optional, bei https (kann NULL sein wenn Test)
|
|
int http_timeout_ms; // z.B. 3000
|
|
} net_influx_cfg_t;
|
|
|
|
esp_err_t net_influx_init(const net_influx_cfg_t* cfg);
|
|
|
|
// Convenience: lädt URL/org/bucket/token direkt aus NVS (storage.c)
|
|
esp_err_t net_influx_init_from_nvs(const char* ca_cert_pem_opt, int timeout_ms);
|
|
|
|
// generisches Write (Line Protocol Felderformatierung via printf)
|
|
esp_err_t net_influx_write_fields(const char* measurement,
|
|
const char* tags, // "k=v,k2=v2" oder NULL
|
|
uint64_t ts_ms, // 0 = Serverzeit
|
|
const char* fields_fmt,
|
|
...);
|