47 s_pluginToast.
init(cp.c_str(), toIcon(icon), duration_ms,
true);
64 info->init(cpTitle.c_str(), cpBody.c_str());
79 std::string src(
reinterpret_cast<const char*
>(data), len);
Optional HTML-rendering hook, decoupling HTML producers from consumers.
Discovers, loads, runs and unloads WASM plugins on the badge.
static PluginManager & instance() noexcept
uint8_t pluginBaseDepth() const noexcept
void init(const char *message, Icon icon=Icon::NONE, uint16_t durationMs=1500, bool dismissible=true)
Initializes toast message content and timing behavior.
void popToDepth(uint8_t targetDepth)
Pops views until the stack depth is at most targetDepth.
void render(bool synchronous=false)
Render current view (and modal if present) and flush to display.
static ViewStack & instance()
Returns singleton view-stack instance.
void showModal(IView *modal)
void push(IView *view, void *context=nullptr)
int host_ui_pop(void)
Pop the topmost view.
int host_ui_repaint(void)
Force a repaint of the current view.
int host_ui_push_message(const char *text, uint8_t icon, uint32_t duration_ms)
Show a blocking message view that auto-dismisses after duration_ms.
int host_ui_view_markdown(const uint8_t *data, uint32_t len)
Render and show Markdown from an in-memory (UTF-8) buffer. No capability required; the buffer is boun...
int host_ui_push_info(const char *title, const char *body)
Show a scrollable info screen with title and body.
int host_ui_push_toast(const char *text, uint8_t icon, uint16_t duration_ms)
Show a transient toast overlay.
int host_ui_pop_to_plugin(void)
Pop back to the plugin's first view.
int host_ui_view_image(const uint8_t *data, uint32_t len)
Decode and show an image (PNG/JPEG) from an in-memory buffer, dithered. No capability required; the b...
int host_ui_wink(uint8_t count, uint16_t period_ms)
Blink the backlight as a visual identification signal.
int host_browser_open(const char *url)
Open a URL in the badge browser (enters the browser and loads it). No capability required.
CDC Badge OS plugin host API - canonical C ABI contract.
#define HOST_ERR_NOT_SUPPORTED
#define HOST_ERR_INVALID_ARG
Internal UTF-8 <-> CP437 helpers for the plugin host API boundary.
void winkBacklight(uint8_t count=2, uint16_t period_ms=150)
Blink the backlight as a visual "look at me" signal.
std::string toDisplay(const char *utf8)
Decode a UTF-8 (with optional HTML entities) string into CP437 bytes.
MarkdownView * showMarkdown(const char *title, const char *src, size_t len)
Parses and shows a Markdown source on the view stack.
void(*)(const char *url) UrlOpenerFn
Open a URL in the browser (enters the browser and loads it). url is UTF-8.
UrlOpenerFn urlOpener()
Current URL opener, or nullptr when none is registered.
ImageView * showImage(const char *title, const uint8_t *data, size_t len)
Decodes and shows an image on the view stack.