CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
host_api_ext_feature.cpp File Reference

External-feature host API: one plugin invokes a named feature provided by another installed plugin ("Open with" semantics). More...

#include "plugin_manager/host_api.h"
#include "plugin_manager/ExtFeatureName.h"
#include "plugin_manager/Plugin.h"
#include "plugin_manager/PluginManager.h"
#include "cdc_views/MessageBox.h"
#include "cdc_ui/I18n.h"
#include "cdc_log.h"
#include "esp_heap_caps.h"
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include <cstring>
#include <string>

Go to the source code of this file.

Functions

void * plg_get_active_plugin (void)
int host_ext_feature_available (const char *feature)
 Check whether an installed plugin provides feature.
int host_ext_feature_use (const char *feature, const uint8_t *data, size_t len, uint32_t status_action_id)
 Invoke feature with a payload; the provider runs in the foreground.
int host_ext_feature_register_handler (const char *feature, uint32_t action_id)
 Register this plugin as the live handler for a feature it provides.
int host_ext_feature_consume (uint8_t *buf, size_t buf_size, char *feature_out, size_t feature_size)
 Pull the payload of the job that fired the current handler action.
int host_ext_feature_result (int32_t status_code)
 Report the outcome of the job this provider is currently handling.
void plg_ext_feature_pump (void)
void plg_ext_feature_on_unload (void *plugin)

Detailed Description

External-feature host API: one plugin invokes a named feature provided by another installed plugin ("Open with" semantics).

Threading mirrors host_api_msg.cpp. host_ext_feature_use runs inside the caller's WASM frame and only stashes the job (it must never start the provider inline - startPlugin would tear down the executing caller instance). plg_ext_feature_pump() runs on the plugin tick task, switches the provider to the foreground and fires its handler action; the payload is consumable for that dispatch only. The provider later reports the outcome via host_ext_feature_result, which routes the status back to the caller as an action - if the caller is still loaded.

All state below is touched from WASM frames (tick task or UI dispatch) and the pump; a single mutex keeps the job slot consistent across those paths.

Definition in file host_api_ext_feature.cpp.

Function Documentation

◆ plg_ext_feature_on_unload()

void plg_ext_feature_on_unload ( void * plugin)

Definition at line 295 of file host_api_ext_feature.cpp.

References HOST_EXT_FEATURE_STATUS_ERROR.

◆ plg_ext_feature_pump()

◆ plg_get_active_plugin()

void * plg_get_active_plugin ( void )