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

Classes

class  VcardModule
class  VcardWizard
 Wizard for creating or editing the device owner's vCard via the GUI. More...
struct  vcard_meta_t
struct  FieldRef
 Maps a step ID to the matching field inside vcard_data_t. More...
struct  WizardState
 Holds the wizard's running state between callback firings. More...

Enumerations

enum  MainMenuItem {
  MENU_MY_VCARD = 0 , MENU_EDIT_MY_VCARD , MENU_SEND , MENU_RECEIVED ,
  MENU_COUNT
}
 Main-menu item identifiers. More...
enum  WizardStepId : uint8_t {
  STEP_GIVEN = 0 , STEP_FAMILY , STEP_FORMATTED , STEP_ORG ,
  STEP_TITLE , STEP_EMAIL , STEP_TEL_CELL , STEP_TEL_HOME ,
  STEP_TEL_WORK , STEP_URL , STEP_TELEGRAM , STEP_SIGNAL ,
  STEP_MATRIX , STEP_THREEMA , STEP_SOCIAL , STEP_NOTE ,
  STEP_COUNT
}
 Step indices into the wizard's title offset table. Order must match s_steps[] below. More...
enum class  WizardTarget : uint8_t { OWN = 0 , RECEIVED_NEW , RECEIVED_EDIT }
 Save destination for the wizard's generated vCard. More...

Functions

static void registerStrings ()
static void rebuildMainMenu ()
 Rebuilds the vCard main menu.
static void onMainMenuSelect (uint16_t index, void *userData)
 Handles main-menu actions for local vCard operations and sharing.
static void openReceivedList ()
 Lazily wires callbacks, rebuilds and pushes the received-contacts list.
static void rebuildReceivedList ()
 Rebuilds the received-contacts list from the store (sorted by name).
static void showVcardDetails (const char *title, const char *raw, bool withActions)
 Renders a vCard's parsed fields into a scrollable InfoView.
static void showVcardQr (const char *raw, const char *fallbackTitle)
 Shows a vCard as a QR code, titled with the contact name.
static void onReceivedViewMenu (void *userData)
 Detail-view context menu (key 3): edit / forward / QR / delete the currently shown contact.
static bool deliverVcard (const uint8_t *data, uint32_t len, const char *, const char *)
 Delivers a received vCard into the contact store.
static void onReceivedSelect (uint16_t index, void *userData)
 Opens the detail view (with action menu) for the selected contact.
static void ctxReceivedAdd ()
 Context-menu action: create a new stored contact via the wizard.
static void ctxReceivedEdit ()
 Context-menu action: edit the active stored contact via the wizard.
static void ctxReceivedQr ()
 Context-menu action: show the active contact as a QR code.
static void ctxReceivedForward ()
 Context-menu action: forward the active contact to a nearby badge.
static void onReceivedDeleteConfirm (void *userData)
 Confirm-dialog handler: deletes the contact and refreshes the list.
static void ctxReceivedDelete ()
 Context-menu action: confirm and delete the active contact.
static void onReceivedMenu (uint16_t index, void *userData)
 List context menu (key 3): add a contact; for a selected entry also edit / forward / delete it.
static const char * getMyVcardLockscreenLabel ()
 Returns the localized label for the lock-screen quick action.
static void onMyVcardLockscreenSelect ()
 Lock-screen quick action: shows the own vCard as a QR code. Falls back to a toast when no vCard has been configured yet.
static void vcard_session_clear ()
static void vcard_idle_fired (void *)
static void vcard_arm_idle_timer ()
static bool vcardLineInterceptor (const char *line)
 Intercepts multiline vCard paste input, accumulates lines, and stops at "---".
static void cmdVcardSet (const char *args)
 Serial command entering multiline vCard paste mode.
static void vcardPrintLines (char *out)
 Prints a NUL-terminated vCard buffer line by line as CRLF output.
static void cmdVcardGet (const char *args)
 Serial command printing a stored vCard.
static void cmdVcardList (const char *args)
 Serial command listing received vCards as "<id> <display name>".
static void cmdVcardDelete (const char *args)
 Serial command deleting a stored vCard.
static void cmdVcard (const char *args)
static void registerSerialCommands ()
 Registers serial commands exposed by vCard module.
static bool importReceivedVcard (const cJSON *je, void *user)
 Imports one received vCard string into storage.
