CloudConfigRK
|
Storage method to store data in the emulated EEPROM. More...
#include <CloudConfigRK.h>
Public Member Functions | |
CloudConfigStorageEEPROM (size_t eepromOffset) | |
Constructor for EEPROM storage. More... | |
virtual void | setup () |
Called during setup() to load, validate, and parse the JSON data. | |
virtual bool | save () |
Called to save the data in EEPROM when it is updated. | |
Public Member Functions inherited from CloudConfigStorageData | |
CloudConfigStorageData () | |
Default constructor. | |
CloudConfigStorageData (CloudConfigDataHeader *header, size_t dataSize) | |
Constructor with header. More... | |
CloudConfigStorageData & | withData (CloudConfigDataHeader *header, size_t dataSize) |
Specify the data header and data location. More... | |
virtual CloudConfigDataHeader * | getDataHeader () |
Gets a pointer to the CloudConfigDataHeader structure. | |
void | validate () |
Validate the CloudConfigDataHeader. More... | |
const char *const | getJsonData () const |
Gets a pointer to the JSON data for reading (const) More... | |
size_t | getMaxJsonDataSize () const |
Returns the maximum size of the JSON data in characters. More... | |
char * | getJsonData () |
Gets a pointer to the JSON data for writing (not const) More... | |
size_t | getTotalSize () const |
Gets the total size of the buffer including both the header and the JSON data. More... | |
virtual bool | updateData (const char *json) |
This method is called after subclasses update the JSON data. More... | |
Public Member Functions inherited from CloudConfigStorage | |
CloudConfigStorage () | |
Constructor. Base class constructor is empty. | |
bool | hasJsonData () const |
Returns true if there is JSON data field is not empty. | |
virtual void | parse () |
Called after the JSON data is updated to parse the data using the JSON parser. More... | |
virtual void | loop () |
Called from loop(). Optional. Only needed if the storage method wants loop processing time. | |
JSONValue | getJSONValue () |
Gets the top level (outer) JSONValue object. More... | |
JSONValue | getJSONValueForKey (const char *key) |
Gets the value for a given key in the top-level outer JSON object. More... | |
JSONValue | getJSONValueAtIndex (size_t index) |
Gets the value for a given index in the a JSON array in the top-level outer JSON array. More... | |
Protected Attributes | |
size_t | eepromOffset |
Offset into the emulated EEPROM to start storing the data. | |
CloudConfigData< SIZE > | dataBuffer |
Copy of the EEPROM data in RAM. | |
Protected Attributes inherited from CloudConfigStorageData | |
CloudConfigDataHeader * | header |
Pointer to the header with data after it. | |
size_t | dataSize |
Size of the JSON data, not including sizeof(CloudConfigDataHeader) | |
Protected Attributes inherited from CloudConfigStorage | |
JSONValue | jsonObj |
The JSONValue object for the outermost JSON object (or array) More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from CloudConfigStorage | |
static JSONValue | getJSONValueForKey (JSONValue parentObj, const char *key) |
Gets the value for a given key in the a JSON object. More... | |
static JSONValue | getJSONValueAtIndex (JSONValue parentObj, size_t index) |
Gets the value for a given index in the a JSON array. More... | |
Protected Member Functions inherited from CloudConfigStorage | |
virtual | ~CloudConfigStorage () |
Destructor. Base class destructor is empty. Also, you can't delete one of these. | |
CloudConfigStorage (const CloudConfigStorage &)=delete | |
This class is not copyable. | |
CloudConfigStorage & | operator= (const CloudConfigStorage &)=delete |
This class is not copyable. | |
Storage method to store data in the emulated EEPROM.
This is a good choice for storing data on Gen 2 devices if you have available space in EEPROM.
On Gen 3 devices (Argon, Boron, B Series SoM, Tracker SoM) the file system is usually a better choice. Since the emulated EEPROM is just a file on the file system on Gen 3, there is no performance advantage for using EEPROM over File.
SIZE | the templated maximum size of the JSON data. |
The getTotalSize() method of the parent class determines how many bytes of EEPROM are used; it's the size of the CloudConfigDataHeader plus SIZE.
|
inline |
Constructor for EEPROM storage.
eepromOffset | Starting offset in EEPROM to store the data. |
The getTotalSize() method of the parent class determines how many bytes of EEPROM are used; it's the size of the CloudConfigDataHeader plus SIZE.