CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
cdc::mod_vcard::VcardWizard Class Reference

Wizard for creating or editing the device owner's vCard via the GUI. More...

#include <VcardWizard.h>

Public Types

using DoneCallback = void (*)()
 Callback fired after a successful save, before returning to the anchor view. Lets the caller refresh a list it owns.

Static Public Member Functions

static void configure (const char *const *titleKeys, const char *savedKey, const char *failedKey)
 Configures the wizard with i18n keys. Must be called before start() or edit() so step titles can be looked up.
static void start (ui::IView *returnAnchor)
 Starts the wizard with an empty struct.
static void edit (ui::IView *returnAnchor)
 Starts the wizard prefilled with the currently stored own vCard. Falls back to start() when no vCard is present.
static void startReceived (ui::IView *returnAnchor, DoneCallback onDone)
 Starts the wizard to create a new stored contact (received list).
static void editReceived (ui::IView *returnAnchor, uint16_t slot, DoneCallback onDone)
 Starts the wizard prefilled with a stored contact for editing.

Detailed Description

Wizard for creating or editing the device owner's vCard via the GUI.

The wizard is a sequence of T9 input steps. On completion it generates a vCard 4.0 string and persists it through vcard_store_set_own().

Definition at line 15 of file VcardWizard.h.

Member Typedef Documentation

◆ DoneCallback

Callback fired after a successful save, before returning to the anchor view. Lets the caller refresh a list it owns.

Definition at line 31 of file VcardWizard.h.

Member Function Documentation

◆ configure()

void cdc::mod_vcard::VcardWizard::configure ( const char *const * titleKeys,
const char * savedKey,
const char * failedKey )
static

Configures the wizard with i18n keys. Must be called before start() or edit() so step titles can be looked up.

Parameters
titleKeysPointer to an array of 16 i18n keys for the wizard steps.
savedKeyi18n key of the "saved" toast message.
failedKeyi18n key of the generic "failed" toast message.

Definition at line 238 of file VcardWizard.cpp.

References cdc::mod_vcard::s_failedKey, cdc::mod_vcard::s_savedKey, and cdc::mod_vcard::s_titleKeys.

Referenced by cdc::mod_vcard::VcardModule::init().

◆ edit()

void cdc::mod_vcard::VcardWizard::edit ( ui::IView * returnAnchor)
static

Starts the wizard prefilled with the currently stored own vCard. Falls back to start() when no vCard is present.

Parameters
returnAnchorView to pop back to once the wizard finishes.

Definition at line 253 of file VcardWizard.cpp.

References cdc::mod_vcard::pushCurrentStep(), cdc::mod_vcard::s_wizard, VCARD_MAX_LEN, vcard_parse_to_struct(), and vcard_store_get_own().

Referenced by cdc::mod_vcard::onMainMenuSelect().

◆ editReceived()

void cdc::mod_vcard::VcardWizard::editReceived ( ui::IView * returnAnchor,
uint16_t slot,
DoneCallback onDone )
static

Starts the wizard prefilled with a stored contact for editing.

Parameters
returnAnchorView to pop back to once the wizard finishes.
slotSlot index of the stored contact to edit.
onDoneOptional callback fired after a successful save.

Definition at line 277 of file VcardWizard.cpp.

References cdc::mod_vcard::pushCurrentStep(), cdc::mod_vcard::RECEIVED_EDIT, cdc::mod_vcard::s_wizard, VCARD_MAX_LEN, vcard_parse_to_struct(), and vcard_store_get().

Referenced by cdc::mod_vcard::ctxReceivedEdit().

◆ start()

void cdc::mod_vcard::VcardWizard::start ( ui::IView * returnAnchor)
static

Starts the wizard with an empty struct.

Parameters
returnAnchorView to pop back to once the wizard finishes.

Definition at line 245 of file VcardWizard.cpp.

References cdc::mod_vcard::pushCurrentStep(), and cdc::mod_vcard::s_wizard.

Referenced by cdc::mod_vcard::onMainMenuSelect().

◆ startReceived()

void cdc::mod_vcard::VcardWizard::startReceived ( ui::IView * returnAnchor,
DoneCallback onDone )
static

Starts the wizard to create a new stored contact (received list).

Parameters
returnAnchorView to pop back to once the wizard finishes.
onDoneOptional callback fired after a successful save.

Definition at line 267 of file VcardWizard.cpp.

References cdc::mod_vcard::pushCurrentStep(), cdc::mod_vcard::RECEIVED_NEW, and cdc::mod_vcard::s_wizard.

Referenced by cdc::mod_vcard::ctxReceivedAdd().


The documentation for this class was generated from the following files: