Automatically detect the home router as a passive radar TX source, eliminating need for a dedicated active TX node. Firmware changes: - During hello message, include ap_bssid and ap_channel from esp_wifi_sta_get_ap_info() Mothership changes: - On hello: extract ap_bssid; if >=80% of nodes report same BSSID create virtual node entry with virtual=1 - OUI lookup: embedded IEEE OUI registry as Go map compiled via go:embed; display router brand - Detect AP BSSID change (router reboot/replacement) and emit system alert - SQLite nodes table: add virtual BOOL, node_type TEXT, ap_bssid TEXT, ap_channel INT columns Dashboard changes: - Show "I detected your router (ASUS). Place it on the floor plan..." notification - Render virtual AP nodes with distinct router icon in 3D view - Drag-to-place virtual node (distinct router icon) in 3D editor Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
55 lines
1.2 KiB
C
55 lines
1.2 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);
|
|
|
|
/**
|
|
* Get AP BSSID (router MAC address).
|
|
* @param bssid Buffer to store 6-byte BSSID
|
|
* @return true if connected and BSSID retrieved, false otherwise
|
|
*/
|
|
bool wifi_get_ap_bssid(uint8_t *bssid);
|