|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
T9 input variant for secrets: displays asterisks instead of letters and offers a long-press reveal toggle. More...
#include <PasswordT9View.h>
Public Member Functions | |
| void | setMaskChar (char mask) |
| Sets the mask character. Default '*'. | |
| void | setRevealed (bool revealed) |
| Forces the reveal state. Defaults to false after each init(). | |
| bool | isRevealed () const |
| void | render (bool partial) override |
| Renders title, masked text box and footer. | |
| InputResult | onLongPress (char key) override |
| Long-press on Y toggles the reveal state. Other keys delegate to T9. | |
| const char * | getName () const override |
| const char * | getFooterHint () const override |
| Public Member Functions inherited from cdc::ui::T9InputView | |
| void | init (const char *title, const char *initialText=nullptr, uint16_t maxLen=MAX_TEXT_LEN) |
| Initializes T9 input state and optional initial text. | |
| void | setOnSave (SaveCallback callback) |
| void | setOnCancel (CancelCallback callback) |
| const char * | getText () const |
| uint16_t | getLength () const |
| void | setPlaceholder (const char *placeholder) |
| void | setHint (const char *hint) |
| void | forceDigit (char key) |
| Inserts a numeric digit literally, bypassing multi-tap mapping. | |
| uint16_t | appendRaw (const char *text) |
| void | render (bool partial) override |
| Renders title, text entry box, cursor state, and footer. | |
| InputResult | onKey (char key) override |
| Handles key input for save, backspace, and digit entry. | |
| InputResult | onLongPress (char key) override |
| Handles long-press actions for clear and forced digit insertion. | |
| void | onTick (uint32_t nowMs) override |
| Handles timeout-based commit for active multi-tap input. | |
| const char * | getName () const override |
| const char * | getFooterHint () const override |
| Returns localized footer hint text. | |
| Public Member Functions inherited from cdc::ui::ViewBase | |
| virtual | ~ViewBase ()=default |
| void | onEnter (void *context) override |
| void | onExit () override |
| void | onResume () override |
| void | onPause () override |
| void | setLifecycleHooks (void(*onHide)(void *), void(*onShow)(void *), void *userData) override |
| bool | needsRender () const override |
| void | markDirty () override |
| void | clearDirty () override |
| void | setFooterHint (const char *hint) override |
| const char * | getFooterHint () const override |
| Public Member Functions inherited from cdc::ui::IView | |
| virtual | ~IView ()=default |
| virtual bool | prefersLightRefresh () const |
Additional Inherited Members | |
| Public Types inherited from cdc::ui::T9InputView | |
| using | SaveCallback = void(*)(const char* text) |
| using | CancelCallback = void(*)() |
| Static Public Attributes inherited from cdc::ui::T9InputView | |
| static constexpr uint16_t | MAX_TEXT_LEN = 320 |
| static constexpr uint32_t | TIMEOUT_MS = 2000 |
| Protected Member Functions inherited from cdc::ui::T9InputView | |
| bool | processKey (char key) |
| Processes a numeric key press using multi-tap logic. | |
| void | backspace () |
| Removes the last character from the input buffer. | |
| void | commitCharacter () |
| Commits the currently active multi-tap character. | |
| Protected Member Functions inherited from cdc::ui::ViewBase | |
| void | setTitle (const char *title) |
| const char * | getTitle () const |
| Static Protected Member Functions inherited from cdc::ui::T9InputView | |
| static char | getChar (char key, uint8_t index) |
| Returns the character for a key/index in the T9 mapping. | |
| static uint8_t | getCharCount (char key) |
| Returns the number of mapped characters for a key. | |
| Protected Attributes inherited from cdc::ui::T9InputView | |
| char | titleBuf_ [TITLE_MAX_LEN+1] = {0} |
| const char * | title_ = nullptr |
| const char * | placeholder_ = nullptr |
| const char * | hintOverride_ = nullptr |
| char | text_ [MAX_TEXT_LEN+1] = {0} |
| uint16_t | len_ = 0 |
| uint16_t | maxLen_ = MAX_TEXT_LEN |
| SaveCallback | onSave_ = nullptr |
| CancelCallback | onCancel_ = nullptr |
| char | lastKey_ = 0 |
| uint8_t | charIndex_ = 0 |
| uint32_t | lastPressMs_ = 0 |
| bool | cursorActive_ = false |
| Protected Attributes inherited from cdc::ui::ViewBase | |
| bool | dirty_ = true |
| const char * | title_ = nullptr |
| const char * | customFooter_ = nullptr |
| void(* | onHide_ )(void *) = nullptr |
| void(* | onShow_ )(void *) = nullptr |
| void * | lifecycleUserData_ = nullptr |
| Static Protected Attributes inherited from cdc::ui::T9InputView | |
| static constexpr uint16_t | TITLE_MAX_LEN = 48 |
T9 input variant for secrets: displays asterisks instead of letters and offers a long-press reveal toggle.
Behaviour vs. plain T9InputView:
Useful for TOTP secrets, PINs, API tokens, passwords - any secret entered via T9 that must not appear on screen by default.
Definition at line 22 of file PasswordT9View.h.
|
overridevirtual |
Get footer hint text (e.g., "[Y] OK [N] Back") Return nullptr for no footer
Reimplemented from cdc::ui::IView.
Definition at line 90 of file PasswordT9View.cpp.
References cdc::ui::tr().
Referenced by render().
|
inlineoverridevirtual |
Get view name for debugging
Implements cdc::ui::IView.
Definition at line 39 of file PasswordT9View.h.
|
inline |
Definition at line 34 of file PasswordT9View.h.
|
overridevirtual |
Long-press on Y toggles the reveal state. Other keys delegate to T9.
Reimplemented from cdc::ui::IView.
Definition at line 81 of file PasswordT9View.cpp.
References cdc::ui::CONSUMED, cdc::ui::KEY_YES, cdc::ui::ViewBase::markDirty(), and cdc::ui::T9InputView::onLongPress().
|
overridevirtual |
Renders title, masked text box and footer.
Layout mirrors T9InputView; the only differences are the character substitution and the per-row reveal/cursor handling.
Implements cdc::ui::IView.
Definition at line 22 of file PasswordT9View.cpp.
References cdc::ui::T9InputView::cursorActive_, cdc::ui::ViewBase::dirty_, cdc::ui::display, cdc::ui::render::drawFooterBar(), cdc::ui::render::drawHeaderLeft(), cdc::hal::getDisplayInstance(), getFooterHint(), cdc::ui::T9InputView::len_, cdc::ui::T9InputView::maxLen_, cdc::ui::T9InputView::placeholder_, cdc::ui::render::printText(), cdc::ui::T9InputView::text_, cdc::ui::TEXT_MARGIN, cdc::ui::TEXT_Y, cdc::ui::T9InputView::title_, and cdc::ui::TITLE_Y.
|
inline |
Sets the mask character. Default '*'.
Definition at line 27 of file PasswordT9View.h.
|
inline |
Forces the reveal state. Defaults to false after each init().
Definition at line 32 of file PasswordT9View.h.
References cdc::ui::ViewBase::markDirty().