CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
SettingsHandlers.cpp File Reference
#include "cdc_os_ui/SettingsHandlers.h"
#include "cdc_os_ui/views/LockScreenView.h"
#include "cdc_ui/ViewStack.h"
#include "cdc_ui/I18n.h"
#include "cdc_views/T9InputView.h"
#include "cdc_hal/IDisplay.h"
#include "cdc_hal/ISleepController.h"
#include "cdc_hal/IRtc.h"
#include "nvs.h"
#include <ctime>
#include <sys/time.h>

Go to the source code of this file.

Namespaces

namespace  cdc
namespace  cdc::ui
 Centralized key-code constants for cdc_views.
namespace  cdc::ui::settings

Functions

static void cdc::ui::settings::showBadgeTextStep (uint8_t step)
 Forward declarations for internal helper callbacks.
static void cdc::ui::settings::onBadgeNameSave (const char *text)
 Handles save callback for badge display name.
static void cdc::ui::settings::onBadgeInfoSave (const char *text)
 Handles save callback for badge info line 1.
static void cdc::ui::settings::onBadgeInfo2Save (const char *text)
 Handles save callback for badge info line 2.
void cdc::ui::settings::init (hal::IDisplay *display, hal::ISleepController *sleep, LockScreenView *lockScreen)
 Initializes shared dependencies used by the settings handlers.
void cdc::ui::settings::processPendingBadgeText ()
 Processes the next pending badge-text wizard step.
void cdc::ui::settings::onBrightnessSave (uint16_t value)
 Persists and applies selected backlight value.
void cdc::ui::settings::onBrightnessChange (uint16_t value)
 Applies backlight preview without persisting.
uint16_t cdc::ui::settings::brightnessStepCallback (uint16_t current, bool increasing)
 Returns adaptive brightness step size.
void cdc::ui::settings::onSleepIntervalSave (uint16_t value)
 Saves lock-screen sleep interval in minutes.
void cdc::ui::settings::onTimezoneSave (uint16_t value)
 Saves timezone offset and refreshes lock-screen clock.
void cdc::ui::settings::onDateConfirm (uint8_t day, uint8_t month, uint16_t year)
 Applies confirmed date to system time.
void cdc::ui::settings::onTimeConfirm (uint8_t hour, uint8_t minute)
 Applies confirmed time to system clock.
void cdc::ui::settings::onPinChangeComplete (bool success)
 Handles completion of PIN-change flow.
void cdc::ui::settings::startBadgeTextEdit ()
 Starts badge-text editing wizard.
void cdc::ui::settings::saveDisplayField (const char *key, const char *value)
 Saves one display text field to NVS.
bool cdc::ui::settings::loadDisplayField (const char *key, char *out, size_t outSize)
 Reads one display text field from NVS into the caller buffer.

Variables

static hal::IDisplaycdc::ui::settings::s_display = nullptr
 External dependencies injected by AppUi.
static hal::ISleepControllercdc::ui::settings::s_sleep = nullptr
static LockScreenViewcdc::ui::settings::s_lockScreen = nullptr
static constexpr uint8_t cdc::ui::settings::BADGE_STEP_NONE = 0
 Badge text editing workflow state.
static constexpr uint8_t cdc::ui::settings::BADGE_STEP_NAME = 1
static constexpr uint8_t cdc::ui::settings::BADGE_STEP_INFO = 2
static constexpr uint8_t cdc::ui::settings::BADGE_STEP_INFO2 = 3
static uint8_t cdc::ui::settings::s_badgeTextPendingStep = BADGE_STEP_NONE