static char * fGiven (vcard_data_t *d)
static char * fFamily (vcard_data_t *d)
static char * fFn (vcard_data_t *d)
static char * fOrg (vcard_data_t *d)
static char * fTitle (vcard_data_t *d)
static char * fEmail (vcard_data_t *d)
static char * fCell (vcard_data_t *d)
static char * fHome (vcard_data_t *d)
static char * fWork (vcard_data_t *d)
static char * fUrl (vcard_data_t *d)
static char * fTele (vcard_data_t *d)
static char * fSig (vcard_data_t *d)
static char * fMatrix (vcard_data_t *d)
static char * fThreema (vcard_data_t *d)
static char * fSocial (vcard_data_t *d)
static char * fNote (vcard_data_t *d)
static const char * stepTitle (uint8_t step)
 Returns the localized title for a wizard step via its i18n key.
static void onStepSave (const char *text)
 Forward declaration of the single per-step save handler.
static void pushCurrentStep ()
 Pushes the T9 input view for the current wizard step. Prefills the input with the current field value (which may have been seeded from a pre-existing vCard in edit mode, or auto-suggested for FN).
static void wizardFinish ()
 Persists wizard data and returns to the anchor view on success.

Variables

constexpr ui::I18nEntry kStrings []
static const char *const s_wizardStepKeys [16]
static ui::ListView s_mainMenu
 View instances used by vCard module UI flow.
static bool s_viewsInitialized = false
static ui::ListItem s_mainMenuItems [MENU_COUNT] = {}
static ui::ListView s_receivedMenu
static bool s_receivedInitialized = false
static ui::ListItem s_recvItems [VCARD_MAX_CARDS]
static char s_recvLabels [VCARD_MAX_CARDS][64]
static uint16_t s_recvSlots [VCARD_MAX_CARDS]
static uint16_t s_recvCount = 0
static uint16_t s_activeSlot = 0
static char s_vcardBuf [VCARD_MAX_LEN+64]
static int s_vcardBufPos = 0
static bool s_vcardInputMode = false
static int s_vcardSetSlot = -1
static esp_timer_handle_t s_vcardIdleTimer = nullptr
static constexpr int64_t VCARD_IDLE_LIMIT_US = 30 * 1000000LL
static const serial::SubCommand kVcardSubs []
static constexpr int kSchemaVer = 1
 Schema version written to and expected from the vCard backup section.
static const FieldRef k_steps [STEP_COUNT]
 Step descriptor table. Step order is fixed at compile time. The maximum input length for each step is clamped to the smaller of the struct field size and the T9 input view's text limit.
static WizardState s_wizard = {}
static ui::T9InputView s_t9Input
static const char *const * s_titleKeys = nullptr
static const char * s_savedKey = nullptr
static const char * s_failedKey = nullptr

Enumeration Type Documentation

◆ MainMenuItem

Main-menu item identifiers.

Enumerator
MENU_MY_VCARD 
MENU_EDIT_MY_VCARD 
MENU_SEND 
MENU_RECEIVED 
MENU_COUNT 

Definition at line 99 of file VcardModule.cpp.

◆ WizardStepId

Step indices into the wizard's title offset table. Order must match s_steps[] below.

Enumerator
STEP_GIVEN 
STEP_FAMILY 
STEP_FORMATTED 
STEP_ORG 
STEP_TITLE 
STEP_EMAIL 
STEP_TEL_CELL 
STEP_TEL_HOME 
STEP_TEL_WORK 
STEP_URL 
STEP_TELEGRAM 
STEP_SIGNAL 
STEP_MATRIX 
STEP_THREEMA 
STEP_SOCIAL 
STEP_NOTE 
STEP_COUNT 

Definition at line 22 of file VcardWizard.cpp.

◆ WizardTarget

enum class cdc::mod_vcard::WizardTarget : uint8_t
strong

Save destination for the wizard's generated vCard.

Enumerator
OWN 

Persist via vcard_store_set_own().

RECEIVED_NEW 

Add a new stored contact.

RECEIVED_EDIT 

Overwrite the stored contact at editSlot.

Definition at line 94 of file VcardWizard.cpp.

Function Documentation

◆ cmdVcard()

void cdc::mod_vcard::cmdVcard ( const char * args)
static

Definition at line 702 of file VcardModule.cpp.

References cdc::serial::dispatchSubCommand(), and kVcardSubs.

Referenced by registerSerialCommands().

◆ cmdVcardDelete()

void cdc::mod_vcard::cmdVcardDelete ( const char * args)
static

Serial command deleting a stored vCard.

Without an argument it deletes the own card. With a numeric args it deletes the received card stored under that slot id (as listed by VCARD LIST).

Parameters
argsOptional received-card slot id.

Definition at line 673 of file VcardModule.cpp.

