Public Access
Wi-Fi Tools: scan logging to CSV, plus sort and filter
- 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
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#include "scan_log.h"
|
||||
|
||||
namespace roro::scanlog {
|
||||
|
||||
std::string csvField(const std::string& value) {
|
||||
bool needsQuote = false;
|
||||
for (char c : value)
|
||||
if (c == ',' || c == '"' || c == '\n' || c == '\r') needsQuote = true;
|
||||
if (!needsQuote) return value;
|
||||
std::string out = "\"";
|
||||
for (char c : value) {
|
||||
if (c == '"') out += '"'; // escape by doubling
|
||||
out += c;
|
||||
}
|
||||
out += '"';
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string header() { return "time,bssid,channel,rssi,security,ssid"; }
|
||||
|
||||
std::string row(const std::string& timestamp, const ScanEntry& ap) {
|
||||
return csvField(timestamp) + "," + csvField(ap.bssid) + "," + std::to_string(ap.channel) + "," +
|
||||
std::to_string(ap.rssi) + "," + csvField(ap.security) + "," +
|
||||
csvField(ap.ssid.empty() ? "(hidden)" : ap.ssid);
|
||||
}
|
||||
|
||||
} // namespace roro::scanlog
|
||||
Reference in New Issue
Block a user