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 */
|