References VCARD_MAX_CARDS, vcard_store_clear_own(), and vcard_store_delete().

◆ cmdVcardGet()

void cdc::mod_vcard::cmdVcardGet ( const char * args)
static

Serial command printing a stored vCard.

Without an argument it prints the own card, or an empty 4.0 template if none is set. With a numeric args it prints the received card stored under that slot id (as listed by VCARD LIST).

Parameters
argsOptional received-card slot id.

Definition at line 603 of file VcardModule.cpp.

References VCARD_MAX_CARDS, VCARD_MAX_LEN, vcard_store_get(), vcard_store_get_own(), and vcardPrintLines().

◆ cmdVcardList()

void cdc::mod_vcard::cmdVcardList ( const char * args)
static

Serial command listing received vCards as "<id> <display name>".

Parameters
argsUnused command arguments.

Definition at line 648 of file VcardModule.cpp.

References name, VCARD_MAX_CARDS, vcard_store_get_display(), and vcard_store_get_sorted().

◆ cmdVcardSet()

void cdc::mod_vcard::cmdVcardSet ( const char * args)
static

Serial command entering multiline vCard paste mode.

Without an argument it sets the own card. With a numeric args it overwrites the received card stored under that slot id (as listed by VCARD LIST).

Parameters
argsOptional received-card slot id to overwrite.

Definition at line 554 of file VcardModule.cpp.

References cdc::serial::getCommandRegistry(), s_vcardBufPos, s_vcardInputMode, s_vcardSetSlot, cdc::serial::ICommandRegistry::setLineInterceptor(), vcard_arm_idle_timer(), VCARD_MAX_CARDS, vcard_store_get_display(), and vcardLineInterceptor().

◆ ctxReceivedAdd()

void cdc::mod_vcard::ctxReceivedAdd ( )
static

Context-menu action: create a new stored contact via the wizard.

Definition at line 331 of file VcardModule.cpp.

References rebuildReceivedList(), s_receivedMenu, and cdc::mod_vcard::VcardWizard::startReceived().

Referenced by onReceivedMenu().

◆ ctxReceivedDelete()

void cdc::mod_vcard::ctxReceivedDelete ( )
static

Context-menu action: confirm and delete the active contact.

Definition at line 374 of file VcardModule.cpp.

References onReceivedDeleteConfirm(), s_activeSlot, cdc::ui::showConfirm(), cdc::ui::tr(), and cdc::ui::ConfirmView::WARNING.

Referenced by onReceivedMenu(), and onReceivedViewMenu().

◆ ctxReceivedEdit()

void cdc::mod_vcard::ctxReceivedEdit ( )
static

Context-menu action: edit the active stored contact via the wizard.

Definition at line 336 of file VcardModule.cpp.

References cdc::mod_vcard::VcardWizard::editReceived(), rebuildReceivedList(), s_activeSlot, and s_receivedMenu.

Referenced by onReceivedMenu(), and onReceivedViewMenu().

◆ ctxReceivedForward()

void cdc::mod_vcard::ctxReceivedForward ( )
static

Context-menu action: forward the active contact to a nearby badge.

Definition at line 348 of file VcardModule.cpp.

References s_activeSlot, VCARD_MAX_LEN, and vcard_store_get().

Referenced by onReceivedMenu(), and onReceivedViewMenu().

◆ ctxReceivedQr()

void cdc::mod_vcard::ctxReceivedQr ( )
static

Context-menu action: show the active contact as a QR code.

Definition at line 341 of file VcardModule.cpp.

References s_activeSlot, showVcardQr(), cdc::ui::tr(), VCARD_MAX_LEN, and vcard_store_get().

Referenced by onReceivedViewMenu().

◆ deliverVcard()

bool cdc::mod_vcard::deliverVcard ( const uint8_t * data,
uint32_t len,
const char * ,
const char *  )
static

Delivers a received vCard into the contact store.

Invoked by the message-transfer framework after the user consented and the encrypted transfer completed. data is UNTRUSTED, attacker-controlled and not NUL-terminated; it is copied into a bounded buffer before parsing.

Returns
true if the vCard was accepted/stored.

Definition at line 134 of file VcardModule.cpp.

References LOG_W, TAG, VCARD_MAX_LEN, and vcard_store_add().

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

◆ fCell()

char * cdc::mod_vcard::fCell ( vcard_data_t * d)
static

Definition at line 56 of file VcardWizard.cpp.

References vcard_data_t::tel_cell.

◆ fEmail()

char * cdc::mod_vcard::fEmail ( vcard_data_t * d)
static

Definition at line 55 of file VcardWizard.cpp.

References vcard_data_t::email.

◆ fFamily()

char * cdc::mod_vcard::fFamily ( vcard_data_t * d)
static

Definition at line 51 of file VcardWizard.cpp.

References vcard_data_t::family_name.

◆ fFn()

char * cdc::mod_vcard::fFn ( vcard_data_t * d)
static

Definition at line 52 of file VcardWizard.cpp.

References vcard_data_t::formatted_name.

◆ fGiven()

char * cdc::mod_vcard::fGiven ( vcard_data_t * d)
static

Definition at line 50 of file VcardWizard.cpp.

References vcard_data_t::given_name.

◆ fHome()

char * cdc::mod_vcard::fHome ( vcard_data_t * d)
static

Definition at line 57 of file VcardWizard.cpp.

References vcard_data_t::tel_home.

◆ fMatrix()

char * cdc::mod_vcard::fMatrix ( vcard_data_t * d)
static

Definition at line 62 of file VcardWizard.cpp.

References vcard_data_t::impp_matrix.

◆ fNote()

char * cdc::mod_vcard::fNote ( vcard_data_t * d)
static

Definition at line 65 of file VcardWizard.cpp.

References vcard_data_t::note.

◆ fOrg()

char * cdc::mod_vcard::fOrg ( vcard_data_t * d)
static

Definition at line 53 of file VcardWizard.cpp.

References vcard_data_t::organization.

◆ fSig()

char * cdc::mod_vcard::fSig ( vcard_data_t * d)
static

Definition at line 61 of file VcardWizard.cpp.

References vcard_data_t::impp_signal.

◆ fSocial()

char * cdc::mod_vcard::fSocial ( vcard_data_t * d)
static

Definition at line 64 of file VcardWizard.cpp.

References vcard_data_t::social_profile.

◆ fTele()

char * cdc::mod_vcard::fTele ( vcard_data_t * d)
static

Definition at line 60 of file VcardWizard.cpp.

References vcard_data_t::impp_telegram.

◆ fThreema()

char * cdc::mod_vcard::fThreema ( vcard_data_t * d)
static

Definition at line 63 of file VcardWizard.cpp.

References vcard_data_t::impp_threema.

◆ fTitle()

char * cdc::mod_vcard::fTitle ( vcard_data_t * d)
static

Definition at line 54 of file VcardWizard.cpp.

References vcard_data_t::title.

◆ fUrl()

char * cdc::mod_vcard::fUrl ( vcard_data_t * d)
static

Definition at line 59 of file VcardWizard.cpp.

References vcard_data_t::url.

◆ fWork()

char * cdc::mod_vcard::fWork ( vcard_data_t * d)
static

Definition at line 58 of file VcardWizard.cpp.

References vcard_data_t::tel_work.

◆ getMyVcardLockscreenLabel()

const char * cdc::mod_vcard::getMyVcardLockscreenLabel ( )
static

Returns the localized label for the lock-screen quick action.

Definition at line 434 of file VcardModule.cpp.

References cdc::ui::tr().

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

◆ importReceivedVcard()

bool cdc::mod_vcard::importReceivedVcard ( const cJSON * je,
void * user )
static

Imports one received vCard string into storage.

The vCard's identity is its full text; the store deduplicates on exact text, so an already-present card counts as imported (no-op upsert). Genuine validation/storage failures return false to be tallied as failed.

Parameters
jeJSON array element (expected to be a string).
userUnused.
Returns
true if the card is present after the operation.

Definition at line 875 of file VcardModule.cpp.

References vcard_store_add(), and vcard_store_contains().

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

◆ onMainMenuSelect()

void cdc::mod_vcard::onMainMenuSelect ( uint16_t index,
void * userData )
static

Handles main-menu actions for local vCard operations and sharing.

Parameters
indexSelected menu index.
userDataOptional callback context (unused).

Definition at line 252 of file VcardModule.cpp.

References cdc::mod_vcard::VcardWizard::edit(), MENU_EDIT_MY_VCARD, MENU_MY_VCARD, MENU_RECEIVED, MENU_SEND, openReceivedList(), s_mainMenu, cdc::ui::showToastInfo(), showVcardDetails(), cdc::mod_vcard::VcardWizard::start(), cdc::ui::tr(), VCARD_MAX_LEN, vcard_store_get_own(), and vcard_store_has_own().

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

◆ onMyVcardLockscreenSelect()

void cdc::mod_vcard::onMyVcardLockscreenSelect ( )
static

Lock-screen quick action: shows the own vCard as a QR code. Falls back to a toast when no vCard has been configured yet.

Definition at line 442 of file VcardModule.cpp.

References cdc::ui::showToastError(), showVcardQr(), cdc::ui::tr(), VCARD_MAX_LEN, and vcard_store_get_own().

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

◆ onReceivedDeleteConfirm()

void cdc::mod_vcard::onReceivedDeleteConfirm ( void * userData)
static

Confirm-dialog handler: deletes the contact and refreshes the list.

Parameters
userDataPointer to the store slot to delete.

Definition at line 361 of file VcardModule.cpp.

References cdc::ui::ViewStack::instance(), cdc::ui::ViewStack::popToAnchor(), rebuildReceivedList(), s_receivedMenu, cdc::ui::showToastError(), cdc::ui::showToastSuccess(), cdc::ui::tr(), and vcard_store_delete().

Referenced by ctxReceivedDelete().

◆ onReceivedMenu()

void cdc::mod_vcard::onReceivedMenu ( uint16_t index,
void * userData )
static

List context menu (key 3): add a contact; for a selected entry also edit / forward / delete it.

Parameters
indexUnused on-screen position.
userDataEncoded store slot of the selected contact.

Definition at line 400 of file VcardModule.cpp.

References ctxReceivedAdd(), ctxReceivedDelete(), ctxReceivedEdit(), ctxReceivedForward(), s_activeSlot, s_recvCount, cdc::ui::showContextMenu(), and cdc::ui::tr().

Referenced by openReceivedList().

◆ onReceivedSelect()

void cdc::mod_vcard::onReceivedSelect ( uint16_t index,
void * userData )
static

Opens the detail view (with action menu) for the selected contact.

Parameters
indexUnused on-screen position.
userDataEncoded store slot of the selected contact.

Definition at line 322 of file VcardModule.cpp.

References s_activeSlot, showVcardDetails(), cdc::ui::tr(), VCARD_MAX_LEN, and vcard_store_get().

Referenced by openReceivedList().

◆ onReceivedViewMenu()

void cdc::mod_vcard::onReceivedViewMenu ( void * userData)
static

Detail-view context menu (key 3): edit / forward / QR / delete the currently shown contact.

Definition at line 383 of file VcardModule.cpp.

References ctxReceivedDelete(), ctxReceivedEdit(), ctxReceivedForward(), ctxReceivedQr(), cdc::ui::showContextMenu(), and cdc::ui::tr().

Referenced by showVcardDetails().

◆ onStepSave()

void cdc::mod_vcard::onStepSave ( const char * text)
static

Forward declaration of the single per-step save handler.

Per-step save handler. Copies the entered text into the matching struct field, advances to the next step, and finishes the wizard after the last step.

Definition at line 215 of file VcardWizard.cpp.

References cdc::mod_vcard::FieldRef::get, k_steps, cdc::mod_vcard::FieldRef::maxLen, pushCurrentStep(), s_wizard, STEP_COUNT, and wizardFinish().

Referenced by pushCurrentStep().

◆ openReceivedList()

void cdc::mod_vcard::openReceivedList ( )
static

Lazily wires callbacks, rebuilds and pushes the received-contacts list.

Definition at line 417 of file VcardModule.cpp.

References cdc::ui::ViewStack::instance(), onReceivedMenu(), onReceivedSelect(), cdc::ui::ViewStack::push(), rebuildReceivedList(), s_receivedInitialized, and s_receivedMenu.

Referenced by onMainMenuSelect().

◆ pushCurrentStep()

void cdc::mod_vcard::pushCurrentStep ( )
static

Pushes the T9 input view for the current wizard step. Prefills the input with the current field value (which may have been seeded from a pre-existing vCard in edit mode, or auto-suggested for FN).

Definition at line 138 of file VcardWizard.cpp.

References vcard_data_t::formatted_name, cdc::mod_vcard::FieldRef::get, cdc::ui::ViewStack::instance(), k_steps, cdc::ui::T9InputView::MAX_TEXT_LEN, cdc::mod_vcard::FieldRef::maxLen, onStepSave(), cdc::ui::ViewStack::push(), s_t9Input, s_wizard, STEP_COUNT, STEP_FORMATTED, and stepTitle().

Referenced by cdc::mod_vcard::VcardWizard::edit(), cdc::mod_vcard::VcardWizard::editReceived(), onStepSave(), cdc::mod_vcard::VcardWizard::start(), and cdc::mod_vcard::VcardWizard::startReceived().

◆ rebuildMainMenu()

void cdc::mod_vcard::rebuildMainMenu ( )
static

Rebuilds the vCard main menu.

Definition at line 239 of file VcardModule.cpp.

References MENU_COUNT, MENU_EDIT_MY_VCARD, MENU_MY_VCARD, MENU_RECEIVED, MENU_SEND, s_mainMenu, s_mainMenuItems, and cdc::ui::tr().

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

◆ rebuildReceivedList()

void cdc::mod_vcard::rebuildReceivedList ( )
static

Rebuilds the received-contacts list from the store (sorted by name).

Definition at line 303 of file VcardModule.cpp.

References s_receivedMenu, s_recvCount, s_recvItems, s_recvLabels, s_recvSlots, cdc::ui::tr(), VCARD_MAX_CARDS, vcard_store_get_display(), and vcard_store_get_sorted().

Referenced by ctxReceivedAdd(), ctxReceivedEdit(), onReceivedDeleteConfirm(), and openReceivedList().

◆ registerSerialCommands()

void cdc::mod_vcard::registerSerialCommands ( )
static

Registers serial commands exposed by vCard module.

Definition at line 709 of file VcardModule.cpp.

References cmdVcard(), cdc::serial::getCommandRegistry(), and kVcardSubs.

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

◆ registerStrings()

void cdc::mod_vcard::registerStrings ( )
static

◆ showVcardDetails()

void cdc::mod_vcard::showVcardDetails ( const char * title,
const char * raw,
bool withActions )
static

Renders a vCard's parsed fields into a scrollable InfoView.

Shows the display/full name as the first line, then one "<label>: <value>" line per non-empty field, reusing the editor field labels. Falls back to the raw text when nothing parses.

Parameters
titleView header title.
rawNUL-terminated vCard 4.0 text.
withActionsWhen true, key 3 opens the received-contact action menu.

Definition at line 158 of file VcardModule.cpp.

References cdc::ui::InfoView::init(), cdc::ui::ViewStack::instance(), cdc::ui::InfoView::MAX_TEXT_LEN, onReceivedViewMenu(), cdc::ui::ViewStack::push(), cdc::ui::InfoView::setOnMenu(), cdc::ui::tr(), and vcard_parse_to_struct().

Referenced by onMainMenuSelect(), and onReceivedSelect().

◆ showVcardQr()

void cdc::mod_vcard::showVcardQr ( const char * raw,
const char * fallbackTitle )
static

Shows a vCard as a QR code, titled with the contact name.

Parameters
rawNUL-terminated vCard text to encode.
fallbackTitleTitle used when the card carries no name.

Definition at line 210 of file VcardModule.cpp.

References cdc::ui::showQRCode(), and vcard_parse_to_struct().

Referenced by ctxReceivedQr(), and onMyVcardLockscreenSelect().

◆ stepTitle()

const char * cdc::mod_vcard::stepTitle ( uint8_t step)
static

Returns the localized title for a wizard step via its i18n key.

Definition at line 123 of file VcardWizard.cpp.

References s_titleKeys, STEP_COUNT, and cdc::ui::tr().

Referenced by pushCurrentStep().

◆ vcard_arm_idle_timer()

void cdc::mod_vcard::vcard_arm_idle_timer ( )
static

Definition at line 482 of file VcardModule.cpp.

References s_vcardIdleTimer, vcard_idle_fired(), and VCARD_IDLE_LIMIT_US.

Referenced by cmdVcardSet(), and vcardLineInterceptor().

◆ vcard_idle_fired()

void cdc::mod_vcard::vcard_idle_fired ( void * )
static

◆ vcard_session_clear()

◆ vcardLineInterceptor()

bool cdc::mod_vcard::vcardLineInterceptor ( const char * line)
static

Intercepts multiline vCard paste input, accumulates lines, and stops at "---".

Parameters
lineIncoming text line.
Returns
true to keep interception active, false to stop interception.

Definition at line 502 of file VcardModule.cpp.

References s_vcardBuf, s_vcardBufPos, s_vcardInputMode, s_vcardSetSlot, vcard_arm_idle_timer(), vcard_session_clear(), vcard_store_set_own(), and vcard_store_update().

Referenced by cmdVcardSet().

◆ vcardPrintLines()

void cdc::mod_vcard::vcardPrintLines ( char * out)
static

Prints a NUL-terminated vCard buffer line by line as CRLF output.

Parameters
outBuffer holding the vCard text; consumed in place.

Definition at line 581 of file VcardModule.cpp.

Referenced by cmdVcardGet().

◆ wizardFinish()

Variable Documentation

◆ k_steps

const FieldRef cdc::mod_vcard::k_steps[STEP_COUNT]
static
Initial value:
= {
{ fGiven, sizeof(vcard_data_t::given_name) - 1 },
{ fOrg, sizeof(vcard_data_t::organization) - 1 },
{ fTitle, sizeof(vcard_data_t::title) - 1 },
{ fEmail, sizeof(vcard_data_t::email) - 1 },
{ fCell, sizeof(vcard_data_t::tel_cell) - 1 },
{ fHome, sizeof(vcard_data_t::tel_home) - 1 },
{ fWork, sizeof(vcard_data_t::tel_work) - 1 },
{ fUrl, sizeof(vcard_data_t::url) - 1 },
{ fSig, sizeof(vcard_data_t::impp_signal) - 1 },
{ fNote, sizeof(vcard_data_t::note) - 1 },
}
static char * fCell(vcard_data_t *d)
static char * fOrg(vcard_data_t *d)
static char * fTele(vcard_data_t *d)
static char * fMatrix(vcard_data_t *d)
static char * fTitle(vcard_data_t *d)
static char * fGiven(vcard_data_t *d)
static char * fWork(vcard_data_t *d)
static char * fSocial(vcard_data_t *d)
static char * fFn(vcard_data_t *d)
static char * fUrl(vcard_data_t *d)
static char * fHome(vcard_data_t *d)
static char * fEmail(vcard_data_t *d)
static char * fNote(vcard_data_t *d)
static char * fSig(vcard_data_t *d)
static char * fFamily(vcard_data_t *d)
static char * fThreema(vcard_data_t *d)
char tel_cell[32]
Definition vcard_store.h:23
char family_name[48]
Definition vcard_store.h:17
char tel_work[32]
Definition vcard_store.h:24
char formatted_name[96]
Definition vcard_store.h:18
char title[64]
Definition vcard_store.h:20
char social_profile[128]
Definition vcard_store.h:30
char tel_home[32]
Definition vcard_store.h:22
char note[128]
Definition vcard_store.h:31
char email[96]
Definition vcard_store.h:21
char organization[64]
Definition vcard_store.h:19
char given_name[48]
Definition vcard_store.h:16
char url[128]
Definition vcard_store.h:25
char impp_signal[64]
Definition vcard_store.h:27
char impp_threema[32]
Definition vcard_store.h:29
char impp_telegram[64]
Definition vcard_store.h:26
char impp_matrix[96]
Definition vcard_store.h:28

Step descriptor table. Step order is fixed at compile time. The maximum input length for each step is clamped to the smaller of the struct field size and the T9 input view's text limit.

Definition at line 72 of file VcardWizard.cpp.

Referenced by onStepSave(), and pushCurrentStep().

◆ kSchemaVer

int cdc::mod_vcard::kSchemaVer = 1
staticconstexpr

Schema version written to and expected from the vCard backup section.

Definition at line 824 of file VcardModule.cpp.

Referenced by cdc::mod_vcard::VcardModule::exportBackup(), and cdc::mod_vcard::VcardModule::importBackup().

◆ kStrings

ui::I18nEntry cdc::mod_vcard::kStrings[]
constexpr

Definition at line 34 of file VcardModule.cpp.

Referenced by registerStrings().

◆ kVcardSubs

const serial::SubCommand cdc::mod_vcard::kVcardSubs[]
static
Initial value:
= {
{"SET", "[id]", "Set own vCard, or overwrite received vCard <id> (multiline paste, end with '---' or 'ABORT')", cmdVcardSet},
{"GET", "[id]", "Show own vCard, or received vCard <id>", cmdVcardGet},
{"LIST", "", "List received vCards", cmdVcardList},
{"DELETE", "[id]", "Delete own vCard, or received vCard <id>", cmdVcardDelete},
{nullptr, nullptr, nullptr, nullptr},
}
static void cmdVcardGet(const char *args)
Serial command printing a stored vCard.
static void cmdVcardDelete(const char *args)
Serial command deleting a stored vCard.
static void cmdVcardSet(const char *args)
Serial command entering multiline vCard paste mode.
static void cmdVcardList(const char *args)
Serial command listing received vCards as "<id> <display name>".

Definition at line 694 of file VcardModule.cpp.

Referenced by cmdVcard(), and registerSerialCommands().

◆ s_activeSlot

uint16_t cdc::mod_vcard::s_activeSlot = 0
static

◆ s_failedKey

const char* cdc::mod_vcard::s_failedKey = nullptr
static

Definition at line 118 of file VcardWizard.cpp.

Referenced by cdc::mod_vcard::VcardWizard::configure(), and wizardFinish().

◆ s_mainMenu

ui::ListView cdc::mod_vcard::s_mainMenu
static

