refactor: entkopple mDNS-Discovery, Status-Flags und WiFi-Manager
- net_mdns: Autostart + Discovery-Retry stabilisiert (Forward-Declarations, Task-Start bei GOT_IP) - sys_status: EventGroup zentralisiert; Statusbits nicht mehr aus net_mdns gesetzt - main: Integration von net_mdns Autostart/Discovery und UI-Status-Update vorbereitet - wifi_mgr: mDNS-Discovery-Logik entfernt/vereinheitlicht, damit keine doppelte Discovery läuft - net_influx: Anpassungen an neue Discovery/Storage-Semantik
This commit is contained in:
@@ -1,25 +1,32 @@
|
||||
// File: include/net_mdns.h
|
||||
// net_mdns.h (Ergänzungen)
|
||||
#pragma once
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "esp_err.h"
|
||||
#include "mdns.h"
|
||||
|
||||
// bestehende APIs bleiben...
|
||||
|
||||
typedef struct {
|
||||
const char *service; // z.B. "_myapp"
|
||||
const char *proto; // z.B. "_tcp"
|
||||
int enforce_port; // -1 oder 0 = egal
|
||||
|
||||
const char *fallback_service; // z.B. "_http"
|
||||
const char *fallback_proto; // z.B. "_tcp"
|
||||
int fallback_port; // z.B. 8086
|
||||
|
||||
const char *txt_key; // optional
|
||||
const char *txt_value; // optional
|
||||
|
||||
uint32_t query_timeout_ms; // z.B. 2000
|
||||
uint32_t retry_interval_ms; // z.B. 60000
|
||||
int max_results; // z.B. 5
|
||||
|
||||
const char *instance_prefix; // z.B. "myapp-"
|
||||
bool require_instance_prefix; // true/false
|
||||
} net_mdns_discover_cfg_t;
|
||||
|
||||
esp_err_t net_mdns_autodiscover_start(const net_mdns_discover_cfg_t *cfg);
|
||||
void net_mdns_autodiscover_stop(void);
|
||||
esp_err_t net_mdns_autostart_init(const char* hostname, const char* instance_name);
|
||||
bool net_mdns_is_running(void);
|
||||
bool net_mdns_wait_started(uint32_t timeout_ms);
|
||||
esp_err_t net_mdns_add_service(const char* service, const char* proto,
|
||||
uint16_t port, mdns_txt_item_t* txt, size_t txt_count);
|
||||
|
||||
bool net_mdns_find_service_url(const char* service, const char* proto,
|
||||
int enforce_port, const char* txt_key, const char* txt_value,
|
||||
uint32_t timeout_ms, int max_results,
|
||||
char* url_out, size_t url_out_size);
|
||||
|
||||
void net_mdns_stop(void);
|
||||
|
||||
// --- NEU: Auto-Discover + NVS persistieren ---
|
||||
esp_err_t net_mdns_autodiscover_and_store(const char *service, const char *proto,
|
||||
int enforce_port,
|
||||
const char *txt_key, const char *txt_value,
|
||||
uint32_t timeout_ms);
|
||||
|
||||
Reference in New Issue
Block a user