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 StringResolver = const char* (*)(uint16_t offset)
 Resolves a localized step title.
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 (StringResolver resolver, const uint16_t *titleOffsets, uint16_t savedOffset, uint16_t failedOffset)
 Configures the wizard with i18n callbacks. 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 40 of file VcardWizard.h.

◆ StringResolver

using cdc::mod_vcard::VcardWizard::StringResolver = const char* (*)(uint16_t offset)

Resolves a localized step title.

Parameters
baseIdThe base i18n string ID of the owning module.
offsetPer-module string offset within the registered range.
Returns
Translated string pointer.

Definition at line 23 of file VcardWizard.h.

Member Function Documentation

◆ configure()

void cdc::mod_vcard::VcardWizard::configure ( StringResolver resolver,
const uint16_t * titleOffsets,
uint16_t savedOffset,
uint16_t failedOffset )
static

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

Parameters
resolverFunction returning a translated title for a string offset.
titleOffsetsPointer to an array of 16 offsets for the wizard steps.
savedOffsetOffset of the "saved" toast message.
failedOffsetOffset of the generic "failed" toast message.

Definition at line 242 of file VcardWizard.cpp.

References cdc::mod_vcard::s_failedOffset, cdc::mod_vcard::s_resolver, cdc::mod_vcard::s_savedOffset, and cdc::mod_vcard::s_titleOffsets.

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 258 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 282 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 250 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 272 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: