- State machine: 7-state lifecycle (BOOT→WIFI→DISCOVERY→CONNECTED, degraded modes WIFI_LOST/MOTHERSHIP_UNAVAILABLE/CAPTIVE_PORTAL) - WiFi: STA connection with exponential backoff, mDNS discovery with cached IP fallback, captive portal AP for provisioning - WebSocket: bidirectional comms, binary CSI frames (24B header + I/Q), JSON hello/health/ble/ota_status upstream, role/config/ota/reboot downstream, OTA task with progress reporting - CSI: promiscuous mode capture, queue-based processing, passive BSSID filter, on-device variance tracking (Welford's) for motion hints - BLE: passive scanning on Core 0, 60-device cache, 5s reporting - NVS: 15-key schema with versioning, role/rate persistence Complete: ESP32 firmware skeleton, passive radar, BLE scanning Remaining: Dashboard skeleton, Docker packaging (Phase 1 items 5-6) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
48 lines
1 KiB
C
48 lines
1 KiB
C
#pragma once
|
|
|
|
#include "esp_err.h"
|
|
|
|
/**
|
|
* Initialize WiFi subsystem.
|
|
* Sets up WiFi stack, event handlers, and mDNS.
|
|
*/
|
|
esp_err_t wifi_init(void);
|
|
|
|
/**
|
|
* Start WiFi connection using stored credentials.
|
|
* Uses exponential backoff on failure.
|
|
*/
|
|
esp_err_t wifi_start_connect(void);
|
|
|
|
/**
|
|
* Discover mothership via mDNS.
|
|
*
|
|
* @param ip_buf Buffer to store discovered IP address
|
|
* @param buf_len Length of IP buffer
|
|
* @param port Pointer to store discovered port (may be updated)
|
|
* @return true if discovered, false otherwise
|
|
*/
|
|
bool wifi_discover_mothership(char *ip_buf, size_t buf_len, uint16_t *port);
|
|
|
|
/**
|
|
* Start captive portal AP mode.
|
|
* Creates AP "spaxel-XXXX" and serves config page.
|
|
*/
|
|
esp_err_t wifi_start_captive_portal(void);
|
|
|
|
/**
|
|
* Get current WiFi RSSI.
|
|
* @return RSSI in dBm, or 0 if not connected
|
|
*/
|
|
int8_t wifi_get_rssi(void);
|
|
|
|
/**
|
|
* Get current WiFi channel.
|
|
* @return Channel number, or 0 if not connected
|
|
*/
|
|
uint8_t wifi_get_channel(void);
|
|
|
|
/**
|
|
* Check if WiFi is connected.
|
|
*/
|
|
bool wifi_is_connected(void);
|