Public Access
- lib/wifi (host-tested): scan_log (CSV field quoting, header/row, a once-per-interval throttle) and network_list_view (sort by signal / channel / name, filter open-only / hide-hidden / strong-only) - ScanEntry moved to lib/wifi so both are testable on the PC - Wi-Fi Tools networks view: s sort, o/h/w filters, l toggles logging to /wifi/scans/<date>.csv (header + one row per AP per logged scan, throttled 30 s, needs the clock for timestamps); foreground-only - Wi-Fi scan logs replace probe-request logs as a clean-up category - Serial: cat <path>, and key <char> injects a character Verified on the device: CSV written with header, timestamps, BSSID, channel, RSSI, security and SSID; hidden networks marked. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "scan_entry.h"
|
|
|
|
namespace roro {
|
|
|
|
// Writes what Wi-Fi Tools already sees (access points, channel, signal) to a CSV Log, so the user
|
|
// can track their own Wi-Fi environment over time. One row per access point per logged scan.
|
|
namespace scanlog {
|
|
|
|
// A CSV field, quoted when it contains a comma, quote or newline.
|
|
std::string csvField(const std::string& value);
|
|
|
|
// The header row (no trailing newline).
|
|
std::string header();
|
|
|
|
// One data row for an access point seen at `timestamp` (a preformatted local time string).
|
|
std::string row(const std::string& timestamp, const ScanEntry& ap);
|
|
|
|
} // namespace scanlog
|
|
|
|
// Decides when to write a scan to the Log: at most once per interval.
|
|
class ScanLogThrottle {
|
|
public:
|
|
explicit ScanLogThrottle(uint32_t intervalMs) : intervalMs_(intervalMs) {}
|
|
bool due(uint32_t nowMs) const { return !logged_ || nowMs - lastMs_ >= intervalMs_; }
|
|
void logged(uint32_t nowMs) {
|
|
lastMs_ = nowMs;
|
|
logged_ = true;
|
|
}
|
|
void reset() { logged_ = false; }
|
|
|
|
private:
|
|
uint32_t intervalMs_;
|
|
uint32_t lastMs_ = 0;
|
|
bool logged_ = false;
|
|
};
|
|
|
|
} // namespace roro
|