|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include <VcardModule.h>
Public Member Functions | |
| const char * | getName () const override |
| const char * | getVersion () const override |
| Returns the module version string. | |
| core::ServiceState | getState () const override |
| bool | init () override |
| Initializes module UI strings, serial commands, and BLE service hooks. | |
| bool | start () override |
| Starts vCard module service. | |
| void | stop () override |
| Stops vCard BLE service and module runtime. | |
| uint8_t | getMenuItems (core::ModuleMenuItem *items, uint8_t maxItems) override |
| Provides tools-menu entry for vCard module. | |
| uint8_t | getLockScreenContextItems (core::LockScreenContextItem *items, uint8_t maxItems) override |
| Provides the lock-screen quick action that shows the owner vCard as a QR code. | |
| void | onTick (uint32_t nowMs) override |
| Periodic vCard module tick forwarding BLE state machine. | |
| bool | exportBackup (cJSON *out) override |
| Exports the own vCard and all received vCards into the backup section. | |
| core::IModule::BackupResult | importBackup (const cJSON *in) override |
| Restores the own vCard and received vCards from the backup section. | |
| Public Member Functions inherited from cdc::core::IModule | |
| virtual ui::IView * | getEntryView () |
| Returns the module's entry view (main view when selected from menu). | |
| 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 | 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 |
Static Public Member Functions | |
| static VcardModule & | instance () |
| Returns singleton vCard module instance. | |
Definition at line 9 of file VcardModule.h.
|
overridevirtual |
Exports the own vCard and all received vCards into the backup section.
Writes schema_ver, an optional own string, and a received array of raw vCard texts. Returns false only when there is nothing to export.
| out | cJSON object that forms the module's section in the backup file. |
Reimplemented from cdc::core::IModule.
Definition at line 884 of file VcardModule.cpp.
References cdc::mod_vcard::kSchemaVer, VCARD_MAX_CARDS, VCARD_MAX_LEN, vcard_store_get(), vcard_store_get_own(), and vcard_store_get_sorted().
|
overridevirtual |
Provides the lock-screen quick action that shows the owner vCard as a QR code.
| items | Output array for context items. |
| maxItems | Maximum writable entries. |
Reimplemented from cdc::core::IModule.
Definition at line 853 of file VcardModule.cpp.
References cdc::mod_vcard::getMyVcardLockscreenLabel(), and cdc::mod_vcard::onMyVcardLockscreenSelect().
|
overridevirtual |
Provides tools-menu entry for vCard module.
| items | Output array for menu items. |
| maxItems | Maximum writable entries. |
Reimplemented from cdc::core::IModule.
Definition at line 824 of file VcardModule.cpp.
References getName(), cdc::mod_vcard::mstr(), cdc::mod_vcard::onMainMenuSelect(), cdc::mod_vcard::rebuildMainMenu(), cdc::mod_vcard::s_mainMenu, cdc::mod_vcard::s_viewsInitialized, cdc::mod_vcard::STR_VCARD, and cdc::core::TOOLS_MENU.
|
inlineoverridevirtual |
Get service name (for logging/debugging)
Implements cdc::core::IService.
Definition at line 13 of file VcardModule.h.
Referenced by getMenuItems().
|
inlineoverridevirtual |
Get current service state
Implements cdc::core::IService.
Definition at line 15 of file VcardModule.h.
|
inlineoverridevirtual |
Returns the module version string.
Implements cdc::core::IModule.
Definition at line 14 of file VcardModule.h.
|
overridevirtual |
Restores the own vCard and received vCards from the backup section.
The own vCard overwrites the current one; received vCards are upserted by exact text. Best-effort: failures are tallied, never aborting the restore.
| in | cJSON object holding the previously exported section. |
Reimplemented from cdc::core::IModule.
Definition at line 947 of file VcardModule.cpp.
References cdc::core::IModule::BackupResult::failed, cdc::core::IModule::BackupResult::imported, cdc::ui::importJsonArray(), cdc::mod_vcard::importReceivedVcard(), cdc::mod_vcard::kSchemaVer, LOG_W, TAG, and vcard_store_set_own().
|
overridevirtual |
Initializes module UI strings, serial commands, and BLE service hooks.
Implements cdc::core::IService.
Definition at line 782 of file VcardModule.cpp.
References cdc::mod_vcard::VcardWizard::configure(), cdc::mod_vcard::deliverVcard(), cdc::core::INITIALIZED, cdc::core::ModuleRegistry::instance(), LOG_I, cdc::mod_vcard::mstr(), cdc::core::ModuleRegistry::registerModule(), cdc::mod_vcard::registerSerialCommands(), cdc::mod_vcard::registerStrings(), cdc::mod_vcard::s_wizardStepOffsets, cdc::mod_vcard::STR_EXCHANGE_FAIL, cdc::mod_vcard::STR_SAVED, and TAG.
|
static |
Returns singleton vCard module instance.
Definition at line 773 of file VcardModule.cpp.
|
overridevirtual |
Periodic vCard module tick forwarding BLE state machine.
| nowMs | Current uptime in milliseconds. |
Reimplemented from cdc::core::IModule.
Definition at line 868 of file VcardModule.cpp.
|
overridevirtual |
Starts vCard module service.
Implements cdc::core::IService.
Definition at line 802 of file VcardModule.cpp.
References cdc::core::INITIALIZED, cdc::core::STARTED, and cdc::core::STOPPED.
|
overridevirtual |
Stops vCard BLE service and module runtime.
Implements cdc::core::IService.
Definition at line 813 of file VcardModule.cpp.
References cdc::core::STOPPED.