文件应用

[English]

概述

brookesia_app_files 是 System Core 应用包中的内置文件浏览应用。

核心职责

  • 浏览已挂载的存储文件系统。

  • 通过 GUI 资源展示目录和文件。

  • 使用 Storage 服务与 System Core 应用生命周期钩子。

集成位置

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

API 参考

Header File

Classes

class FileManagerApp : public esp_brookesia::system::core::IApp

Built-in file manager application for browsing storage volumes and basic file actions.

Public Types

enum class EntryKind

File browser entry category used for rendering icons and supported actions.

Values:

enumerator Volume

Storage volume root entry.

enumerator Directory

Directory entry.

enumerator File

Regular file entry.

enumerator Other

Unknown or unsupported filesystem entry.

enum class Page

Internal page currently shown by the file manager.

Values:

enumerator Browser

Main browser page.

enumerator Operations

Per-entry operation page.

Public Functions

FileManagerApp()

Create a file manager application instance.

~FileManagerApp() override

Destroy the file manager 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_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 FileManagerAppProvider : public esp_brookesia::system::core::IAppProvider

Public Functions

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

Get the manifest for the built-in file manager app.

返回

File manager application manifest.

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

Create a file manager application instance.

返回

Shared application instance.