Public Access
Fn+h on any screen, text fields included, and ? outside Text Entry, open a panel over the content area: the screen's own keys, then the ones that work everywhere. Every App declares its keys for the state it is in (pages, viewers, dialogs and text fields answer for themselves); the App manager opens the panel and takes every key while it is open. About 30 hint lines are gone, from every App. What stays on a screen is state. The first-start Setup keeps its hints and teaches the key; a device set up before gets one Toast, once. The guide and the FAQ open with it. `key help` over the consoles. 476 host tests (8 new). Checked on the device with key help and screenshots: the Launcher, all nine Apps and several of their states. 8.5 KB of flash and 40 bytes of static RAM. Decisions Q196 to Q203 in docs/milestones/U1.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
70 lines
2.0 KiB
C++
70 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "app.h"
|
|
#include "list_model.h"
|
|
#include "network_list_view.h"
|
|
#include "scan_log.h"
|
|
#include "services/clock_service.h"
|
|
#include "services/storage_service.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 (sortable, filterable, optionally
|
|
// logged to CSV), how crowded each channel is, and a signal tracker. None of it interrupts the
|
|
// connection or IRC, and none of it captures anyone's traffic.
|
|
class WifiToolsApp : public App {
|
|
public:
|
|
WifiToolsApp(WifiService& wifi, StorageService& storage, ClockService& clock)
|
|
: wifi_(wifi), storage_(storage), clock_(clock) {}
|
|
void onEnter() override;
|
|
void onExit() override;
|
|
bool onKey(const KeyEvent& e) override;
|
|
void update(uint32_t nowMs) override;
|
|
void draw(Canvas& c) override;
|
|
void help(std::vector<KeyHelp>& out) const override;
|
|
const char* helpTitle() const override;
|
|
|
|
private:
|
|
enum class View { Menu, Networks, Channels, Tracker };
|
|
|
|
void open(View v);
|
|
void refreshOrder();
|
|
void logScan(uint32_t nowMs);
|
|
void drawNetworks(Canvas& c);
|
|
void drawChannels(Canvas& c);
|
|
void drawTracker(Canvas& c);
|
|
|
|
WifiService& wifi_;
|
|
StorageService& storage_;
|
|
ClockService& clock_;
|
|
View view_ = View::Menu;
|
|
ListModel menu_{theme::kContent.h / theme::kLineHeight};
|
|
ListModel networks_{(theme::kContent.h - 14) / theme::kLineHeight};
|
|
std::vector<int> order_; // indices into the scan, after sort and filter
|
|
WifiSort sort_ = WifiSort::Signal;
|
|
NetworkFilter filter_;
|
|
uint32_t seenSeq_ = 0;
|
|
uint32_t nextScanMs_ = 0;
|
|
|
|
// Scan logging
|
|
bool logging_ = false;
|
|
ScanLogThrottle logThrottle_{30000};
|
|
std::string headerDate_;
|
|
uint32_t loggedRows_ = 0;
|
|
|
|
// Tracker
|
|
std::string targetBssid_, targetName_;
|
|
int targetChannel_ = 0;
|
|
SignalTracker tracker_{110};
|
|
bool clicks_ = true;
|
|
uint32_t nextClickMs_ = 0;
|
|
};
|
|
|
|
} // namespace roro
|