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 const char * mstr (uint16_t offset)
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 the configured resolver.
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 constexpr uint16_t STR_VCARD = 0
static constexpr uint16_t STR_MY_VCARD = 1
static constexpr uint16_t STR_NEARBY = 2
static constexpr uint16_t STR_SCAN = 3
static constexpr uint16_t STR_STOP_SCAN = 4
static constexpr uint16_t STR_ADVERTISING = 5
static constexpr uint16_t STR_STOP_ADV = 6
static constexpr uint16_t STR_EXCHANGE = 7
static constexpr uint16_t STR_NO_PEERS = 8
static constexpr uint16_t STR_SCANNING = 9
static constexpr uint16_t STR_EXCHANGE_REQ = 10
static constexpr uint16_t STR_ACCEPT = 11
static constexpr uint16_t STR_DECLINE = 12
static constexpr uint16_t STR_EXCHANGE_OK = 13
static constexpr uint16_t STR_EXCHANGE_FAIL = 14
static constexpr uint16_t STR_CONNECTING = 15
static constexpr uint16_t STR_EDIT_MY_VCARD = 16
static constexpr uint16_t STR_NO_VCARD = 17
static constexpr uint16_t STR_SAVED = 18
static constexpr uint16_t STR_GIVEN_NAME = 19
static constexpr uint16_t STR_FAMILY_NAME = 20
static constexpr uint16_t STR_FORMATTED_NAME = 21
static constexpr uint16_t STR_ORGANIZATION = 22
static constexpr uint16_t STR_POSITION = 23
static constexpr uint16_t STR_EMAIL = 24
static constexpr uint16_t STR_TEL_CELL = 25
static constexpr uint16_t STR_TEL_HOME = 26
static constexpr uint16_t STR_TEL_WORK = 27
static constexpr uint16_t STR_URL = 28
static constexpr uint16_t STR_TELEGRAM = 29
static constexpr uint16_t STR_SIGNAL = 30
static constexpr uint16_t STR_MATRIX = 31
static constexpr uint16_t STR_THREEMA = 32
static constexpr uint16_t STR_SOCIAL_PROFILE = 33
static constexpr uint16_t STR_NOTE = 34
static constexpr uint16_t STR_SEND = 35
static constexpr uint16_t STR_RECEIVED = 36
static constexpr uint16_t STR_RECEIVED_TITLE = 37
static constexpr uint16_t STR_NO_RECEIVED = 38
static constexpr uint16_t STR_SHOW_QR = 39
static constexpr uint16_t STR_FORWARD = 40
static constexpr uint16_t STR_CONFIRM_DELETE = 41
static const uint16_t s_wizardStepOffsets [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 VcardWizard::StringResolver s_resolver = nullptr
static const uint16_t * s_titleOffsets = nullptr
static uint16_t s_savedOffset = 0
static uint16_t s_failedOffset = 0

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 148 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 751 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 722 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 652 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 697 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 603 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 380 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 423 of file VcardModule.cpp.

References mstr(), onReceivedDeleteConfirm(), s_activeSlot, cdc::ui::showConfirm(), STR_CONFIRM_DELETE, 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 385 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 397 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 390 of file VcardModule.cpp.

References mstr(), s_activeSlot, showVcardQr(), STR_RECEIVED_TITLE, 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 183 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 483 of file VcardModule.cpp.

References mstr(), and STR_MY_VCARD.

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 924 of file VcardModule.cpp.

References vcard_store_add(), and vcard_store_contains().

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

◆ mstr()

◆ 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 301 of file VcardModule.cpp.

References cdc::mod_vcard::VcardWizard::edit(), MENU_EDIT_MY_VCARD, MENU_MY_VCARD, MENU_RECEIVED, MENU_SEND, mstr(), openReceivedList(), s_mainMenu, cdc::ui::showToastInfo(), showVcardDetails(), cdc::mod_vcard::VcardWizard::start(), STR_MY_VCARD, STR_NO_VCARD, 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 491 of file VcardModule.cpp.

References mstr(), cdc::ui::showToastError(), showVcardQr(), STR_MY_VCARD, STR_NO_VCARD, 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 410 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 449 of file VcardModule.cpp.

References ctxReceivedAdd(), ctxReceivedDelete(), ctxReceivedEdit(), ctxReceivedForward(), mstr(), s_activeSlot, s_recvCount, cdc::ui::showContextMenu(), STR_FORWARD, 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 371 of file VcardModule.cpp.

References mstr(), s_activeSlot, showVcardDetails(), STR_RECEIVED_TITLE, 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 432 of file VcardModule.cpp.

References ctxReceivedDelete(), ctxReceivedEdit(), ctxReceivedForward(), ctxReceivedQr(), mstr(), cdc::ui::showContextMenu(), STR_FORWARD, STR_SHOW_QR, 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 219 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 466 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 139 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

◆ rebuildReceivedList()

void cdc::mod_vcard::rebuildReceivedList ( )
static

◆ registerSerialCommands()

void cdc::mod_vcard::registerSerialCommands ( )
static

Registers serial commands exposed by vCard module.

Definition at line 758 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 207 of file VcardModule.cpp.

References cdc::ui::InfoView::init(), cdc::ui::ViewStack::instance(), cdc::ui::InfoView::MAX_TEXT_LEN, mstr(), onReceivedViewMenu(), cdc::ui::ViewStack::push(), cdc::ui::InfoView::setOnMenu(), STR_EMAIL, STR_MATRIX, STR_NOTE, STR_ORGANIZATION, STR_POSITION, STR_SIGNAL, STR_SOCIAL_PROFILE, STR_TEL_CELL, STR_TEL_HOME, STR_TEL_WORK, STR_TELEGRAM, STR_THREEMA, STR_URL, 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 259 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 the configured resolver.

Definition at line 124 of file VcardWizard.cpp.

References s_resolver, s_titleOffsets, and STEP_COUNT.

Referenced by pushCurrentStep().

◆ vcard_arm_idle_timer()

void cdc::mod_vcard::vcard_arm_idle_timer ( )
static

Definition at line 531 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 551 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 630 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 873 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 mstr(), and 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 743 of file VcardModule.cpp.

Referenced by cmdVcard(), and registerSerialCommands().

◆ s_activeSlot

uint16_t cdc::mod_vcard::s_activeSlot = 0
static

◆ s_failedOffset

uint16_t cdc::mod_vcard::s_failedOffset = 0
static

Definition at line 119 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 142 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 155 of file VcardModule.cpp.

Referenced by rebuildMainMenu().

◆ s_receivedInitialized

bool cdc::mod_vcard::s_receivedInitialized = false
static

Definition at line 159 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 163 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 160 of file VcardModule.cpp.

Referenced by rebuildReceivedList().

◆ s_recvLabels

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

Definition at line 161 of file VcardModule.cpp.

Referenced by rebuildReceivedList().

◆ s_recvSlots

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

Definition at line 162 of file VcardModule.cpp.

Referenced by rebuildReceivedList().

◆ s_resolver

VcardWizard::StringResolver cdc::mod_vcard::s_resolver = nullptr
static

◆ s_savedOffset

uint16_t cdc::mod_vcard::s_savedOffset = 0
static

Definition at line 118 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_titleOffsets

const uint16_t* cdc::mod_vcard::s_titleOffsets = nullptr
static

Definition at line 117 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 505 of file VcardModule.cpp.

Referenced by vcard_session_clear(), and vcardLineInterceptor().

◆ s_vcardBufPos

int cdc::mod_vcard::s_vcardBufPos = 0
static

Definition at line 506 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 510 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 509 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 143 of file VcardModule.cpp.

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

◆ s_wizard

◆ s_wizardStepOffsets

const uint16_t cdc::mod_vcard::s_wizardStepOffsets[16]
static
Initial value:
= {
}
static constexpr uint16_t STR_SOCIAL_PROFILE
static constexpr uint16_t STR_URL
static constexpr uint16_t STR_SIGNAL
static constexpr uint16_t STR_NOTE
static constexpr uint16_t STR_THREEMA
static constexpr uint16_t STR_TEL_HOME
static constexpr uint16_t STR_TEL_WORK
static constexpr uint16_t STR_EMAIL
static constexpr uint16_t STR_POSITION
static constexpr uint16_t STR_TEL_CELL
static constexpr uint16_t STR_ORGANIZATION
static constexpr uint16_t STR_TELEGRAM
static constexpr uint16_t STR_GIVEN_NAME
static constexpr uint16_t STR_MATRIX
static constexpr uint16_t STR_FAMILY_NAME
static constexpr uint16_t STR_FORMATTED_NAME

Definition at line 123 of file VcardModule.cpp.

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

◆ STR_ACCEPT

uint16_t cdc::mod_vcard::STR_ACCEPT = 11
staticconstexpr

Definition at line 91 of file VcardModule.cpp.

◆ STR_ADVERTISING

uint16_t cdc::mod_vcard::STR_ADVERTISING = 5
staticconstexpr

Definition at line 85 of file VcardModule.cpp.

◆ STR_CONFIRM_DELETE

uint16_t cdc::mod_vcard::STR_CONFIRM_DELETE = 41
staticconstexpr

Definition at line 121 of file VcardModule.cpp.

Referenced by ctxReceivedDelete().

◆ STR_CONNECTING

uint16_t cdc::mod_vcard::STR_CONNECTING = 15
staticconstexpr

Definition at line 95 of file VcardModule.cpp.

◆ STR_DECLINE

uint16_t cdc::mod_vcard::STR_DECLINE = 12
staticconstexpr

Definition at line 92 of file VcardModule.cpp.

◆ STR_EDIT_MY_VCARD

uint16_t cdc::mod_vcard::STR_EDIT_MY_VCARD = 16
staticconstexpr

Definition at line 96 of file VcardModule.cpp.

Referenced by rebuildMainMenu().

◆ STR_EMAIL

uint16_t cdc::mod_vcard::STR_EMAIL = 24
staticconstexpr

Definition at line 104 of file VcardModule.cpp.

Referenced by showVcardDetails().

◆ STR_EXCHANGE

uint16_t cdc::mod_vcard::STR_EXCHANGE = 7
staticconstexpr

Definition at line 87 of file VcardModule.cpp.

◆ STR_EXCHANGE_FAIL

uint16_t cdc::mod_vcard::STR_EXCHANGE_FAIL = 14
staticconstexpr

Definition at line 94 of file VcardModule.cpp.

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

◆ STR_EXCHANGE_OK

uint16_t cdc::mod_vcard::STR_EXCHANGE_OK = 13
staticconstexpr

Definition at line 93 of file VcardModule.cpp.

◆ STR_EXCHANGE_REQ

uint16_t cdc::mod_vcard::STR_EXCHANGE_REQ = 10
staticconstexpr

Definition at line 90 of file VcardModule.cpp.

◆ STR_FAMILY_NAME

uint16_t cdc::mod_vcard::STR_FAMILY_NAME = 20
staticconstexpr

Definition at line 100 of file VcardModule.cpp.

◆ STR_FORMATTED_NAME

uint16_t cdc::mod_vcard::STR_FORMATTED_NAME = 21
staticconstexpr

Definition at line 101 of file VcardModule.cpp.

◆ STR_FORWARD

uint16_t cdc::mod_vcard::STR_FORWARD = 40
staticconstexpr

Definition at line 120 of file VcardModule.cpp.

Referenced by onReceivedMenu(), and onReceivedViewMenu().

◆ STR_GIVEN_NAME

uint16_t cdc::mod_vcard::STR_GIVEN_NAME = 19
staticconstexpr

Definition at line 99 of file VcardModule.cpp.

◆ STR_MATRIX

uint16_t cdc::mod_vcard::STR_MATRIX = 31
staticconstexpr

Definition at line 111 of file VcardModule.cpp.

Referenced by showVcardDetails().

◆ STR_MY_VCARD

uint16_t cdc::mod_vcard::STR_MY_VCARD = 1
staticconstexpr

◆ STR_NEARBY

uint16_t cdc::mod_vcard::STR_NEARBY = 2
staticconstexpr

Definition at line 82 of file VcardModule.cpp.

◆ STR_NO_PEERS

uint16_t cdc::mod_vcard::STR_NO_PEERS = 8
staticconstexpr

Definition at line 88 of file VcardModule.cpp.

◆ STR_NO_RECEIVED

uint16_t cdc::mod_vcard::STR_NO_RECEIVED = 38
staticconstexpr

Definition at line 118 of file VcardModule.cpp.

Referenced by rebuildReceivedList().

◆ STR_NO_VCARD

uint16_t cdc::mod_vcard::STR_NO_VCARD = 17
staticconstexpr

Definition at line 97 of file VcardModule.cpp.

Referenced by onMainMenuSelect(), and onMyVcardLockscreenSelect().

◆ STR_NOTE

uint16_t cdc::mod_vcard::STR_NOTE = 34
staticconstexpr

Definition at line 114 of file VcardModule.cpp.

Referenced by showVcardDetails().

◆ STR_ORGANIZATION

uint16_t cdc::mod_vcard::STR_ORGANIZATION = 22
staticconstexpr

Definition at line 102 of file VcardModule.cpp.

Referenced by showVcardDetails().

◆ STR_POSITION

uint16_t cdc::mod_vcard::STR_POSITION = 23
staticconstexpr

Definition at line 103 of file VcardModule.cpp.

Referenced by showVcardDetails().

◆ STR_RECEIVED

uint16_t cdc::mod_vcard::STR_RECEIVED = 36
staticconstexpr

Definition at line 116 of file VcardModule.cpp.

◆ STR_RECEIVED_TITLE

uint16_t cdc::mod_vcard::STR_RECEIVED_TITLE = 37
staticconstexpr

◆ STR_SAVED

uint16_t cdc::mod_vcard::STR_SAVED = 18
staticconstexpr

Definition at line 98 of file VcardModule.cpp.

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

◆ STR_SCAN

uint16_t cdc::mod_vcard::STR_SCAN = 3
staticconstexpr

Definition at line 83 of file VcardModule.cpp.

◆ STR_SCANNING

uint16_t cdc::mod_vcard::STR_SCANNING = 9
staticconstexpr

Definition at line 89 of file VcardModule.cpp.

◆ STR_SEND

uint16_t cdc::mod_vcard::STR_SEND = 35
staticconstexpr

Definition at line 115 of file VcardModule.cpp.

Referenced by rebuildMainMenu().

◆ STR_SHOW_QR

uint16_t cdc::mod_vcard::STR_SHOW_QR = 39
staticconstexpr

Definition at line 119 of file VcardModule.cpp.

Referenced by onReceivedViewMenu().

◆ STR_SIGNAL

uint16_t cdc::mod_vcard::STR_SIGNAL = 30
staticconstexpr

Definition at line 110 of file VcardModule.cpp.

Referenced by showVcardDetails().

◆ STR_SOCIAL_PROFILE

uint16_t cdc::mod_vcard::STR_SOCIAL_PROFILE = 33
staticconstexpr

Definition at line 113 of file VcardModule.cpp.

Referenced by showVcardDetails().

◆ STR_STOP_ADV

uint16_t cdc::mod_vcard::STR_STOP_ADV = 6
staticconstexpr

Definition at line 86 of file VcardModule.cpp.

◆ STR_STOP_SCAN

uint16_t cdc::mod_vcard::STR_STOP_SCAN = 4
staticconstexpr

Definition at line 84 of file VcardModule.cpp.

◆ STR_TEL_CELL

uint16_t cdc::mod_vcard::STR_TEL_CELL = 25
staticconstexpr

Definition at line 105 of file VcardModule.cpp.

Referenced by showVcardDetails().

◆ STR_TEL_HOME

uint16_t cdc::mod_vcard::STR_TEL_HOME = 26
staticconstexpr

Definition at line 106 of file VcardModule.cpp.

Referenced by showVcardDetails().

◆ STR_TEL_WORK

uint16_t cdc::mod_vcard::STR_TEL_WORK = 27
staticconstexpr

Definition at line 107 of file VcardModule.cpp.

Referenced by showVcardDetails().

◆ STR_TELEGRAM

uint16_t cdc::mod_vcard::STR_TELEGRAM = 29
staticconstexpr

Definition at line 109 of file VcardModule.cpp.

Referenced by showVcardDetails().

◆ STR_THREEMA

uint16_t cdc::mod_vcard::STR_THREEMA = 32
staticconstexpr

Definition at line 112 of file VcardModule.cpp.

Referenced by showVcardDetails().

◆ STR_URL

uint16_t cdc::mod_vcard::STR_URL = 28
staticconstexpr

Definition at line 108 of file VcardModule.cpp.

Referenced by showVcardDetails().

◆ STR_VCARD

uint16_t cdc::mod_vcard::STR_VCARD = 0
staticconstexpr

Definition at line 80 of file VcardModule.cpp.

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

◆ VCARD_IDLE_LIMIT_US

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

Definition at line 513 of file VcardModule.cpp.

Referenced by vcard_arm_idle_timer().