14#include "esp_system.h"
15#include "freertos/FreeRTOS.h"
16#include "freertos/task.h"
17#include "soc/rtc_cntl_reg.h"
76 uint8_t index =
static_cast<uint8_t
>(
reinterpret_cast<uintptr_t
>(userData));
79 if (moduleReg.retryModule(index)) {
82 const char* error = moduleReg.getModuleSlotError(index);
99 if (index >= moduleReg.getModuleCount())
return;
104 uint8_t idx =
static_cast<uint8_t
>(index);
107 if (moduleReg.hasModuleSlotError(idx)) {
108 const char* error = moduleReg.getModuleSlotError(idx);
110 static char confirmMsg[128];
111 snprintf(confirmMsg,
sizeof(confirmMsg),
"%s\n%s",
112 error ? error :
ui::tr(
"core.module_error_generic"),
113 ui::tr(
"core.module_retry_prompt"));
124 bool nowEnabled = moduleReg.toggleModuleEnabled(idx);
127 if (!moduleReg.startModule(idx)) {
128 switch (moduleReg.classifyStartFailure(idx)) {
160 uint8_t count = moduleReg.getModuleCount();
171 moduleReg.getModuleStatusLabel(i));
238 power->enterShipMode();
283 uint8_t rawModules = moduleReg.getMenuItems(
289 for (uint8_t i = 0; i < rawModules; i++) {
291 if (item.isVisible && !item.isVisible())
continue;
318 vTaskDelay(pdMS_TO_TICKS(200));
319 REG_WRITE(RTC_CNTL_OPTION1_REG, RTC_CNTL_FORCE_DOWNLOAD_BOOT);
321 while (
true) { vTaskDelay(portMAX_DELAY); }
337 configMAX_PRIORITIES - 1,
nullptr);
357 IView* view = item.getView();
379 uint8_t index =
static_cast<uint8_t
>(evt.
data.
value);
381 if (index >= moduleReg.getModuleCount())
return;
383 const char* error = moduleReg.getModuleSlotError(index);
385 const char*
name =
module ? module->getName() : "?";
387 static char errMsg[96];
388 snprintf(errMsg,
sizeof(errMsg),
"%s: %s",
name, error ? error :
"Fehler");
char name[cdc::hal::ISecureElement::RMEM_NAME_LEN]
Module interface that extends IService with module-specific features.
virtual ServiceState getState() const =0
virtual const char * getName() const =0
static ModuleRegistry & instance()
Returns the singleton module registry instance.
bool rebuild()
Rebuilds cache contents from secure-element R-MEM without verbose logging.
static TropicStorage & instance()
Returns singleton instance of TROPIC metadata cache manager.
bool cleanup()
Removes cache entries and chip records that violate slot/module mapping.
static UsbManager & instance()
Returns singleton USB manager instance.
static ViewStack & instance()
Returns singleton view-stack instance.
void push(IView *view, void *context=nullptr)
@ UsbBudgetFull
HID interface budget is exhausted.
@ Generic
Start failed for an unspecified reason.
@ SlotError
Module reported a slot-map error.
IPowerManager * getPowerManagerInstance()
Returns the singleton power manager instance.
Centralized key-code constants for cdc_views.
const char * tr(const char *key)
Look up a translation by string key.
static void onModuleSelect(uint16_t index, void *userData)
Handles module list selection for retry/toggle behavior.
static const FixedExpertEntry kExpertTop[]
static void onModuleRetryConfirm(void *userData)
Retries failed module initialization after user confirmation.
static ListItem s_expertItems[EXPERT_MAX_ITEMS]
void showDuressPinSetup()
Opens the duress / self-destruct PIN setup wizard.
static ListView * s_modulesView
static constexpr uint8_t EXPERT_FIXED_COUNT
void prepareForBootloaderReset()
Puts the badge into a quiet pre-reset state.
static void onExpertMenuSelect(uint16_t index, void *userData)
Handles expert menu selection actions.
static constexpr uint32_t TOAST_DURATION_LONG_MS
static constexpr uint8_t EXPERT_MAX_ITEMS
Expert menu sizing constants.
static void runTropicCacheCleanup()
Cleans cached TROPIC metadata and reports operation result.
static constexpr uint8_t EXPERT_BOTTOM_COUNT
void showToastTask(const char *message, uint16_t durationMs=0)
Shows a task/progress toast message.
void ui_rebuild_menus()
Rebuilds dynamic UI menus.
void rebootIntoBootloader()
Reboots the device into USB download (bootloader) mode.
static core::ModuleMenuItem s_expertModuleItems[EXPERT_MAX_ITEMS - EXPERT_FIXED_COUNT]
static constexpr uint8_t MODULES_VIEW_MAX
static constexpr uint32_t TOAST_DURATION_MEDIUM_MS
void showModulesView()
Shows module management list view.
void onModuleErrorEvent(const core::Event &evt)
Displays toast notification for module error events.
static void onShipModeConfirm(void *)
Disconnects the battery (ship mode) after user confirmation.
void showToastAlertSticky(const char *message)
Shows a non-dismissible alert toast.
static const FixedExpertEntry kExpertBottom[]
void showExpertMenu()
Shows expert menu and initial warning toast.
static ListItem s_modulesItems[MODULES_VIEW_MAX]
static constexpr uint8_t EXPERT_TOP_COUNT
static ListView * s_expertMenu
Static view pointers and menu item storage for expert/module views.
static void bootloaderResetTask(void *)
Worker that detaches USB, arms the download-boot bit and triggers a hard system reset.
void showConfirm(const char *message, ConfirmView::ConfirmCallback onConfirm, ConfirmView::CancelCallback onCancel=nullptr, ConfirmView::Icon icon=ConfirmView::Icon::QUESTION, void *userData=nullptr)
Shows a shared modal confirmation dialog instance.
static uint8_t s_expertModuleCount
static void runTropicCacheRebuild()
Rebuilds cached TROPIC metadata and reports operation result.
void showToastSuccess(const char *message, uint16_t durationMs=1500)
Shows a success toast message.
static void runSystemTest()
Opens hardware information/system-test screen.
static constexpr uint32_t TOAST_DURATION_SHORT_MS
static void rebuildExpertMenu()
Rebuilds expert menu item list including module-provided entries.
void showToastInfo(const char *message, uint16_t durationMs=1500)
Shows an informational toast message.
static void enterShipModeMenu()
Prompts to confirm ship-mode entry from the expert menu.
void showToastError(const char *message, uint16_t durationMs=1500)
Shows an error toast message.
static void rebuildModulesView()
Rebuilds module status list view content.
static char s_moduleLabels[MODULES_VIEW_MAX][48]
void showHardwareInfo()
Opens hardware info screen using shared info view.
void showBackupMenu()
Shows the Backup submenu (Export / Import / Delete).
union cdc::core::Event::@234350273243204124075032151001065005273232113040 data