Kleidos API Search

In development. It changes without notice.

Topic

Settings Screen & Service

The settings screen, its overlays and wizards, and the service that reads and applies an option.

The service is the half of the option model (Settings Model) that touches the device: it applies a value, steps it, runs an action and words a value for the screen. The portal reaches the same service through an adapter here.

See also
Application States, Settings Model, Settings View Model, Wi-Fi Admin Portal

Files

file src/states/settings/bond_manager_controller.h
BLE bond-manager collaborator for SettingsController.
file src/states/settings/change_pin_controller.h
Change-PIN wizard collaborator for SettingsController.
file src/states/settings/change_pin_logic.h
Headless finite-state machine for the change-PIN wizard.
file src/states/settings/char_wheel_editor_controller.h
CharWheel text-editor collaborator for SettingsController.
file src/states/settings/gps_sync_controller.h
"Sync time from GPS" progress overlay (HAS_GPS boards).
file src/states/settings/info_overlay_logic.h
What the settings tree's info overlay does with a tick's keys, and the captions its bar shows. Pure, host-testable.
file src/states/settings/ntp_manager_controller.h
NTP-server manager collaborator for SettingsController.
file src/states/settings/ntp_sync_controller.h
"Sync via Wi-Fi" progress overlay for the keyboard boards.
file src/states/settings/ntp_sync_feedback.h
file src/states/settings/picker_keys.h
The keys and captions of a single-select picker on button boards.
file src/states/settings/pin_method_controller.h
The "PIN dial style" row's flow: pick a style, practice it, save it.
file src/states/settings/portal_app_host.h
The admin portal's view of the running application, over the live context.
file src/states/settings/reencrypt_controller.h
"Re-encrypt vault" wizard collaborator for SettingsController.
file src/states/settings/reencrypt_flow.h
Headless step machine for the on-device "Re-encrypt vault" flow.
file src/states/settings/set_clock_controller.h
The "Set clock" overlay and its commit core.
file src/states/settings/settings_actions.h
Shared destructive / power settings actions (both renderers).
file src/states/settings/settings_apply.cpp
Implementation of the value-addressed settings read/apply seam.
file src/states/settings/settings_apply.h
Value-addressed read/apply for every settings option (all surfaces).
file src/states/settings/settings_controller.h
Settings-subsystem collaborator for HomeStateHandler.
file src/states/settings/settings_controller_select_action.cpp
The settings tree's select dispatcher: what activating each option does (part of SettingsController).
file src/states/settings/settings_nav_logic.h
Headless two-level cursor over the capability-driven settings model.
file src/states/settings/settings_overlays_controller.h
Settings leaf-overlay collaborator for SettingsController.
file src/states/settings/settings_overlays_controller_dropdown.cpp
The single-select dropdown picker of SettingsOverlaysController: language, HID layout and relock policy.
file src/states/settings/settings_overlays_controller_info.cpp
The read-only info screens of SettingsOverlaysController: battery, device, About and the rest, paged where they run long.
file src/states/settings/settings_overlays_controller_internal.h
The helpers the overlay families of SettingsOverlaysController share across its sources.
file src/states/settings/settings_overlays_controller_stepper.cpp
The numeric stepper editor of SettingsOverlaysController: brightness, auto-off, auto-lock, deep sleep, the PIN-arc sweep and shake sensitivity.
file src/states/settings/settings_overlays_controller_timezone.cpp
The timezone picker of SettingsOverlaysController: a single-select list over the zone table, with each zone's offset where the panel is wide enough.
file src/states/settings/settings_stepper.h
Shared numeric-stepper spec + commit for settings (both renderers).
file src/states/settings/settings_value_format.h
Shared live-value formatter for settings option rows (both renderers).
file src/states/settings/text_editor_host.h
Shared host seam for the text editors extracted from SettingsController, plus the editor content-area geometry.
file src/states/settings/touch_text_editor_controller.h
On-screen keyboard text editor for the boards that draw their own touch controls.
file src/states/settings/wifi_manager_controller.h
Saved-WiFi-network manager collaborator for SettingsController.

Classes

class kleidos::BondManagerHost
Callbacks the bond manager invokes on the parent handler. More about kleidos::BondManagerHost
class kleidos::BondManagerController
Owns the BLE bond manager: state, drawing, input, delete-confirm, debug. More about kleidos::BondManagerController
class kleidos::ChangePinHost
Callbacks the change-PIN wizard invokes on the parent handler. More about kleidos::ChangePinHost
class kleidos::ChangePinController
Owns the change-PIN wizard: state, drawing, auth loop, re-encrypt. More about kleidos::ChangePinController
class kleidos::ChangePinLogic
Headless change-PIN router; owns the candidate/confirm PIN buffers. More about kleidos::ChangePinLogic
class kleidos::CharWheelEditorController
Owns the CharWheel text editor: state, drawing, input, animation, debug. More about kleidos::CharWheelEditorController
class kleidos::GpsSyncController
Owns the GPS-sync overlay: engine lifecycle, drawing, and input. More about kleidos::GpsSyncController
struct kleidos::states::info_overlay::InfoKeys
One tick's keys, read in the board's shape. More about kleidos::states::info_overlay::InfoKeys
struct kleidos::states::info_overlay::InfoStep
What one tick's keys do to the overlay. More about kleidos::states::info_overlay::InfoStep
class kleidos::NtpManagerController
Owns the NTP-server manager: state, drawing, input, sync progress. More about kleidos::NtpManagerController
class kleidos::NtpSyncController
Owns the keyboard-board NTP sync overlay: engine start, drawing and input. More about kleidos::NtpSyncController
class kleidos::PinMethodController
The PIN dial style picker, its practice and the saved screen. More about kleidos::PinMethodController
class kleidos::PortalAppHost
AdminAppHost over a live AppContext. More about kleidos::PortalAppHost
class kleidos::ReencryptController
Owns the re-encryption wizard: secret entry, progress screen, retirement. More about kleidos::ReencryptController
class kleidos::ReencryptFlow
Headless router for the re-encryption flow. Owns no secret and no key. More about kleidos::ReencryptFlow
struct kleidos::SetClockBuildDate
A compile-date triple parsed from the preprocessor __DATE__ literal. More about kleidos::SetClockBuildDate
class kleidos::SetClockController
Owns the field-by-field Set-clock overlay: state, drawing, and input. More about kleidos::SetClockController
class kleidos::SettingsHost
Callbacks the settings subsystem invokes on the parent handler. More about kleidos::SettingsHost
class kleidos::SettingsController
Owns the settings tree, its overlays, and the settings-launched sub-controllers (change-PIN, bond manager, text editors). More about kleidos::SettingsController
class kleidos::SettingsNavLogic
Headless settings-tree cursor over the capability-driven model. More about kleidos::SettingsNavLogic
class kleidos::SettingsOverlaysHost
Callbacks the settings leaf overlays invoke on SettingsController. More about kleidos::SettingsOverlaysHost
class kleidos::SettingsOverlaysController
Owns the settings leaf overlays: stepper editor, dropdown picker, and info screens (state + drawing + per-tick input). More about kleidos::SettingsOverlaysController
struct kleidos::states::settings_overlays::StepperBands
The numeric stepper overlay's bands, derived once for the draw and the pointer: the header, the control centered in the body, and the footer that carries the Save hint. More about kleidos::states::settings_overlays::StepperBands
struct kleidos::states::settings::RowContent
A row's trailing accessory + (for value rows) its current value text. The value string points either at a pooled i18n literal (stable) or at the caller-supplied scratch buffer (copy it before the buffer is reused). More about kleidos::states::settings::RowContent
class kleidos::TextEditorHost
Callbacks the text editors invoke on the parent handler. More about kleidos::TextEditorHost
class kleidos::TouchTextEditorController
Owns the on-screen keyboard text editor: value, keyboard state, drawing and input. More about kleidos::TouchTextEditorController
class kleidos::WifiManagerController
Owns the saved-WiFi-network manager: state, drawing, input, forget-confirm. More about kleidos::WifiManagerController

