The File and BLOB config classes.
July 11, 2024 ยท View on GitHub
FileConfig
Description
The File config class.
class FileConfig
Constructors
-
๐น FileConfig(const String &filename = "", FileConfigCallback cb = NULL)
FileConfig(const String &filename = "", FileConfigCallback cb = NULL)Params:
-
filename- The file name of file to be read and write. -
cb- The FileConfigCallback function that accepts File object, file name andfile_operating_modeto be processed.
The
file_operating_modeenums are includedfile_mode_open_read,file_mode_open_write,file_mode_open_append, andfile_mode_remove. -
Functions
-
๐น void setFile(const String &filename, FileConfigCallback cb)
Set the File config.
void setFile(const String &filename, FileConfigCallback cb)Params:
-
filename- The file name of file to be read and write. -
cb- The FileConfigCallback function that accepts File object, file name andfile_operating_modeto be processed.
The
file_operating_modeenums are includedfile_mode_open_read,file_mode_open_write,file_mode_open_append, andfile_mode_remove. -
-
๐น void clear()
Clear the internal data.
void clear() -
๐น FileConfig &setFilename(const String &filename)
Set the file name.
FileConfig &setFilename(const String &filename)Params:
filename- The file name of file to be read and write.
Returns:
FileConfig &- The reference to theFileConfigitself.
-
๐น FileConfig &setFilename(const String &filename)
Set the file name.
FileConfig &setCallback(FileConfigCallback cb)Params:
cb- The FileConfigCallback function that accepts File object, file name and file_operating_mode to be processed.
The
file_operating_modeenums are includedfile_mode_open_read,file_mode_open_write,file_mode_open_append, andfile_mode_remove.Returns:
FileConfig &- The reference to theFileConfigitself.
-
๐น file_config_data &get()
Get the reference to the internal
file_config_data.file_config_data &get()Returns:
file_config_data &- The reference tofile_config_data.
BlobConfig
Description
The BLOB config class.
class BlobConfig
Constructors
-
๐น BlobConfig(uint8_t *data = nullptr, size_t size = 0)
BlobConfig(uint8_t *data = nullptr, size_t size = 0)Params:
data- The pointer to the uint8_t data array.size- The size of data in bytes.
Functions
-
๐น void setBlob(uint8_t *data, size_t size)
Set the BLOB config.
void setBlob(uint8_t *data, size_t size)Params:
data- The pointer to the uint8_t data array.size- The size of data in bytes.
-
๐น void clear()
Clear the internal data.
void clear() -
๐น uint8_t *blob() const
Get the pointer to the internal BLOB data.
uint8_t *blob() constReturns:
uint8_t *- The pointer to uint8_t data array.
-
๐น size_t size()
Get the size of data.
size_t size()Returns:
size_t- The size of data in bytes.
-
๐น file_config_data &getData()
Get the reference to the internal file_config_data.
file_config_data &getData()Returns:
file_config_data &- The reference to the internalfile_config_data.
Static Functions
-
๐น static file_config_data &getFile(FileConfig &file)
The static function to get the reference of
file_config_datafromFileConfig.static file_config_data &getFile(FileConfig &file)Params:
file- TheFileConfigobject.
Returns:
file_config_data &- The reference to the internalfile_config_data.
-
๐น static file_config_data &getBlob(BlobConfig &blob)
The static function to get the reference of
file_config_datafromBlobConfig.static file_config_data &getBlob(BlobConfig &blob)Params:
blob- TheBlobConfigobject.
Returns:
file_config_data &- The reference to the internalfile_config_data.