#pragma once #include #include #include "dialog_model.h" #include "key_event.h" #include "key_help.h" #include "line_editor.h" #include "list_model.h" #include "services/wifi_service.h" #include "settings.h" #include "ui/canvas.h" #include "ui/theme.h" namespace roro { // Settings → Debug Console (ADR 0010): the switch, where to connect, and the token, which is shown // here and nowhere else. Switching on makes a token if there's none; a new one, or one typed by // hand, ends the connection of whoever holds the old one. class DebugConsolePage { public: DebugConsolePage(Settings& settings, WifiService& wifi) : settings_(settings), wifi_(wifi) {} void enter(); bool onKey(const KeyEvent& e); // false: leave the page bool textEntryActive() const { return typing_; } void draw(Canvas& c); void help(std::vector& out) const; const char* helpTitle() const { return typing_ ? "A token of your own" : "Debug Console"; } private: enum Row { kSwitch, kAddress, kNewToken, kTypeToken, kRows }; enum class Ask { None, SwitchOn, NewToken }; Settings& settings_; WifiService& wifi_; ListModel list_{kRows}; std::unique_ptr confirm_; Ask ask_ = Ask::None; bool typing_ = false; LineEditor editor_{64}; std::string refusal_; }; } // namespace roro