CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
SettingsHandlers.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <cstddef>
5
6// Forward declarations
7namespace cdc::hal {
8class IDisplay;
10}
11namespace cdc::ui {
12class LockScreenView;
13}
14
15namespace cdc::ui {
16
17// Settings-related callbacks and handlers
18namespace settings {
19
20// Initialize dependencies (call from AppUi::ui_init)
22
23// Process pending badge text steps (call from ui_process)
25
26// Brightness control
27void onBrightnessSave(uint16_t value);
28void onBrightnessChange(uint16_t value);
29uint16_t brightnessStepCallback(uint16_t current, bool increasing);
30
31// Sleep interval
32void onSleepIntervalSave(uint16_t value);
33
34// Timezone
35void onTimezoneSave(uint16_t value);
36
37// Date/Time
38void onDateConfirm(uint8_t day, uint8_t month, uint16_t year);
39void onTimeConfirm(uint8_t hour, uint8_t minute);
40
41// PIN change
42void onPinChangeComplete(bool success);
43
44// Badge text editing flow
46
47// NVS persistence for display fields
48void saveDisplayField(const char* key, const char* value);
49
50// Reads one display text field from NVS into the caller buffer.
51// Returns true if a non-empty value was found; the buffer is left untouched
52// otherwise.
53bool loadDisplayField(const char* key, char* out, size_t outSize);
54
55} // namespace settings
56
57} // namespace cdc::ui
bool loadDisplayField(const char *key, char *out, size_t outSize)
Reads one display text field from NVS into the caller buffer.
void onPinChangeComplete(bool success)
Handles completion of PIN-change flow.
void saveDisplayField(const char *key, const char *value)
Saves one display text field to NVS.
void onBrightnessChange(uint16_t value)
Applies backlight preview without persisting.
uint16_t brightnessStepCallback(uint16_t current, bool increasing)
Returns adaptive brightness step size.
void onBrightnessSave(uint16_t value)
Persists and applies selected backlight value.
void processPendingBadgeText()
Processes the next pending badge-text wizard step.
void onDateConfirm(uint8_t day, uint8_t month, uint16_t year)
Applies confirmed date to system time.
void startBadgeTextEdit()
Starts badge-text editing wizard.
void onTimeConfirm(uint8_t hour, uint8_t minute)
Applies confirmed time to system clock.
void onTimezoneSave(uint16_t value)
Saves timezone offset and refreshes lock-screen clock.
void init(hal::IDisplay *display, hal::ISleepController *sleep, LockScreenView *lockScreen)
Initializes shared dependencies used by the settings handlers.
void onSleepIntervalSave(uint16_t value)
Saves lock-screen sleep interval in minutes.
Centralized key-code constants for cdc_views.
Definition IModule.h:8
Gdey029T94 * display