Enumerations

enum class kleidos::ChangePinStep : uint8_t { kleidos::ChangePinStep::VerifyCurrent, kleidos::ChangePinStep::EnterNew, kleidos::ChangePinStep::ConfirmNew, kleidos::ChangePinStep::ReEncrypt, kleidos::ChangePinStep::DONE, kleidos::ChangePinStep::EXIT }
Steps of the change-PIN wizard. More about kleidos::ChangePinStep
enum class kleidos::ChangePinResult : uint8_t { kleidos::ChangePinResult::CONTINUE, kleidos::ChangePinResult::WrongCurrent, kleidos::ChangePinResult::MISMATCH, kleidos::ChangePinResult::FAILED, kleidos::ChangePinResult::FINISHED }
Outcome codes returned by each transition step of the change-PIN wizard. More about kleidos::ChangePinResult
enum class kleidos::GpsSyncUiResult : uint8_t { kleidos::GpsSyncUiResult::Stay , kleidos::GpsSyncUiResult::Done , kleidos::GpsSyncUiResult::Cancelled }
Outcome of one GpsSyncController::update tick. More about kleidos::GpsSyncUiResult
enum class kleidos::states::info_overlay::InfoShape : uint8_t { kleidos::states::info_overlay::InfoShape::TwoButton , kleidos::states::info_overlay::InfoShape::Dial , kleidos::states::info_overlay::InfoShape::Zones }
The board shape the overlay reads its keys on. More about kleidos::states::info_overlay::InfoShape
enum class kleidos::NtpSyncUiResult : uint8_t { kleidos::NtpSyncUiResult::Stay , kleidos::NtpSyncUiResult::Done }
Outcome of one NtpSyncController::update tick. More about kleidos::NtpSyncUiResult
enum class kleidos::states::picker::PickKeys : uint8_t { PickKeys::None , PickKeys::Moved , PickKeys::Commit , PickKeys::Cancel }
What the keys did to a picker this frame. More about kleidos::states::picker::PickKeys
enum class kleidos::ReencryptStep : uint8_t { kleidos::ReencryptStep::Verify, kleidos::ReencryptStep::Working, kleidos::ReencryptStep::ConfirmLoss, kleidos::ReencryptStep::Finish, kleidos::ReencryptStep::Done, kleidos::ReencryptStep::Exit }
Screens of the on-device re-encryption flow. More about kleidos::ReencryptStep
enum class kleidos::ReencryptOutcome : uint8_t { kleidos::ReencryptOutcome::Continue, kleidos::ReencryptOutcome::Started, kleidos::ReencryptOutcome::Refused, kleidos::ReencryptOutcome::Stalled, kleidos::ReencryptOutcome::Paused, kleidos::ReencryptOutcome::NeedsConsent, kleidos::ReencryptOutcome::Finished, kleidos::ReencryptOutcome::FinishFailed }
What the screen has to report after the transition it just made. More about kleidos::ReencryptOutcome
enum class kleidos::SetClockResult : uint8_t { kleidos::SetClockResult::Stay , kleidos::SetClockResult::Committed , kleidos::SetClockResult::Cancelled }
Outcome of one SetClockController::update tick. More about kleidos::SetClockResult
enum class kleidos::SetClockKbPhase : uint8_t { kleidos::SetClockKbPhase::DateTime , kleidos::SetClockKbPhase::Zone }
Two-step phase of the keyboard-board Set-clock flow. More about kleidos::SetClockKbPhase
enum class kleidos::states::settings::ToggleOutcome : uint8_t { kleidos::states::settings::ToggleOutcome::Stored , kleidos::states::settings::ToggleOutcome::NotStored , kleidos::states::settings::ToggleOutcome::NotAToggle }
What flipping an in-place toggle established. More about kleidos::states::settings::ToggleOutcome
enum class kleidos::SettingsLevel : uint8_t { kleidos::SettingsLevel::ROOT , kleidos::SettingsLevel::GROUP }
Current navigation depth in the two-level settings tree. More about kleidos::SettingsLevel
enum class kleidos::SettingsSelectResult : uint8_t { kleidos::SettingsSelectResult::EnteredGroup, kleidos::SettingsSelectResult::Dispatch, kleidos::SettingsSelectResult::BackToRoot, kleidos::SettingsSelectResult::Leave, kleidos::SettingsSelectResult::OpenedSingle }
Outcome of activating the row under the cursor (SettingsNavLogic::select). More about kleidos::SettingsSelectResult

Functions

constexpr i18n::StringIdkleidos::changeStepTitle (ChangePinStep step, security::pin_policy::SetSurface surface, security::pin_policy::SecretKind current, security::pin_policy::SecretKind next)
The title of the change wizard's step on surface.
InfoKeyskleidos::states::info_overlay::dialInfoKeys (dial::DialKeys key, bool back)
The dial's keys as the overlay reads them.
InfoStepkleidos::states::info_overlay::infoStep (InfoShape shape, const kleidos::ui::settings::InfoPage &page, uint8_t current, bool offerReveal, const InfoKeys &keys)
What keys do to a panel showing page.
boolkleidos::states::info_overlay::offersKeyReveal (kleidos::ui::settings::InfoKind kind, const kleidos::ui::settings::PrivacyKeyReveal &reveal)
Whether the panel's bar offers the reveal.
boolkleidos::states::info_overlay::expireKeyReveal (kleidos::ui::settings::InfoKind kind, kleidos::ui::settings::PrivacyKeyReveal &reveal, uint32_t nowMs)
Mask the Privacy key panel's key once its time is up; call on every tick.
kleidos::ui::ActionBarPropskleidos::states::info_overlay::infoBarProps (bool twoButtons, const kleidos::ui::settings::InfoPage &page, bool offerReveal, uint8_t holdPctB=0)
The captions under an info panel.
voidkleidos::states::ntpsync::toastSyncRefused (net::ntp::FailReason reason)
Toast why the engine refused to start a sync.
voidkleidos::states::ntpsync::toastSyncOutcome (const net::ntp::Status &status)
Toast how a sync ended.
voidkleidos::states::ntpsync::drawSyncBody (ui::Canvas &canvas, const ui::LayoutContext &layout, const net::ntp::Status &status, bool cancelButtonBelow)
Paint the syncing screen's body: the caption, the progress bar and the server being asked.
PickKeyskleidos::states::picker::pollPickerKeys (AppContext &ctx, uint8_t count, uint8_t &focus)
Read one frame of a picker's keys and move the focus (wrapping).
ui::ActionBarPropskleidos::states::picker::pickerBarProps (const ui::LayoutContext &layout, uint8_t holdPctA=0, uint8_t holdPctB=0)
The captions under a picker for this board's keys.
uint8_tkleidos::setClockStoredZoneIdx ()
Read the persisted timezone index, clamped into table range.
constexpr SetClockBuildDatekleidos::setClockParseBuildDate (const char *s)
Parse a __DATE__-format literal ("Mmm dd yyyy") into a date triple.
constexpr uint32_tkleidos::setClockToUtcEpoch (const ui::DateTimeFieldModel &model, bool dstEnabled)
Map an edited local date/time model to a UTC Unix epoch.
constexpr uint32_tkleidos::setClockToUtcEpoch (const ui::DateTimeFieldModel &model)
Map an edited local date/time model to a UTC Unix epoch (DST honored).
constexpr boolkleidos::setClockEpochValid (uint32_t epoch)
Defensive lower-bound guard on a to-be-committed UTC epoch.
boolkleidos::setClockCommit (const ui::DateTimeFieldModel &model)
Commit an edited local date/time to the RTC (UTC) and persist its zone.
voidkleidos::states::settings::confirmWipeVault (AppContext &ctx)
Empty the vault, keeping its secret: the vault-only wipe.
voidkleidos::states::settings::confirmNewPrivacyKey (AppContext &ctx)
Replace the Bluetooth privacy key (IRK), forgetting every host.
voidkleidos::states::settings::finishVaultWipe (AppContext &ctx)
The destructive half of confirmWipeVault, on its own.
voidkleidos::states::settings::confirmResetSettings (AppContext &ctx)
Restore every device preference to its default, keeping the vault.
voidkleidos::states::settings::confirmFactoryReset (AppContext &ctx)
Erase everything: the factory reset.
constexpr boolkleidos::states::settings::toggleMovedLiveState (ToggleOutcome outcome)
Whether the toggle moved the device's live state.
ToggleOutcomekleidos::states::settings::toggleOption (AppContext &ctx, OptionId id)
Flip or step an option in place, and persist it.
ToggleOutcomekleidos::states::settings::setToggleOption (AppContext &ctx, OptionId id, bool on)
Set an in-place toggle option to an absolute state.
boolkleidos::states::settings::toastTotpCodesHeadsUp (OptionId id)
What an on-device toggle tells the owner once 2FA codes are on, on a board without an RTC chip.
voidkleidos::states::settings::confirmSleepNow (AppContext &ctx)
Confirm, then enter deep sleep now.
uint8_tkleidos::states::settings::choiceCountOf (kleidos::settings::OptionId id)
Number of choices a picker offers, for index validation.
const char *kleidos::states::settings::optionTitle (kleidos::settings::OptionId id)
The option's own display title, translated.
const char *kleidos::states::settings::choiceLabel (kleidos::settings::OptionId id, uint8_t index)
Label for one choice of a picker-backed option.
int32_tkleidos::states::settings::readOptionValue (const AppContext &ctx, OptionId id)
Read an option's current value from live state.
DependencyReaderkleidos::states::settings::dependencyReaderFor (const AppContext &ctx)
The reader a settings list hides a dependent row with.
constexpr int32_tkleidos::states::settings::themeOptionValue (ui::ThemeMode mode)
The OptionId::ThemeInvert value that selects mode.
constexpr int32_tkleidos::states::settings::refreshOptionValue (bool full)
The OptionId::RefreshMode value (picker index) that selects a mode.
int32_tkleidos::states::settings::clampOptionValue (const AppContext &ctx, OptionId id, int32_t value)
Clamp a proposed value to the option's own spec, touching nothing.
boolkleidos::states::settings::applyOptionValue (AppContext &ctx, OptionId id, int32_t value)
Apply and persist an absolute value through the production commit path.
voidkleidos::states::settings::loadKeyboardLayout ()
Load the stored keyboard layout and show its letters on the on-screen keyboards.
ApplyOutcomekleidos::states::settings::requestOptionApply (OptionId id, int32_t value, uint32_t timeoutMs)
Ask the UI core to apply an option value, and wait for it.
voidkleidos::states::settings::drainOptionApplyQueue (AppContext &ctx)
Drain pending apply requests. Call from the loop task only.
constexpr boolkleidos::isSettingImplemented (kleidos::settings::OptionId id)
Whether the button renderer can launch or edit this option.
boolkleidos::states::settings_overlays::twoButton (const AppContext &ctx)
ui::HeaderPropskleidos::states::settings_overlays::overlayHeader (const ui::LayoutContext &layout, const char *title)
ui::Rectkleidos::states::settings_overlays::pickerBox (const ui::LayoutContext &layout, uint8_t count, const char *title)
ui::DropdownPropskleidos::states::settings_overlays::pickerShape (const ui::LayoutContext &layout, const char *title)
voidkleidos::states::settings_overlays::drawPickerBar (ui::Canvas &canvas, const ui::LayoutContext &layout, ui::DrawnActionBar &drawn)
uint8_tkleidos::states::settings_overlays::pickerVisibleRows (const ui::LayoutContext &layout, uint8_t count, const char *title)
StepperBandskleidos::states::settings_overlays::stepperBands (const ui::LayoutContext &layout)
StepperSpeckleidos::states::settings::stepperSpecFor (OptionId opt, const AppContext &ctx)
Resolve the stepper descriptor (range/step/unit + live value) for opt.
voidkleidos::states::settings::formatStepperValue (StepperSpec::Unit unit, int32_t value, char *out, std::size_t cap)
Format a stepper value in its unit into out.
boolkleidos::states::settings::commitStepperValue (AppContext &ctx, OptionId opt, int32_t value)
Apply and persist a committed stepper value for opt.
voidkleidos::states::settings::previewStepperValue (const AppContext &ctx, OptionId opt, int32_t value)
Show an uncommitted stepper value where its effect can be seen.
voidkleidos::states::settings::endStepperPreview (const AppContext &ctx, OptionId opt)
Undo previewStepperValue, putting back what the stored value shows.
voidkleidos::states::settings::pushKeyboardLight (const AppContext &ctx)
Push the keyboard light the owner set down to the board's keyboard.
const char *kleidos::states::settings::formatSecondsValue (uint32_t ms, kleidos::util::str::InplaceString< 15 > &buf)
The admin access-point identity policy (a Wi-Fi Admin Portal module, aliased for brevity).
RowContentkleidos::states::settings::optionContent (const SettingsOption &opt, const AppContext &ctx, kleidos::util::str::InplaceString< 15 > &buf)
Resolve the live trailing accessory + value for an option row.
const LabelTiers &kleidos::states::settings::optionLabel (const SettingsOption &opt, const AppContext &ctx)
The label an option row shows now: its own, or the one that names the secret ("Change password" on a keyboard board or over a passphrase, secret_words::namesPassword).
ui::Rectkleidos::textEditorContentArea (const ui::LayoutContext &layout)
Content rectangle (between the header and the action bar) both 2-button text editors fill.

Variables

constexpr uint32_tkleidos::states::ntpsync::kNtpToastMs
How long an NTP sync toast stays on screen, in milliseconds.

Back to the top

Enumeration Type Documentation

ChangePinResult #

enum class kleidos::ChangePinResult : uint8_t

Outcome codes returned by each transition step of the change-PIN wizard.

Enumerator
CONTINUE 

Step advanced (or the call was a no-op for the current state).

WrongCurrent 

Current PIN verify failed; caller applies bruteforce policy.

MISMATCH 

Confirm failed; stored newPin wiped, back to ENTER_NEW.

FAILED 

The rewrap failed; wizard aborted, caller re-prompts.

FINISHED 

DONE acknowledged — wizard closes.

ChangePinStep #

enum class kleidos::ChangePinStep : uint8_t

Steps of the change-PIN wizard.

Enumerator
VerifyCurrent 

Verify the current PIN.

EnterNew 

Enter the new PIN.

ConfirmNew 

Confirm the new PIN.

ReEncrypt 

Rewrap the vault key under the new secret.

DONE 

Wizard finished successfully.

EXIT 

Caller should close the wizard.

GpsSyncUiResult #

enum class kleidos::GpsSyncUiResult : uint8_t

Outcome of one GpsSyncController::update tick.

Enumerator
Stay 

Remain on the overlay (waiting / showing the timeout notice).

Done 

Fix received; the clock was set (engine already powered down).

Cancelled 

User backed out (engine already powered down).

InfoShape #

enum class kleidos::states::info_overlay::InfoShape : uint8_t

The board shape the overlay reads its keys on.

Enumerator
TwoButton 

Two face buttons: an A tap is "next", a B tap "previous", a B hold back.

Dial 

The dial: ▼ is "next", ▲ "previous", OK (tap or hold) back.

Zones 

The three Core zones: C is "next", A "previous", B back.

NtpSyncUiResult #

enum class kleidos::NtpSyncUiResult : uint8_t

Outcome of one NtpSyncController::update tick.

Enumerator
Stay 

The sync is still running.

Done 

The engine finished (set, failed or cancelled) and was toasted.

PickKeys #

enum class kleidos::states::picker::PickKeys : uint8_t

What the keys did to a picker this frame.

Enumerator
None 

Nothing to act on.

Moved 

The focus moved; the picker repaints.

Commit 

Apply the focused option.

Cancel 

Close without changing the setting.

ReencryptOutcome #

enum class kleidos::ReencryptOutcome : uint8_t

What the screen has to report after the transition it just made.

Enumerator
Continue 

Nothing to report; keep going.

Started 

The rotation opened.

Refused 

It could not open. Nothing changed.

Stalled 

A step refused. The rotation is live and resumable.

Paused 

Stopped by a back-out or a declined loss. Live and resumable.

NeedsConsent 

The end was reached, but some artifacts were skipped.

Finished 

The previous key is gone; the vault is fully rotated.

FinishFailed 

The retirement failed. The rotation is still live.

ReencryptStep #

enum class kleidos::ReencryptStep : uint8_t

Screens of the on-device re-encryption flow.

Enumerator
Verify 

Collecting the unlock secret (skipped on a resume).

Working 

Stepping the frontier; the progress screen owns the glass.

ConfirmLoss 

The end was reached with skipped artifacts; asking consent.

Finish 

The caller must retire the previous key now.

Done 

Finished; the report is on screen.

Exit 

The caller should close the flow.

SetClockKbPhase #

enum class kleidos::SetClockKbPhase : uint8_t

Two-step phase of the keyboard-board Set-clock flow.

The keyboard boards type the timestamp instead of nudging it one field at a time: DateTime collects the twelve YYYYMMDDHHMM digits, then Zone picks the timezone from a dropdown before committing.

Enumerator
DateTime 

Typing the YYYY-MM-DD HH:MM digits.

Zone 

Picking the timezone from the dropdown.

SetClockResult #

enum class kleidos::SetClockResult : uint8_t

Outcome of one SetClockController::update tick.

Enumerator
Stay 

Remain on the Set-clock screen (still editing).

Committed 

Advanced past the last field: the clock was written.

Cancelled 

B-long: leave the screen without changing the clock.

SettingsLevel #

enum class kleidos::SettingsLevel : uint8_t

Current navigation depth in the two-level settings tree.

Enumerator
ROOT 

Top-level group list.

GROUP 

Option list inside a group.

SettingsSelectResult #

enum class kleidos::SettingsSelectResult : uint8_t

Outcome of activating the row under the cursor (SettingsNavLogic::select).

The Back row shares the activation gesture with every other row, so a select can also move the cursor up the tree — or out of it. The caller acts on the returned transition instead of re-deriving it from level deltas.

Enumerator
EnteredGroup 

ROOT group row: drilled into the group; nothing to dispatch.

Dispatch 

GROUP option row: the caller dispatches currentOptionId().

BackToRoot 

GROUP Back row: moved one level up (same transition as back()).

Leave 

ROOT Back row: the caller leaves the settings tree.

OpenedSingle 

ROOT row of a group with a single option: the cursor sits on that option, the caller dispatches currentOptionId() and then calls back(), so a one-row list is never shown.

ToggleOutcome #

enum class kleidos::states::settings::ToggleOutcome : uint8_t

What flipping an in-place toggle established.

A toggle applies live before it persists, so "it did not work" is two different facts and a surface answers them differently. NotAToggle means the row was never a toggle and nothing on the device moved — there is nothing to report and nothing to redraw. NotStored means the device is already running the new state and only the next boot will disagree: the row MUST be redrawn (it moved) and the owner MUST be told (it will revert). Collapsing the two into one false is what let a Stick invert its whole theme, keep rendering the old row, and say nothing at all.

Enumerator
Stored 

Flipped live and written; it survives a reboot.

NotStored 

Flipped live; the write did not land. The row moved anyway.

NotAToggle 

The id has no in-place toggle. Nothing was touched.

Back to the top

Function Documentation

applyOptionValue() #

bool kleidos::states::settings::applyOptionValue(AppContext & ctx, OptionId id, int32_t value)
nodiscard

Apply and persist an absolute value through the production commit path.

Clamps, then routes: steppers to commitStepperValue (which also enforces the deep-sleep ceiling and re-derives the dim time), toggles to setToggleOption, pickers to their own setters. Must be called from the UI core — see requestOptionApply for the httpd-task path.

Parameters
NameDirectionMeaning
ctxin, outLive application context.
idinOption to write.
valueinDesired value in the option's unit.
Return values
ValueMeaning
trueid is a value-bearing option, was applied, and the write that makes it survive a reboot landed.
falseid carries no value, or the live value moved and the store did not take it — the surface reads back the new value from RAM and the device comes up with the old one.

changeStepTitle() #

i18n::StringId kleidos::changeStepTitle(ChangePinStep step, security::pin_policy::SetSurface surface, security::pin_policy::SecretKind current, security::pin_policy::SecretKind next)
constexpr

The title of the change wizard's step on surface.

The current secret is named by the vault's kind, the new one by the kind it is typed as (states::secret_words::secretWord): over a PIN vault a dial asks "Current PIN" and, for a passphrase typed as the new secret, "New password"; a keyboard names either a password.

Parameters
NameDirectionMeaning
stepinThe wizard's step.
surfaceinThe board's entry surface.
currentinThe kind of secret the vault records.
nextinThe kind the new secret is typed as.
Returns
The step's title.

choiceCountOf() #

uint8_t kleidos::states::settings::choiceCountOf(kleidos::settings::OptionId id)
nodiscard

Number of choices a picker offers, for index validation.

Parameters
NameDirectionMeaning
idinA picker-backed option.
Returns
The choice count, or 0 when id is not a picker.

choiceLabel() #

const char * kleidos::states::settings::choiceLabel(kleidos::settings::OptionId id, uint8_t index)
nodiscard

Label for one choice of a picker-backed option.

