Files
kxkmandClaude Sonnet 4.6 defc5eba2d style: clang-format-18 all firmware sources (full sweep)
Previous commit only formatted 3 files; CI checks all 27 files
in src/, include/, test/. Format the full set to clear firmware-lint.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-03-27 05:46:03 +01:00

34 lines
921 B
C++

#pragma once
#include <cstdint>
#include <string>
#include <vector>
#include "firmware_utils.h" // WifiNetwork, FwRssiQuality, FwWifiToJson
/// Lightweight WiFi scanner.
///
/// Usage:
/// WifiScanner scanner;
/// auto nets = scanner.Scan(4000);
/// Serial.println(scanner.last_json().c_str());
///
/// Pure utility functions (RssiQuality, ToJson, SortByRssi) live in
/// firmware_utils.h and are tested natively via Unity.
class WifiScanner {
public:
/// Scan available networks, block up to timeout_ms.
/// Returns networks sorted by RSSI descending.
std::vector<WifiNetwork> Scan(uint32_t timeout_ms = 4000);
/// JSON string from the last Scan() call.
const std::string &last_json() const { return last_json_; }
/// Duration of the last Scan() call in ms.
uint32_t last_duration_ms() const { return last_duration_ms_; }
private:
std::string last_json_;
uint32_t last_duration_ms_ = 0;
};