CloudConfigRK
Public Member Functions
CloudConfigStorageRetained Class Reference

Storage method to store data in retained memory. More...

#include <CloudConfigRK.h>

Inheritance diagram for CloudConfigStorageRetained:
CloudConfigStorageData CloudConfigStorage

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.
 
- Public Member Functions inherited from CloudConfigStorageData
 CloudConfigStorageData ()
 Default constructor.
 
 CloudConfigStorageData (CloudConfigDataHeader *header, size_t dataSize)
 Constructor with header. More...
 
CloudConfigStorageDatawithData (CloudConfigDataHeader *header, size_t dataSize)
 Specify the data header and data location. More...
 
virtual CloudConfigDataHeadergetDataHeader ()
 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...
 

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.
 
CloudConfigStorageoperator= (const CloudConfigStorage &)=delete
 This class is not copyable.
 
- Protected Attributes inherited from CloudConfigStorageData
CloudConfigDataHeaderheader
 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ CloudConfigStorageRetained()

CloudConfigStorageRetained::CloudConfigStorageRetained ( void *  retainedData,
size_t  totalSize 
)
inline

Construct a storage method for retained RAM.

Parameters
retainedDataA pointer to the retained buffer, typically a CloudConfigData<> struct.
totalSizeThe 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.


The documentation for this class was generated from the following file: