In development. It changes without notice.
Topic
Notifications
Notices about the battery, the link, the portal, the lock and an update, shown once and not again until the state really changes.
- See also
- Popups & Modals
Files | |
| file | src/ |
| Hysteresis-aware status toasts layered on PopupSystem. | |
Classes | |
| struct | kleidos:: |
| Edge-triggered battery state kept across calls. More about kleidos:: | |
| struct | kleidos:: |
| BLE host connection state for edge-detect logic. More about kleidos:: | |
| struct | kleidos:: |
| Admin WiFi client count state for edge-detect logic. More about kleidos:: | |
| struct | kleidos:: |
| Idle/timeout state for the admin portal warning. More about kleidos:: | |
| struct | kleidos:: |
| Auto-lock countdown edge state. More about kleidos:: | |
| struct | kleidos:: |
| OTA-applied one-shot state. More about kleidos:: | |
Enumerations | |
| enum class | kleidos:: |
| One of the events the notifier can decide to emit. Tests compare against this enum; the runtime wrapper maps each event to a popup:: | |
Functions | |
| Event | kleidos:: |
| Decide which (if any) battery event should be emitted given a new sample. | |
| Event | kleidos:: |
| Decide which (if any) BLE host event to emit on a connection change. | |
| Event | kleidos:: |
| Decide which (if any) admin-client event to emit. | |
| Event | kleidos:: |
Fire ADMIN_elapsedMs crosses the warn threshold, and ADMIN_TIMEOUT once when it reaches totalTimeoutMs. | |
| Event | kleidos:: |
Fire AUTO_windowMs. | |
| Event | kleidos:: |
Emit OTA_APPLIED once if otaJustApplied is true on this boot. | |
| void | kleidos:: |
| Reset every internal state (call on fresh boot / factory reset). | |
| void | kleidos:: |
| Poll battery at BATT_POLL_MS cadence. Must be called from the main loop. | |
| void | kleidos:: |
| Called from BleHidManager polling / VaultState BLE watcher. | |
| void | kleidos:: |
| Called from AdminState:: | |
| void | kleidos:: |
| Called every frame from AdminState:: | |
| void | kleidos:: |
| Called from the global activity watchdog with milliseconds remaining until deep sleep. | |
| void | kleidos:: |
Called once, by the first loop tick that marked a freshly applied OTA image valid (kleidos::). | |
Variables | |
| constexpr uint8_t | kleidos:: |
| Battery % at which the LOW toast fires (the header gauge turns red later, at 15 %). | |
| constexpr uint8_t | kleidos:: |
| Hysteresis: re-arm low above this. | |
| constexpr uint8_t | kleidos:: |
| Battery % at which the notifier's CRITICAL toast fires. | |
| constexpr uint8_t | kleidos:: |
| Battery % at which the FULL toast fires. | |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| How long before deep sleep the auto-lock countdown toast fires, in milliseconds. | |
Enumeration Type Documentation
Event #
One of the events the notifier can decide to emit. Tests compare against this enum; the runtime wrapper maps each event to a popup::
Function Documentation
decideAdminClient() #
Decide which (if any) admin-client event to emit.
Pure logic; host-testable.
- Parameters
-
Name Direction Meaning st in, out Persistent client count state. stationCount in Number of currently connected WiFi stations.
- Return values
-
Value Meaning Event:: AdminClientConnected Station count just increased. Event::NONE No event this call.
decideAdminIdle() #
Fire ADMIN_elapsedMs crosses the warn threshold, and ADMIN_TIMEOUT once when it reaches totalTimeoutMs.
Pure logic; host-testable. Activity reset (elapsedMs == 0) re-arms both events and returns NONE.
- Parameters
-
Name Direction Meaning st in, out Persistent idle state. elapsedMs in Elapsed milliseconds since last client activity. totalTimeoutMs in Total portal timeout in milliseconds (e.g. 300000). warnLeadMs in Warning lead time in milliseconds (e.g. 30000).
- Return values
-
Value Meaning Event:: AdminIdleWarning Elapsed reached totalTimeoutMs - warnLeadMs. Event:: AdminTimeout Elapsed reached totalTimeoutMs. Event::NONE No event this call.
decideAutoLock() #
Fire AUTO_windowMs.
Pure logic; host-testable. Re-arms when msToSleep rises above windowMs.
- Parameters
-
Name Direction Meaning st in, out Persistent auto-lock state. msToSleep in Milliseconds remaining until deep sleep. windowMs in Warning window in milliseconds (e.g. 5000).
- Return values
-
Value Meaning Event:: AutoLockCountdown msToSleep just dropped below windowMs. Event::NONE No event this call.
decideBattery() #
Decide which (if any) battery event should be emitted given a new sample.
Never returns more than one event per call. Pure logic; host-testable.
- Parameters
-
Name Direction Meaning st in, out Persistent battery state (updated in place). pct in Current battery percentage (0..100). isCharging in True if the charger is connected.
- Return values
-
Value Meaning Event:: BatteryLow Battery dipped to kBattLowPct(rising edge).Event:: BatteryCritical Battery hit kNotifyBattCritPct(one-shot per boot).Event:: BatteryCharging Charger just connected (rising edge). Event:: BatteryFull Battery reached kBattFullPctwhile charging.Event::NONE No event this call.
decideBleHost() #
Decide which (if any) BLE host event to emit on a connection change.
Pure logic; host-testable.
- Parameters
-
Name Direction Meaning st in, out Persistent host connection state. isConnected in True if a BLE host is currently connected.
- Return values
-
Value Meaning Event:: BleHostConnected Connection just established (rising edge). Event:: BleHostDisconnected Connection just lost (falling edge). Event::NONE No event this call.
decideOtaApplied() #
Emit OTA_APPLIED once if otaJustApplied is true on this boot.
Pure logic; host-testable.
- Parameters
-
Name Direction Meaning st in, out Persistent OTA-applied state. otaJustApplied in True if a new firmware was just applied.
- Return values
-
Value Meaning Event:: OtaApplied First call with otaJustApplied== true.Event::NONE Already fired or otaJustAppliedis false.
notifyAdminClientCount() #
Called from AdminState::
- Parameters
-
Name Direction Meaning stationCount in Number of currently connected WiFi stations.
notifyAdminIdle() #
Called every frame from AdminState::
- Parameters
-
Name Direction Meaning elapsedMs in Elapsed milliseconds since last client activity (0 to re-arm). totalTimeoutMs in Total admin portal timeout in milliseconds. warnLeadMs in Warning lead time in milliseconds.
notifyAutoLockCountdown() #
Called from the global activity watchdog with milliseconds remaining until deep sleep.
- Parameters
-
Name Direction Meaning msToSleep in Milliseconds remaining until deep sleep. activityJustReset in True to re-arm the countdown toast.
notifyBatteryPoll() #
Poll battery at BATT_POLL_MS cadence. Must be called from the main loop.
- Parameters
-
Name Direction Meaning pct in Current battery percentage. isCharging in True if charger is connected. nowMs in Current monotonic time in milliseconds.
notifyBleConnected() #
Called from BleHidManager polling / VaultState BLE watcher.
- Parameters
-
Name Direction Meaning isConnected in True when a BLE host is connected.
notifyOtaApplied() #
Called once, by the first loop tick that marked a freshly applied OTA image valid (kleidos::).
- Parameters
-
Name Direction Meaning otaJustApplied in True if a new firmware was just applied. version in Version string to include in the toast.
Variable Documentation
kBattPollMs #
Battery polling interval in milliseconds.