M1 step 6: Wi-Fi Tools from ordinary scans

- lib/wifi (host-tested): channel occupancy (neighbour spill, signal
  weighting, quietest of 1/6/11) and a signal tracker (history, lost
  detection, click interval)
- WifiService: scan results carry BSSID, channel and security; a scan
  can target one channel for quick tracker refreshes; endListScans()
  turns the radio back off when Wi-Fi is disabled
- Wi-Fi Tools App: networks nearby, channel occupancy bars, signal
  tracker with clicks (m to mute)
- M1 plan: Monitoring-mode views and captures deferred

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
2026-10-02 16:33:11 +02:00
co-authored by Claude Opus 5.5
parent 076baa77d1
commit 4cd6a63498
11 changed files with 512 additions and 16 deletions
+49
View File
@@ -0,0 +1,49 @@
#pragma once
#include <string>
#include <vector>
#include "app.h"
#include "list_model.h"
#include "services/wifi_service.h"
#include "signal_tracker.h"
#include "ui/theme.h"
namespace roro {
// Wi-Fi diagnostics from ordinary scans: nearby access points, how crowded each channel is, and
// a signal tracker for finding one access point. None of it interrupts the connection or IRC.
class WifiToolsApp : public App {
public:
explicit WifiToolsApp(WifiService& wifi) : wifi_(wifi) {}
void onEnter() override;
void onExit() override;
bool onKey(const KeyEvent& e) override;
void update(uint32_t nowMs) override;
void draw(Canvas& c) override;
private:
enum class View { Menu, Networks, Channels, Tracker };
void open(View v);
void drawNetworks(Canvas& c);
void drawChannels(Canvas& c);
void drawTracker(Canvas& c);
std::vector<ScanEntry> sortedScan() const;
WifiService& wifi_;
View view_ = View::Menu;
ListModel menu_{theme::kContent.h / theme::kLineHeight};
ListModel networks_{theme::kContent.h / theme::kLineHeight};
uint32_t seenSeq_ = 0;
uint32_t nextScanMs_ = 0;
// Tracker
std::string targetBssid_, targetName_;
int targetChannel_ = 0;
SignalTracker tracker_{110};
bool clicks_ = true;
uint32_t nextClickMs_ = 0;
};
} // namespace roro