The choice list was written out four times — the button-nav dropdown, the keyboard panel, the admin portal and the serial console each had their own — so a language or layout could be named differently depending on where it was being changed. This is the one source.

Parameters
NameDirectionMeaning
idinA picker-backed option.
indexinChoice index, < choiceCountOf.
Returns
The label (i18n-resolved where the option has translated choices), or "?" when index is out of range.

clampOptionValue() #

int32_t kleidos::states::settings::clampOptionValue(const AppContext & ctx, OptionId id, int32_t value)
nodiscard

Clamp a proposed value to the option's own spec, touching nothing.

Steppers clamp to stepperSpecFor's inclusive range and snap to its step; booleans collapse to 0/1; picker indices clamp to the choice count. This is range validation only: the cross-row idle-timer repair happens in the commit path, because it can move a neighboring option.

Parameters
NameDirectionMeaning
ctxinLive application context (source of the live range).
idinOption being edited.
valueinProposed value.
Returns
The nearest value the option will accept.

commitStepperValue() #

bool kleidos::states::settings::commitStepperValue(AppContext & ctx, OptionId opt, int32_t value)
nodiscard

Apply and persist a committed stepper value for opt.

Writes the option's NVS key and live subsystem state. For the three idle timers it enforces the deep-sleep ceiling (neither screen-off nor auto-lock exceeds deep sleep) via clampIdleTimers, repairing and persisting all three, and re-derives the dim time. Brightness applies to the backlight; the keyboard light to the keyboard driver; shake sensitivity to the detector; PIN sweep to the auth UI.

