CloudConfigRK
|
Storage method to store data in retained memory. More...
#include <CloudConfigRK.h>
Public Member Functions | |
CloudConfigStorageRetained (void *retainedData, size_t totalSize) | |
Construct a storage method for retained RAM. More... | |
virtual void | setup () |
Called during setup() to validate and parse the JSON data. | |
virtual bool | save () |
Retained data doesn't require an explict save. | |
![]() | |
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... | |
![]() | |
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... | |
Additional Inherited Members | |
![]() | |
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... | |
![]() | |
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. | |
![]() | |
CloudConfigDataHeader * | header |
Pointer to the header with data after it. | |
size_t | dataSize |
Size of the JSON data, not including sizeof(CloudConfigDataHeader) | |
![]() | |
JSONValue | jsonObj |
The JSONValue object for the outermost JSON object (or array) More... | |
Storage method to store data in retained memory.
Retained memory is preserved across restarts and across all sleep modes including HIBERNATE mode. There is around 3K of retained memory available.
|
inline |
Construct a storage method for retained RAM.
retainedData | A pointer to the retained buffer, typically a CloudConfigData<> struct. |
totalSize | The size of the retained data including both the header and data. It's that way so you can use sizeof() easily. |
You typically allocate one of these as a global variable or using new from setup().
You cannot delete or copy one of these objects.