|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include <TimeInputView.h>
Public Types | |
| using | ConfirmCallback = void(*)(uint8_t hour, uint8_t minute) |
| using | CancelCallback = void(*)() |
Public Member Functions | |
| void | init (const char *title, uint8_t hour, uint8_t minute) |
| Initializes time input state. | |
| void | setOnConfirm (ConfirmCallback callback) |
| void | setOnCancel (CancelCallback callback) |
| uint8_t | getHour () const |
| uint8_t | getMinute () const |
| void | render (bool partial) override |
| Renders the time input view. | |
| InputResult | onKey (char key) override |
| Handles key input for the time editor. | |
| 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 |
| virtual InputResult | onLongPress (char key) |
| virtual void | onTick (uint32_t nowMs) |
Additional Inherited Members | |
| Protected Member Functions inherited from cdc::ui::ViewBase | |
| void | setTitle (const char *title) |
| const char * | getTitle () const |
| 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 |
TimeInputView - Time input with hour/minute fields
Navigation: 0-9 = Enter digits 4 = Previous field 6 = Next field N = Clear current field / Cancel (if empty) Y = Confirm
Definition at line 18 of file TimeInputView.h.
| using cdc::ui::TimeInputView::CancelCallback = void(*)() |
Cancel callback (called when the user dismisses the view with N). The view pops itself before this fires, so do not call pop() in the handler.
Definition at line 31 of file TimeInputView.h.
| using cdc::ui::TimeInputView::ConfirmCallback = void(*)(uint8_t hour, uint8_t minute) |
Confirm callback
| hour | Hour (0-23) |
| minute | Minute (0-59) |
Definition at line 25 of file TimeInputView.h.
|
overridevirtual |
Returns localized footer hint text.
Reimplemented from cdc::ui::IView.
Definition at line 168 of file TimeInputView.cpp.
References cdc::ui::tr().
Referenced by render().
|
inline |
Get current values
Definition at line 54 of file TimeInputView.h.
|
inline |
Definition at line 55 of file TimeInputView.h.
|
inlineoverridevirtual |
Get view name for debugging
Implements cdc::ui::IView.
Definition at line 60 of file TimeInputView.h.
| void cdc::ui::TimeInputView::init | ( | const char * | title, |
| uint8_t | hour, | ||
| uint8_t | minute ) |
Initializes time input state.
Initialize time input view
| title | View title |
| hour | Initial hour (0-23) |
| minute | Initial minute (0-59) |
| title | View title text. |
| hour | Initial hour value. |
| minute | Initial minute value. |
Definition at line 36 of file TimeInputView.cpp.
References cdc::ui::ViewBase::dirty_.
|
overridevirtual |
Handles key input for the time editor.
| key | Pressed key code. |
Implements cdc::ui::IView.
Definition at line 128 of file TimeInputView.cpp.
References cdc::ui::CONSUMED, cdc::ui::IGNORED, cdc::ui::ViewStack::instance(), cdc::ui::KEY_NO, cdc::ui::KEY_YES, LOG_I, cdc::ui::ViewStack::pop(), and cdc::ui::TAG.
|
overridevirtual |
Renders the time input view.
| partial | Indicates partial/full redraw mode. |
Implements cdc::ui::IView.
Definition at line 177 of file TimeInputView.cpp.
References cdc::ui::ViewBase::dirty_, cdc::ui::display, cdc::ui::render::drawFooterBar(), cdc::ui::render::drawHeaderCentered(), cdc::hal::getDisplayInstance(), getFooterHint(), TIME_Y, cdc::ui::TITLE_Y, and UNDERLINE_Y.
|
inline |
Set cancel callback (called when the view is dismissed without confirming)
Definition at line 49 of file TimeInputView.h.
|
inline |
Set confirm callback
Definition at line 44 of file TimeInputView.h.