View instances used by vCard module UI flow.

Definition at line 93 of file VcardModule.cpp.

Referenced by cdc::mod_vcard::VcardModule::getMenuItems(), onMainMenuSelect(), and rebuildMainMenu().

◆ s_mainMenuItems

ui::ListItem cdc::mod_vcard::s_mainMenuItems[MENU_COUNT] = {}
static

Definition at line 106 of file VcardModule.cpp.

Referenced by rebuildMainMenu().

◆ s_receivedInitialized

bool cdc::mod_vcard::s_receivedInitialized = false
static

Definition at line 110 of file VcardModule.cpp.

Referenced by openReceivedList().

◆ s_receivedMenu

ui::ListView cdc::mod_vcard::s_receivedMenu
static

◆ s_recvCount

uint16_t cdc::mod_vcard::s_recvCount = 0
static

Definition at line 114 of file VcardModule.cpp.

Referenced by onReceivedMenu(), and rebuildReceivedList().

◆ s_recvItems

ui::ListItem cdc::mod_vcard::s_recvItems[VCARD_MAX_CARDS]
static

Definition at line 111 of file VcardModule.cpp.

Referenced by rebuildReceivedList().

◆ s_recvLabels

char cdc::mod_vcard::s_recvLabels[VCARD_MAX_CARDS][64]
static

Definition at line 112 of file VcardModule.cpp.

Referenced by rebuildReceivedList().

◆ s_recvSlots

uint16_t cdc::mod_vcard::s_recvSlots[VCARD_MAX_CARDS]
static

Definition at line 113 of file VcardModule.cpp.

Referenced by rebuildReceivedList().

◆ s_savedKey

const char* cdc::mod_vcard::s_savedKey = nullptr
static

Definition at line 117 of file VcardWizard.cpp.

Referenced by cdc::mod_vcard::VcardWizard::configure(), and wizardFinish().

◆ s_t9Input

ui::T9InputView cdc::mod_vcard::s_t9Input
static

Definition at line 114 of file VcardWizard.cpp.

Referenced by pushCurrentStep().

◆ s_titleKeys

const char* const* cdc::mod_vcard::s_titleKeys = nullptr
static

Definition at line 116 of file VcardWizard.cpp.

Referenced by cdc::mod_vcard::VcardWizard::configure(), and stepTitle().

◆ s_vcardBuf

char cdc::mod_vcard::s_vcardBuf[VCARD_MAX_LEN+64]
static

Definition at line 456 of file VcardModule.cpp.

Referenced by vcard_session_clear(), and vcardLineInterceptor().

◆ s_vcardBufPos

int cdc::mod_vcard::s_vcardBufPos = 0
static

Definition at line 457 of file VcardModule.cpp.

Referenced by cmdVcardSet(), vcard_session_clear(), and vcardLineInterceptor().

◆ s_vcardIdleTimer

esp_timer_handle_t cdc::mod_vcard::s_vcardIdleTimer = nullptr
static

Definition at line 461 of file VcardModule.cpp.

Referenced by vcard_arm_idle_timer(), and vcard_session_clear().

◆ s_vcardInputMode

bool cdc::mod_vcard::s_vcardInputMode = false
static

◆ s_vcardSetSlot

int cdc::mod_vcard::s_vcardSetSlot = -1
static

Definition at line 460 of file VcardModule.cpp.

Referenced by cmdVcardSet(), vcard_session_clear(), and vcardLineInterceptor().

◆ s_viewsInitialized

bool cdc::mod_vcard::s_viewsInitialized = false
static

Definition at line 94 of file VcardModule.cpp.

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

◆ s_wizard

◆ s_wizardStepKeys

const char* const cdc::mod_vcard::s_wizardStepKeys[16]
static
Initial value:
= {
"mod_vcard.given_name", "mod_vcard.family_name", "mod_vcard.formatted_name",
"mod_vcard.organization", "mod_vcard.position", "mod_vcard.email",
"mod_vcard.tel_cell", "mod_vcard.tel_home", "mod_vcard.tel_work",
"mod_vcard.url", "mod_vcard.telegram", "core.signal",
"mod_vcard.matrix", "mod_vcard.threema", "mod_vcard.social_profile",
"mod_vcard.note",
}

Definition at line 77 of file VcardModule.cpp.

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

◆ VCARD_IDLE_LIMIT_US

int64_t cdc::mod_vcard::VCARD_IDLE_LIMIT_US = 30 * 1000000LL
staticconstexpr

Definition at line 464 of file VcardModule.cpp.

Referenced by vcard_arm_idle_timer().