设置应用

[English]

概述

brookesia_app_settings 为基于 System Super 的产品提供设备与系统设置页面。

核心职责

  • 按主页、Wi-Fi、声音、显示、语言、时区等页面组织设置。

  • 通过服务辅助接口读取 Wi-Fi、设备、音频、显示和存储状态。

  • 从应用包 i18n 资源加载本地化名称和提示。

集成位置

该组件是 ESP-Brookesia 发布组件清单中的独立组件,可通过 ESP-IDF 组件依赖集成,并与同层框架组件按需组合。

API 参考

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.

返回

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.

返回

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

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

Called when the application package is installed into the system.

参数

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

返回

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.

参数

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.

参数

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

返回

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.

参数

context -- Runtime context for releasing app resources.

返回

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.

参数
  • context -- Runtime context for the running application.

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

返回

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.

参数
  • context -- Runtime context for the running application.

  • timer_id -- Runtime timer identifier.

  • name -- Application-defined timer name.

返回

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.

返回

Settings application manifest.

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

Create a settings application instance.

返回

Shared application instance.