The File config class.
class FileConfig
-
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_mode
to be processed.
The
file_operating_mode
enums are includedfile_mode_open_read
,file_mode_open_write
,file_mode_open_append
, andfile_mode_remove
. -
-
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_mode
to be processed.
The
file_operating_mode
enums are includedfile_mode_open_read
,file_mode_open_write
,file_mode_open_append
, andfile_mode_remove
. -
-
Clear the internal data.
void clear()
-
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 theFileConfig
itself.
-
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_mode
enums are includedfile_mode_open_read
,file_mode_open_write
,file_mode_open_append
, andfile_mode_remove
.Returns:
FileConfig &
- The reference to theFileConfig
itself.
-
Get the reference to the internal
file_config_data
.file_config_data &get()
Returns:
file_config_data &
- The reference tofile_config_data
.
The BLOB config class.
class BlobConfig
-
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.
-
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.
-
Clear the internal data.
void clear()
-
Get the pointer to the internal BLOB data.
uint8_t *blob() const
Returns:
uint8_t *
- The pointer to uint8_t data array.
-
Get the size of data.
size_t size()
Returns:
size_t
- The size of data in bytes.
-
Get the reference to the internal file_config_data.
file_config_data &getData()
Returns:
file_config_data &
- The reference to the internalfile_config_data
.
-
The static function to get the reference of
file_config_data
fromFileConfig
.static file_config_data &getFile(FileConfig &file)
Params:
file
- TheFileConfig
object.
Returns:
file_config_data &
- The reference to the internalfile_config_data
.
-
The static function to get the reference of
file_config_data
fromBlobConfig
.static file_config_data &getBlob(BlobConfig &blob)
Params:
blob
- TheBlobConfig
object.
Returns:
file_config_data &
- The reference to the internalfile_config_data
.