Settings App

[中文]

Overview

brookesia_app_settings provides device and system settings screens for products built with System Super.

Core Responsibilities

  • Organizes settings by screens such as home, Wi-Fi, sound, display, language, time zone, and more.

  • Uses service helpers for Wi-Fi, device, audio, display, and storage state.

  • Loads localized names and messages from app package i18n resources.

Integration Position

This component is an independent ESP-Brookesia release component. It can be integrated through ESP-IDF component dependencies and combined with peer framework components as needed.

API Reference

Header File

Classes

class SettingsApp : public esp_brookesia::system::core::IApp

Built-in settings application for device, display, sound, Wi-Fi, language, and theme controls.

Public Functions

SettingsApp()

Create a settings application instance.

~SettingsApp() override

Destroy the settings application instance.

virtual system::core::AppManifest get_manifest() const override

Get the static metadata used to identify and present the application.

Returns

Application manifest containing id, name, version, and launch metadata.

virtual system::core::AppGuiDescriptor get_gui_descriptor() const override

Get the optional GUI resource descriptor for applications with a visual surface.

Returns

GUI descriptor; the default descriptor is empty for non-visual apps.

virtual std::span<const std::byte> gui_bundle() const override

Compiled GSP deployable bytes when the GUI descriptor root is GspBundle.

The returned bytes must stay valid until the app is uninstalled. Core copies them into a Bundle and keeps that copy until the GSP session stops.

virtual const void *gui_runtime_config() const override

Optional generated esp_gsp_config_t for an embedded GSP bundle.

Core uses this when the GUI root is a GSP bundle. The config and all referenced data must remain valid for the lifetime of the app object. Core retains the app until any deferred GSP cleanup has completed.

virtual std::expected<void, std::string> on_install(system::core::AppContext &context) override

Called when the application package is installed into the system.

Parameters

context -- System context for package storage and service access.

Returns

Empty result on success, or an error string.

virtual void on_uninstall(system::core::AppContext &context) override

Called before the application package is removed from the system.

Parameters

context -- System context for cleanup operations.

virtual std::expected<void, std::string> on_start(system::core::AppContext &context) override

Called when the application is started.

Parameters

context -- Runtime context for GUI, timers, storage, and services.

Returns

Empty result on success, or an error string that aborts startup.

virtual std::expected<void, std::string> on_stop(system::core::AppContext &context) override

Called when the application is stopped.

Parameters

context -- Runtime context for releasing app resources.

Returns

Empty result on success, or an error string.

virtual std::expected<void, std::string> on_pause(system::core::AppContext &context) override

Called when the application should suspend active work.

Parameters

context -- Runtime context for the running application.

Returns

Empty result on success, or an error string.

virtual std::expected<void, std::string> on_resume(system::core::AppContext &context) override

Called when the application should resume after a pause.

Parameters

context -- Runtime context for the running application.

Returns

Empty result on success, or an error string.

virtual std::expected<void, std::string> on_action(system::core::AppContext &context, std::string_view action) override

Handle an action emitted by the application GUI or shell.

Parameters
  • context -- Runtime context for the running application.

  • action -- Action identifier registered by the application GUI.

Returns

Empty result on success, or an error string.

virtual std::expected<void, std::string> on_timer(system::core::AppContext &context, system::core::TimerId timer_id, std::string_view name) override

Handle a timer event previously scheduled through the app context.

Parameters
  • context -- Runtime context for the running application.

  • timer_id -- Runtime timer identifier.

  • name -- Application-defined timer name.

Returns

Empty result on success, or an error string.

class SettingsAppProvider : public esp_brookesia::system::core::IAppProvider

Public Functions

virtual system::core::AppManifest get_manifest() const override

Get the manifest for the built-in settings app.

Returns

Settings application manifest.

virtual std::shared_ptr<system::core::IApp> create_app() override

Create a settings application instance.

Returns

Shared application instance.