Parameters
NameDirectionMeaning
ctxin, outApplication context (live state to update).
optinThe stepper option that was committed.
valueinThe committed value (in the option's unit).
Return values
ValueMeaning
trueThe live state moved and every NVS write landed.
falseopt is not stepper-backed (nothing was written), or a write did not land: the row redraws with the new value and the device boots with the old one, so a surface must not report it saved.

confirmFactoryReset() #

void kleidos::states::settings::confirmFactoryReset(AppContext & ctx)

Erase everything: the factory reset.

Asks twice for confirmation, as the most destructive action: runs kleidos::reset::performChangeOfOwnerWipe (the vault partition erased and proven blank, the owner links, the counter; the whole NVS partition, every preference, bond, access-point identity and the onboarding flag among it, at the top of the next boot), zeroizes the live session, then restarts into first-run setup. Returns without effect if either confirm is declined.

Parameters
NameDirectionMeaning
ctxin, outApplication context.

confirmNewPrivacyKey() #

void kleidos::states::settings::confirmNewPrivacyKey(AppContext & ctx)

Replace the Bluetooth privacy key (IRK), forgetting every host.

Bonded hosts recognize the device behind its rotating private addresses by this key, so a new one means no host recognizes it: every bond goes with it. One sustained-press confirm, then the bonds are erased with the radio off and the next Bluetooth start creates the new key. Returns without effect if the confirm is declined, dismissed or times out.

Parameters
NameDirectionMeaning
ctxin, outApplication context (buttons for the confirm).

confirmResetSettings() #

void kleidos::states::settings::confirmResetSettings(AppContext & ctx)

Restore every device preference to its default, keeping the vault.

A single hold-to-confirm, as it is less destructive than a wipe. Restores the preference NVS keys, zeroizes the live session and restarts so every subsystem re-reads its default; the next boot asks for the same vault's secret. Returns without effect if the confirm is declined.

Parameters
NameDirectionMeaning
ctxin, outApplication context.

confirmSleepNow() #

void kleidos::states::settings::confirmSleepNow(AppContext & ctx)

Confirm, then enter deep sleep now.

Single confirm; on confirmation calls ctx.goToSleep(). Returns without effect if declined.

Parameters
NameDirectionMeaning
ctxin, outApplication context.

confirmWipeVault() #

void kleidos::states::settings::confirmWipeVault(AppContext & ctx)

Empty the vault, keeping its secret: the vault-only wipe.

Asks twice for confirmation, then asks for the current secret on the vault's own entry (sized to its shape, gated before it counts, the lockout read) and runs kleidos::reset::emptyVaultKeepingSecret on it: every credential, 2FA code and saved network goes; the secret, the BLE bonds, the admin access-point identity and the preferences stay. The proof and the act are one call. A proven secret zeroizes the live session and restarts behind the outcome toast; a wrong one is counted and the entry stays; a tenth ends the session, and the unlock screen runs the factory reset. Returns without effect if a confirm or the entry is declined.

Parameters
NameDirectionMeaning
ctxin, outApplication context (buttons, audio, sleep).

dependencyReaderFor() #

DependencyReader kleidos::states::settings::dependencyReaderFor(const AppContext & ctx)
nodiscard

The reader a settings list hides a dependent row with.

Answers from readOptionValue, so a row whose parent toggle reads 0 (the keyboard light's level while the light is off, the shake sensitivity while shake-to-lock is off) is not listed, on every renderer alike.

Parameters
NameDirectionMeaning
ctxinLive application context; it must outlive the reader.
Returns
The reader, bound to ctx.

dialInfoKeys() #

InfoKeys kleidos::states::info_overlay::dialInfoKeys(dial::DialKeys key, bool back)

The dial's keys as the overlay reads them.

Parameters
NameDirectionMeaning
keyinThe dial key this tick (kleidos::states::dial::pollDialKeys).
backinA back gesture already read this tick.
Returns
▼ as "next", ▲ as "previous", an OK tap or hold as back.

drainOptionApplyQueue() #

void kleidos::states::settings::drainOptionApplyQueue(AppContext & ctx)

Drain pending apply requests. Call from the loop task only.

Applies every queued request in order and releases the waiting callers. A no-op when the queue is empty, so it costs one queue peek per tick.

Parameters
NameDirectionMeaning
ctxin, outLive application context.

drawPickerBar() #

void kleidos::states::settings_overlays::drawPickerBar(ui::Canvas & canvas, const ui::LayoutContext & layout, ui::DrawnActionBar & drawn)

Draws the picker's bar where the popover leaves it on screen, and records it in drawn so a gauge step repaints only what moved.

Parameters
NameMeaning
canvasThe canvas to draw on.
layoutThe active display layout.
drawnReceives what was drawn.

drawSyncBody() #

void kleidos::states::ntpsync::drawSyncBody(ui::Canvas & canvas, const ui::LayoutContext & layout, const net::ntp::Status & status, bool cancelButtonBelow)

Paint the syncing screen's body: the caption, the progress bar and the server being asked.

The caller paints the header above it and the cancel affordance below it. The server address is a public NTP server, never a secret.

Parameters
NameDirectionMeaning
canvasin, outCanvas of the open frame.
layoutinResponsive layout of the active display.
statusinEngine snapshot to show.
cancelButtonBelowinTrue when a Cancel button takes the action row; the server address then sits closer under the bar.

endStepperPreview() #

void kleidos::states::settings::endStepperPreview(const AppContext & ctx, OptionId opt)

Undo previewStepperValue, putting back what the stored value shows.

Called when an edit is cancelled, so the backlight — the panel's or the keyboard's — returns to the stored level.

Parameters
NameDirectionMeaning
ctxinApplication context (the stored level is read from it).
optinThe option that was being edited.

expireKeyReveal() #

bool kleidos::states::info_overlay::expireKeyReveal(kleidos::ui::settings::InfoKind kind, kleidos::ui::settings::PrivacyKeyReveal & reveal, uint32_t nowMs)

Mask the Privacy key panel's key once its time is up; call on every tick.

Parameters
NameDirectionMeaning
kindinThe panel showing.
revealin, outIts key's reveal.
nowMsinMonotonic milliseconds.
Returns
true exactly when this call masked the key: the panel draws again from its first row.

finishVaultWipe() #

void kleidos::states::settings::finishVaultWipe(AppContext & ctx)

The destructive half of confirmWipeVault, on its own.

One sustained-press confirm (never a tap), then the current secret and kleidos::reset::emptyVaultKeepingSecret, as confirmWipeVault runs it, and the restart. For a surface that has already asked its own question and must not ask the generic one again — the post-export offer in sd_backup_flow.h names the backup it just wrote, which is the whole reason anyone would say yes. Together the two prompts are the same double confirm every wipe asks for.

Returns without effect if the confirm is declined, dismissed or times out. Does not return at all when the wipe runs: it zeroizes the live session and restarts the device.

Parameters
NameDirectionMeaning
ctxin, outApplication context (buttons, audio, sleep).

formatSecondsValue() #

const char * kleidos::states::settings::formatSecondsValue(uint32_t ms, kleidos::util::str::InplaceString< 15 > & buf)

The admin access-point identity policy (a Wi-Fi Admin Portal module, aliased for brevity).

Format an idle timeout: under a minute as "Ns", whole minutes as "Nm", otherwise as "Nm Ss".

Parameters
NameDirectionMeaning
msinDuration in milliseconds.
bufoutCaller scratch storage the formatted text is written into.
Returns
Pointer to buf's C string.

formatStepperValue() #

void kleidos::states::settings::formatStepperValue(StepperSpec::Unit unit, int32_t value, char * out, std::size_t cap)

Format a stepper value in its unit into out.

Parameters
NameDirectionMeaning
unitinThe value's display unit.
valueinThe value (in the unit's native scale).
outoutDestination buffer.
capinCapacity of out in bytes.

infoBarProps() #

kleidos::ui::ActionBarProps kleidos::states::info_overlay::infoBarProps(bool twoButtons, const kleidos::ui::settings::InfoPage & page, bool offerReveal, uint8_t holdPctB = 0)

The captions under an info panel.

Two buttons: B goes back on a hold; on a paged panel A / B taps turn the pages. Three (the Core zones): B goes back, and the next page is on C. The dial: ▲▼ turn the pages of a paged panel and OK closes it. On a masked Privacy key the "next" control (A, C, ▼) is named for the reveal.

Parameters
NameDirectionMeaning
twoButtonsinThe board reads two face buttons and no third.
pageinThe page the last draw showed.
offerRevealinThe panel is the Privacy key's, with its key masked.
holdPctBinHow far the B hold has filled (0..100).
Returns
The bar's props.

infoStep() #

InfoStep kleidos::states::info_overlay::infoStep(InfoShape shape, const kleidos::ui::settings::InfoPage & page, uint8_t current, bool offerReveal, const InfoKeys & keys)

What keys do to a panel showing page.

Back wins over everything. On a masked Privacy key (offerReveal) "next" reveals the key and draws the panel from its first row, in place of a page turn. Otherwise, on a table longer than a page, "next" turns to the next page (past the last, the first on the buttons and the dial) and "previous" to the one before (before the first, the last on the dial only); a turn to the page already drawn does nothing. On a one-page panel the buttons and the dial ignore both, and the Core zones take either as back.

Parameters
NameDirectionMeaning
shapeinThe board shape the keys were read on.
pageinThe page the last draw showed.
currentinThe first row the panel draws from now.
offerRevealinThe panel is the Privacy key's, with its key masked.
keysinThis tick's keys.
Returns
The step to take.

isSettingImplemented() #

bool kleidos::isSettingImplemented(kleidos::settings::OptionId id)
constexpr

Whether the button renderer can launch or edit this option.

An option is listed only when its launch or edit path exists, so a settings row never does nothing. Adding a handler means adding its id here.

Parameters
NameDirectionMeaning
idinThe option to test.
Return values
ValueMeaning
trueThe option is listed and works on this build.
falseThe option is not offered by this renderer.

loadKeyboardLayout() #

void kleidos::states::settings::loadKeyboardLayout()

Load the stored keyboard layout and show its letters on the on-screen keyboards.

The boot half of the OptionId::KeyboardLayout picker: the BLE layer reads the stored byte into the layout the device types with, and the touch keyboards take that layout's letters, exactly as an applied change does. Called once, at boot.

offersKeyReveal() #

bool kleidos::states::info_overlay::offersKeyReveal(kleidos::ui::settings::InfoKind kind, const kleidos::ui::settings::PrivacyKeyReveal & reveal)

Whether the panel's bar offers the reveal.

Parameters
NameDirectionMeaning
kindinThe panel showing.
revealinIts key's reveal.
Returns
true on the Privacy key panel while its key is masked.

optionContent() #

RowContent kleidos::states::settings::optionContent(const SettingsOption & opt, const AppContext & ctx, kleidos::util::str::InplaceString< 15 > & buf)

Resolve the live trailing accessory + value for an option row.

Reads the option's live backing (a preference, a subsystem state, or a drill-in) and returns the accessory the renderer should draw. buf is caller storage for any formatted value; copy the returned value out before buf is reused for the next row (the formatters share one scratch buffer).

Parameters
NameDirectionMeaning
optinThe option whose value to resolve.
ctxinLive application context (subsystem state).
bufoutCaller scratch storage for a formatted value.
Returns
The row's trailing accessory and (for value rows) its value text.

optionLabel() #

const LabelTiers & kleidos::states::settings::optionLabel(const SettingsOption & opt, const AppContext & ctx)

The label an option row shows now: its own, or the one that names the secret ("Change password" on a keyboard board or over a passphrase, secret_words::namesPassword).

Parameters
NameDirectionMeaning
optinThe option.
ctxinLive application context (the vault's secret kind).
Returns
The label tiers to draw.

optionTitle() #

const char * kleidos::states::settings::optionTitle(kleidos::settings::OptionId id)
nodiscard

The option's own display title, translated.

Parameters
NameDirectionMeaning
idinAny option in the model.
Returns
The full-tier label, or "?" when id is not in the table.

overlayHeader() #

ui::HeaderProps kleidos::states::settings_overlays::overlayHeader(const ui::LayoutContext & layout, const char * title)

The header every full-screen overlay draws: its title beside the brand mark, and on the touch-control boards the back chip in the mark's place.

Parameters
NameMeaning
layoutThe active display layout.
titleThe overlay's title, or null for none.
Returns
The header props to draw.

pickerBarProps() #

ui::ActionBarProps kleidos::states::picker::pickerBarProps(const ui::LayoutContext & layout, uint8_t holdPctA = 0, uint8_t holdPctB = 0)
nodiscard

The captions under a picker for this board's keys.

Parameters
NameDirectionMeaning
layoutinResponsive context (its button count picks the binding).
holdPctAinFill of the A hold rule (two buttons).
holdPctBinFill of the B hold rule (two buttons).
Returns
The action-bar cells to draw under the popover.

pickerBox() #

ui::Rect kleidos::states::settings_overlays::pickerBox(const ui::LayoutContext & layout, uint8_t count, const char * title)

The popover rect both single-select pickers (language / layout, timezone) are drawn in, sized to the options it lists. One definition, read by the draws, by the scroll windowing and by the pointer.

Parameters
NameMeaning
layoutThe active display layout.
countHow many options the picker lists.
titleThe picker's title.
Returns
The popover rect.

pickerShape() #

ui::DropdownProps kleidos::states::settings_overlays::pickerShape(const ui::LayoutContext & layout, const char * title)

The shape of a picker's popover as far as geometry goes: its title and whether it carries the back chip. The draw adds the options to it.

Parameters
NameMeaning
layoutThe active display layout.
titleThe picker's title.
Returns
The props with the title and the back chip set, and no options.

pickerVisibleRows() #

uint8_t kleidos::states::settings_overlays::pickerVisibleRows(const ui::LayoutContext & layout, uint8_t count, const char * title)

Rows a picker's body fits, from the body the popover draws (dropdownBodyRect, which knows the title band's real height), so the scroll window the buttons move and the rows on the glass are one computation.

Parameters
NameMeaning
layoutThe active display layout.
countHow many options the picker lists.
titleThe picker's title.
Returns
The number of rows the body shows at once.

pollPickerKeys() #

PickKeys kleidos::states::picker::pollPickerKeys(AppContext & ctx, uint8_t count, uint8_t & focus)
nodiscard

Read one frame of a picker's keys and move the focus (wrapping).

Parameters
NameDirectionMeaning
ctxin, outContext holding the buttons; their edges are consumed.
countinNumber of options (0 reads nothing).
focusin, outFocused option index, moved on a step.
Returns
What the keys asked for this frame.

previewStepperValue() #

void kleidos::states::settings::previewStepperValue(const AppContext & ctx, OptionId opt, int32_t value)

Show an uncommitted stepper value where its effect can be seen.

Brightness drives the backlight to value while the owner adjusts it, and the keyboard light drives the keyboard's own; nothing is stored and the level every wake restores to is unchanged. Every other option has no visible effect and is left alone.

Parameters
NameDirectionMeaning
ctxinApplication context (read only).
optinThe option being edited.
valueinThe value on screen (in the option's unit).

pushKeyboardLight() #

void kleidos::states::settings::pushKeyboardLight(const AppContext & ctx)

Push the keyboard light the owner set down to the board's keyboard.

The level while the light is on, dark while it is off (kb_backlight::effectivePercent). The one way the stored switch and level reach the driver: the boot push, the switch, the level's commit and the end of a level preview all go through it. A board with no keyboard light is left alone.

Parameters
NameDirectionMeaning
ctxinApplication context (the switch and the level are read from it).

readOptionValue() #

int32_t kleidos::states::settings::readOptionValue(const AppContext & ctx, OptionId id)
nodiscard

Read an option's current value from live state.

Reads the same source the on-device renderer displays, so the portal can never disagree with the device about what is stored.

Parameters
NameDirectionMeaning
ctxinLive application context.
idinOption to read.
Returns
The value in the option's own unit; 0 for a valueless row.

refreshOptionValue() #

int32_t kleidos::states::settings::refreshOptionValue(bool full)
nodiscardconstexpr

The OptionId::RefreshMode value (picker index) that selects a mode.

The index choiceLabel names each e-paper refresh mode by, so a surface that names a mode (the serial console's refresh command) writes the same index the picker does.

Parameters
NameDirectionMeaning
fullinTrue for a full-panel refresh on every update, false for the partial damage-diff.
Returns
1 for Full, 0 for Partial.

requestOptionApply() #

ApplyOutcome kleidos::states::settings::requestOptionApply(OptionId id, int32_t value, uint32_t timeoutMs)
nodiscard

Ask the UI core to apply an option value, and wait for it.

Safe to call from the admin portal's httpd task: the apply itself runs in drainOptionApplyQueue on the loop task, so nothing touches the panel, the backlight or the detectors from Core 0. The caller blocks until the loop has finished, which bounds the response to one UI tick.

Parameters
NameDirectionMeaning
idinOption to write.
valueinDesired value in the option's unit.
timeoutMsinHow long to wait for the loop to pick the request up.
Returns
Whether the value was applied, and whether it will survive a reboot. Read the stored result back with readOptionValue; the echoed value comes from the in-RAM context the apply updates first, so it cannot tell kleidos::settings::ApplyOutcome::Stored from kleidos::settings::ApplyOutcome::NotStored.

setClockCommit() #

bool kleidos::setClockCommit(const ui::DateTimeFieldModel & model)
nodiscard

Commit an edited local date/time to the RTC (UTC) and persist its zone.

Computes the UTC epoch via setClockToUtcEpoch (honoring the user's DST option from the timezone facade) and rejects it (no RTC write, returns false) when setClockEpochValid fails. Otherwise splits the epoch back into UTC calendar fields (calendar::epochToDateTime) and writes both through the atomic rtc::setDateTime facade write — one combined backend apply, so the instant can never be observed half-written and the backend cost (NVS floor write / I2C burst) is paid once. Finally the selected zone index is persisted through timex::local::setZoneIdx (NVS + libc TZ export) so the next open pre-selects it and every display path switches with it.

Parameters
NameDirectionMeaning
modelinThe edited local date/time (fields + selected zone index).
Return values
ValueMeaning
trueThe epoch passed the guard, was written to the RTC, and the zone index was stored.
falseThe epoch failed the guard (the RTC was left untouched), or the zone index did not persist — the wall clock the owner set is read through that zone, so the next boot would show a different time than the one they confirmed.

setClockEpochValid() #

bool kleidos::setClockEpochValid(uint32_t epoch)
nodiscardconstexpr

Defensive lower-bound guard on a to-be-committed UTC epoch.

True only for epochs at/after calendar::kMinValidEpoch (2001-09-09), matching the admin portal's set-time request check (epoch >= 1e9). The widget's year floor of 2024 can never actually produce a sub-1e9 epoch, so this is a pure defensive check (also unit-testable in isolation).

Parameters
NameDirectionMeaning
epochinThe candidate UTC Unix epoch.
Return values
ValueMeaning
trueThe epoch is at/after the minimum valid seed.
falseThe epoch is below the minimum valid seed (reject).

setClockParseBuildDate() #

SetClockBuildDate kleidos::setClockParseBuildDate(const char * s)
nodiscardconstexpr

Parse a __DATE__-format literal ("Mmm dd yyyy") into a date triple.

Handles the space-padded single-digit day ("Jul 9 2026"). Pure and constexpr so the parser itself is pinned by the static_asserts below; the value seeds the Set-clock editor when no trusted clock is running, putting the pre-fill within weeks of "now" instead of a stale hard-coded default.

Parameters
NameDirectionMeaning
sinAn 11-character __DATE__ literal ("Mmm dd yyyy").
Returns
The parsed (year, month, day); an unrecognized month parses as 1.

setClockStoredZoneIdx() #

uint8_t kleidos::setClockStoredZoneIdx()
nodiscard

Read the persisted timezone index, clamped into table range.

Thin delegation to the user-timezone facade (timex::local::zoneIdx()), which owns the NVS namespace/key pair and the out-of-range fallback. Kept as a named seam so the Set-clock editor's pre-fill and the settings list's current-local-time trailing value read the zone through one function.

Returns
The stored zone index, or 0 (UTC) when unset or out of range.

setClockToUtcEpoch() [1/2] #

uint32_t kleidos::setClockToUtcEpoch(const ui::DateTimeFieldModel & model)
nodiscardconstexpr

Map an edited local date/time model to a UTC Unix epoch (DST honored).

Parameters
NameDirectionMeaning
modelinThe edited local date/time (fields + selected zone index).
Returns
The corresponding UTC Unix epoch (seconds since 1970-01-01).

setClockToUtcEpoch() [2/2] #

uint32_t kleidos::setClockToUtcEpoch(const ui::DateTimeFieldModel & model, bool dstEnabled)
nodiscardconstexpr

Map an edited local date/time model to a UTC Unix epoch.

Reads the model's fields as a local instant in kZones[model.zoneIdx] (defensively falling back to UTC, index 0, for an out-of-range index) and converts to UTC via kleidos::timex::localToUtcEpoch. dstEnabled is the user's DST option: when off, the zone acts as its fixed standard offset. The seconds field is always zero (the widget edits to minute resolution).

Parameters
NameDirectionMeaning
modelinThe edited local date/time (fields + selected zone index).
dstEnabledinHonor the zone's DST rule (false ⇒ fixed offset).
Returns
The corresponding UTC Unix epoch (seconds since 1970-01-01).

setToggleOption() #

ToggleOutcome kleidos::states::settings::setToggleOption(AppContext & ctx, OptionId id, bool on)
nodiscard

Set an in-place toggle option to an absolute state.

The value-addressed form toggleOption is built on, and the writer applyOptionValue routes every kleidos::settings::ValueType::Bool row to. A relative flip is what two buttons afford; the admin portal sends a state ("off"), and a surface that can only flip would turn a redundant write into a change. Picker-backed rows (kleidos::settings::ValueType::Enum) are not toggles here: their writer is the picker setter behind applyOptionValue.

Parameters
NameDirectionMeaning
ctxin, outApplication context (audio / shake detector).
idinThe toggle option to set.
oninDesired state.
Returns
Whether id is a toggle, and whether on will survive a reboot.

stepperBands() #

StepperBands kleidos::states::settings_overlays::stepperBands(const ui::LayoutContext & layout)

The stepper overlay's bands.

Parameters
NameMeaning
layoutThe active display layout.
Returns
The header, control, footer, Save and back rects.

stepperSpecFor() #

StepperSpec kleidos::states::settings::stepperSpecFor(OptionId opt, const AppContext & ctx)

Resolve the stepper descriptor (range/step/unit + live value) for opt.

The value is clamped into [min, max], so an editor never opens outside its range (a QA build parks the idle timers at the never-fires sentinel).

Parameters
NameDirectionMeaning
optinA stepper-backed option id.
ctxinLive application context (source of the current value).
Returns
The stepper spec; PIN sweep for any non-stepper id (defensive default).

textEditorContentArea() #

ui::Rect kleidos::textEditorContentArea(const ui::LayoutContext & layout)

Content rectangle (between the header and the action bar) both 2-button text editors fill.

Shared by the draw pass and the focus-box / ring tween geometry so the animated and snapped positions are computed from one source of truth. Layout-only: it reads no member state.

Parameters
NameDirectionMeaning
layoutinActive-display responsive layout context.
Returns
The content safe-area rectangle.

themeOptionValue() #

int32_t kleidos::states::settings::themeOptionValue(ui::ThemeMode mode)
nodiscardconstexpr

The OptionId::ThemeInvert value that selects mode.

The seam's statement of the toggle's polarity: readOptionValue reports the live mode through it, setToggleOption maps a written value back to a mode through it, and a surface that names a mode rather than a value (the serial console's theme command) asks it which value to write. The settings tree's row does not: its formatter (optionContent) draws the switch from the mode itself, ON for ui::ThemeMode::Dark, so the row's switch and this value disagree about what ON means.

Parameters
NameDirectionMeaning
modeinA theme mode.
Returns
1 for ui::ThemeMode::Light, 0 for ui::ThemeMode::Dark.

toastSyncOutcome() #

void kleidos::states::ntpsync::toastSyncOutcome(const net::ntp::Status & status)

Toast how a sync ended.

Done shows a success toast and Failed a warning. Cancelled is the user's own abort and shows nothing, as does a phase that is not terminal.

A sync that failed because no access point would have it says so, and names the network and the channel the last attempt died on: that channel is the one thing an owner can act on, by moving the access point, and on the two boards that cannot transmit below a channel of their own it is the only remedy there is. Every other failure keeps the plain "sync failed" message, because a channel says nothing about a server that did not answer.

Parameters
NameDirectionMeaning
statusinThe engine's terminal snapshot: its phase, its reason, and the network and channel of the last join attempt.

toastSyncRefused() #

void kleidos::states::ntpsync::toastSyncRefused(net::ntp::FailReason reason)

Toast why the engine refused to start a sync.

No saved network gets its own message; every other refusal reads as a failed sync.

Parameters
NameDirectionMeaning
reasoninThe refusal, read from kleidos::net::ntp::status after kleidos::net::ntp::begin returned false.

toastTotpCodesHeadsUp() #

bool kleidos::states::settings::toastTotpCodesHeadsUp(OptionId id)

What an on-device toggle tells the owner once 2FA codes are on, on a board without an RTC chip.

There a code needs a precise time sync since the board last slept, which the row alone does not say. The settings tree and the keyboard panel call this after a ToggleOutcome::Stored toggle and show their own confirmation only when it returns false. The seam (setToggleOption) stays silent: it is also the portal's and the console's commit path, and neither owns the glass. The portal says the same in the row's help text.

Parameters
NameDirectionMeaning
idinThe option the toggle just stored.
Return values
ValueMeaning
trueIt raised the heads-up toast.
falseNothing to say: another option, codes now off, or a board whose RTC chip keeps the time.

toggleMovedLiveState() #

bool kleidos::states::settings::toggleMovedLiveState(ToggleOutcome outcome)
constexpr

Whether the toggle moved the device's live state.

Parameters
NameDirectionMeaning
outcomeinOutcome of a finished toggle.
Return values
ValueMeaning
trueThe live state changed, so any row rendering it is stale.

toggleOption() #

ToggleOutcome kleidos::states::settings::toggleOption(AppContext & ctx, OptionId id)
nodiscard

Flip or step an option in place, and persist it.

Reads the option's value through readOptionValue and writes the next one through the settings seam. A toggle (a kleidos::settings::ValueType::Bool row: daylight saving, 2FA codes, theme/ink polarity, lock clock, audio feedback, shake-to-lock, fixed admin network) is set to the opposite of its value through setToggleOption. A picker (a kleidos::settings::ValueType::Enum row) steps to its next choice, wrapping, through applyOptionValue and so through the picker's own setter: the button tree cycles the two-state e-paper refresh mode this way. A no-op for any other id. Shared so both renderers move the same state through the same writer the portal and the serial console use.

Parameters
NameDirectionMeaning
ctxin, outApplication context (audio / shake detector / display).
idinThe toggle or picker option to move.
Returns
Whether it moved, and whether the move will survive a reboot.

twoButton() #

bool kleidos::states::settings_overlays::twoButton(const AppContext & ctx)

Whether the board reads two face buttons and no third (the Sticks): taps move, an A hold does the thing and a B hold goes back.

Parameters
NameMeaning
ctxThe board context whose inputs are read.
Returns
True on a board with no third face button.

Back to the top