#include <NVSFS.h>
|
| | NVSFileSystem () |
| | Default constructor.
|
| |
| bool | begin (bool formatOnFail=false) |
| | Initialize the NVS file system.
|
| |
| void | end () |
| | Deinitialize the NVS file system.
|
| |
| NVSFile | open (const String &path, const String &mode) |
| | Open a file for reading or writing.
|
| |
| bool | remove (const String &path) |
| | Remove a file from NVS storage.
|
| |
◆ NVSFileSystem()
| uniot::NVSFileSystem::NVSFileSystem |
( |
| ) |
|
|
inline |
Default constructor.
Creates an uninitialized NVS file system instance. Call begin() before performing any file operations.
◆ begin()
| bool uniot::NVSFileSystem::begin |
( |
bool | formatOnFail = false | ) |
|
|
inline |
Initialize the NVS file system.
Opens the NVS namespace used for file storage operations. This must be called before any file operations can be performed.
- Parameters
-
| formatOnFail | Currently unused (NVS doesn't require formatting) |
- Return values
-
| true | NVS namespace opened successfully |
| false | Failed to open NVS namespace |
- Note
- The method uses a fixed namespace "uniot_files" for all file operations. This ensures isolation from other NVS usage in the application.
◆ end()
| void uniot::NVSFileSystem::end |
( |
| ) |
|
|
inline |
Deinitialize the NVS file system.
Closes the NVS namespace and marks the file system as uninitialized. Any subsequent file operations will fail until begin() is called again.
◆ open()
| NVSFile uniot::NVSFileSystem::open |
( |
const String & | path, |
|
|
const String & | mode ) |
|
inline |
Open a file for reading or writing.
Creates an NVSFile object for the specified path and access mode. The path is automatically normalized to a valid NVS key.
- Parameters
-
| path | File path (will be converted to NVS key) |
| mode | Access mode ("r" for read, "w" for write) |
- Returns
- NVSFile object for the specified file
- Warning
- If the file system is not initialized, returns an invalid NVSFile object. Always check the returned object with operator bool().
- Note
- Currently only supports "r" and "w" modes. Append mode ("a") and other modes are not yet implemented.
◆ remove()
| bool uniot::NVSFileSystem::remove |
( |
const String & | path | ) |
|
|
inline |
Remove a file from NVS storage.
Deletes the NVS key corresponding to the specified file path. The operation is immediate and cannot be undone.
- Parameters
-
- Return values
-
| true | File was successfully removed |
| false | Failed to remove file (may not exist or NVS error) |
- Note
- If the file doesn't exist, the operation may still return true depending on the underlying NVS implementation.
The documentation for this class was generated from the following file: