Filesystem Interface

[中文]

Public header: #include "brookesia/hal_interface/interfaces/storage/fs.hpp"

Class: StorageFsIface

API Reference

Header File

Classes

class StorageFsIface : public esp_brookesia::hal::Interface

File-system discovery interface for storage-capable devices.

Public Types

enum class MediumType

Supported storage medium type.

Values:

enumerator Flash

Flash medium.

enumerator SDCard

SD / TF card medium.

enum class FileSystemType

Supported file-system type.

Values:

enumerator SPIFFS

SPIFFS file system.

enumerator FATFS

FAT file system.

enumerator LittleFS

LittleFS file system.

Public Functions

inline StorageFsIface()

Construct a storage file-system interface.

virtual ~StorageFsIface() = default

Virtual destructor for polymorphic storage interfaces.

inline const std::vector<Info> &get_all_info() const

Enumerate all mounted file-system entries.

Returns

Collection of file-system metadata entries.

virtual bool get_capacity(const char *mount_point, Capacity &capacity) = 0

Query the capacity of a mounted file system.

Parameters
  • mount_point -- Mount point returned by get_all_info().

  • capacity -- Output capacity snapshot.

Returns

true if the capacity was queried successfully, otherwise false.

Public Static Attributes

static constexpr const char *NAME = "StorageFs"

Interface registry name.

struct Capacity

Dynamic capacity snapshot for one mounted file-system entry.

Public Members

uint64_t total_bytes = 0

Total size in bytes.

uint64_t used_bytes = 0

Used size in bytes.

uint64_t free_bytes = 0

Free size in bytes.

struct Info

Metadata for one mounted file-system entry.

Public Members

FileSystemType fs_type

File-system type.

MediumType medium_type

Storage medium type.

const char *mount_point

Mount point.

bool supports_directories = false

Whether this file system supports directories.