Complete end-to-end WiFi CSI capture pipeline verified on real hardware: - ESP32-S3 firmware: WiFi STA + promiscuous mode CSI collection, ADR-018 binary serialization, UDP streaming at ~20 Hz - Rust aggregator CLI binary (clap): receives UDP frames, parses with Esp32CsiParser, prints per-frame summary (node, seq, rssi, amp) - UDP aggregator module with per-node sequence tracking and drop detection - CsiFrame bridge to detection pipeline (amplitude/phase/SNR conversion) - Python ESP32 binary parser with UDP reader - Presence detection confirmed: motion score 10/10 from live CSI variance Hardware verified: ESP32-S3-DevKitC-1 (CP2102, MAC 3C:0F:02:EC:C2:28), Docker ESP-IDF v5.2 build, esptool 5.1.0 flash, 20 Rust + 6 Python tests pass. Co-Authored-By: claude-flow <ruv@ruv.net>
39 lines
1010 B
C
39 lines
1010 B
C
/**
|
|
* @file csi_collector.h
|
|
* @brief CSI data collection and ADR-018 binary frame serialization.
|
|
*/
|
|
|
|
#ifndef CSI_COLLECTOR_H
|
|
#define CSI_COLLECTOR_H
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include "esp_wifi_types.h"
|
|
|
|
/** ADR-018 magic number. */
|
|
#define CSI_MAGIC 0xC5110001
|
|
|
|
/** ADR-018 header size in bytes. */
|
|
#define CSI_HEADER_SIZE 20
|
|
|
|
/** Maximum frame buffer size (header + 4 antennas * 256 subcarriers * 2 bytes). */
|
|
#define CSI_MAX_FRAME_SIZE (CSI_HEADER_SIZE + 4 * 256 * 2)
|
|
|
|
/**
|
|
* Initialize CSI collection.
|
|
* Registers the WiFi CSI callback.
|
|
*/
|
|
void csi_collector_init(void);
|
|
|
|
/**
|
|
* Serialize CSI data into ADR-018 binary frame format.
|
|
*
|
|
* @param info WiFi CSI info from the ESP-IDF callback.
|
|
* @param buf Output buffer (must be at least CSI_MAX_FRAME_SIZE bytes).
|
|
* @param buf_len Size of the output buffer.
|
|
* @return Number of bytes written, or 0 on error.
|
|
*/
|
|
size_t csi_serialize_frame(const wifi_csi_info_t *info, uint8_t *buf, size_t buf_len);
|
|
|
|
#endif /* CSI_COLLECTOR_H */
|