/* * csi_manager.h * * Copyright (c) 2025 Umber Networks & Robert McMahon * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #pragma once #include #include #include "esp_err.h" #ifdef __cplusplus extern "C" { #endif /** * @brief Initialize CSI Manager state */ void csi_mgr_init(void); /** * @brief Enable CSI capture asynchronously * Spawns a task to wait 2 seconds (to let connection settle) then enables CSI. * Safe to call from Event Handlers. */ void csi_mgr_enable_async(void); /** * @brief Disable CSI capture immediately */ void csi_mgr_disable(void); /** * @brief Dump collected CSI data to UART asynchronously * Spawns a task that waits 20s then dumps data (simulating your original logic). */ void csi_mgr_schedule_dump(void); /** * @brief Check if CSI is currently enabled */ bool csi_mgr_is_enabled(void); /** * @brief Get total packet count (stats) */ uint32_t csi_mgr_get_packet_count(void); /** * @brief Save CSI enable state to NVS * * @param enable true to enable CSI on boot, false to disable * @return esp_err_t ESP_OK on success */ esp_err_t csi_mgr_save_enable_state(bool enable); /** * @brief Load CSI enable state from NVS * * @param enable Output: CSI enable state (default: false if not found) * @return esp_err_t ESP_OK on success, ESP_ERR_NVS_NOT_FOUND if not set */ esp_err_t csi_mgr_load_enable_state(bool *enable); /** * @brief Check if CSI should be enabled based on NVS config * Returns false by default if no config exists * * @return bool true if CSI should be enabled */ bool csi_mgr_should_enable(void); #ifdef __cplusplus } #endif