|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
Module interface that extends IService with module-specific features. More...
#include <IModule.h>
Classes | |
| struct | SlotRequest |
| struct | SlotRange |
| struct | BackupResult |
| Per-module restore outcome reported by importBackup(). More... | |
Public Member Functions | |
| virtual const char * | getVersion () const =0 |
| Returns the module version string. | |
| virtual bool | exportBackup (cJSON *out) |
| Exports this module's data as a JSON section for the backup file. | |
| virtual BackupResult | importBackup (const cJSON *in) |
| Restores this module's data from its JSON backup section. | |
| virtual uint8_t | getMenuItems (ModuleMenuItem *items, uint8_t maxItems) |
| Returns module menu items. | |
| virtual ui::IView * | getEntryView () |
| Returns the module's entry view (main view when selected from menu). | |
| virtual uint8_t | getLockScreenContextItems (LockScreenContextItem *items, uint8_t maxItems) |
| Returns the module's lock screen context menu items. | |
| virtual void | onUnlock () |
| Called when device is unlocked. | |
| virtual void | onLock () |
| Called when device is locked. | |
| virtual void | onUsbConnect () |
| Called when USB is connected. | |
| virtual void | onUsbDisconnect () |
| Called when USB is disconnected. | |
| virtual void | onTick (uint32_t nowMs) |
| Called periodically (optional tick for background work). | |
| virtual void | setSlotRange (const SlotRange &range) |
| Sets the slot range assigned by the module registry (from compile-time memory map). | |
| virtual SlotRequest | getSlotRequest () const |
| Returns slot requirements for this module (from compile-time memory map). | |
| Public Member Functions inherited from cdc::core::IService | |
| virtual | ~IService ()=default |
| virtual bool | init ()=0 |
| virtual bool | start ()=0 |
| virtual void | stop ()=0 |
| virtual ServiceState | getState () const =0 |
| virtual const char * | getName () const =0 |
Module interface that extends IService with module-specific features.
Modules are self-contained features (TOTP, FIDO2, Password, etc.) that can register menu items, serial commands, and views.
|
inlinevirtual |
Exports this module's data as a JSON section for the backup file.
Modules write semantic records (never raw slot/NVS blobs) into out so the backup survives slot-layout and format changes. Default no-op: a module that does not implement this is simply absent from the backup.
| out | cJSON node (object or array) the module fills with its records. |
Reimplemented in cdc::mod_2fa::TwoFaModule, cdc::mod_password::PasswordModule, and cdc::mod_vcard::VcardModule.
Definition at line 100 of file IModule.h.
Referenced by cdc::os_ui::BackupManager::exportTo().
|
inlinevirtual |
|
inlinevirtual |
Returns the module's lock screen context menu items.
| items | Output array to fill. |
| maxItems | Maximum items to return. |
Reimplemented in cdc::mod_vcard::VcardModule.
|
inlinevirtual |
Returns module menu items.
| items | Output array to fill. |
| maxItems | Maximum items to return. |
Reimplemented in cdc::mod_2fa::TwoFaModule, cdc::mod_ble_serial::BleSerialModule, cdc::mod_fido2::Fido2Module, cdc::mod_gpg::GpgModule, cdc::mod_nvsedit::NvsEditModule, cdc::mod_password::PasswordModule, cdc::mod_sao::SaoModule, and cdc::mod_vcard::VcardModule.
|
inlinevirtual |
Returns slot requirements for this module (from compile-time memory map).
Reimplemented in cdc::mod_2fa::TwoFaModule, cdc::mod_fido2::Fido2Module, cdc::mod_gpg::GpgModule, and cdc::mod_password::PasswordModule.
|
pure virtual |
Returns the module version string.
Implemented in cdc::mod_2fa::TwoFaModule, cdc::mod_ble_serial::BleSerialModule, cdc::mod_fido2::Fido2Module, cdc::mod_gpg::GpgModule, cdc::mod_nvsedit::NvsEditModule, cdc::mod_password::PasswordModule, cdc::mod_sao::SaoModule, and cdc::mod_vcard::VcardModule.
Referenced by cdc::core::ModuleRegistry::registerModule().
|
inlinevirtual |
Restores this module's data from its JSON backup section.
Best-effort: each record is created through the module's normal storage path (fresh slot allocation); a record that cannot be restored is skipped and counted, never aborting the whole restore. Default no-op.
| in | cJSON node holding the module's previously exported section. |
Reimplemented in cdc::mod_2fa::TwoFaModule, cdc::mod_password::PasswordModule, and cdc::mod_vcard::VcardModule.
Definition at line 112 of file IModule.h.
Referenced by cdc::os_ui::BackupManager::importFrom().
|
inlinevirtual |
|
inlinevirtual |
Called periodically (optional tick for background work).
| nowMs | Current timestamp in milliseconds. |
Reimplemented in cdc::mod_2fa::TwoFaModule, cdc::mod_ble_serial::BleSerialModule, and cdc::mod_vcard::VcardModule.
|
inlinevirtual |
Called when device is unlocked.
Reimplemented in cdc::mod_sao::SaoModule.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Sets the slot range assigned by the module registry (from compile-time memory map).
| range | Assigned slot range. |
Reimplemented in cdc::mod_2fa::TwoFaModule, cdc::mod_fido2::Fido2Module, cdc::mod_gpg::GpgModule, and cdc::mod_password::PasswordModule.