CloudConfigRK
Public Member Functions | Protected Attributes
CloudConfigUpdateSubscription Class Reference

Update configuration via Particle event. More...

#include <CloudConfigRK.h>

Inheritance diagram for CloudConfigUpdateSubscription:
CloudConfigUpdate CloudConfigUpdateWebhook

Public Member Functions

 CloudConfigUpdateSubscription ()
 Default constructor.
 
 CloudConfigUpdateSubscription (const char *eventName)
 Constructor with event name. More...
 
CloudConfigUpdateSubscriptionwithEventName (const char *eventName)
 Method to set the event name to subscribe to. More...
 
virtual void setup ()
 Called during setup() More...
 
void subscriptionHandler (const char *eventName, const char *eventData)
 Handler called when the event is received.
 
- Public Member Functions inherited from CloudConfigUpdate
 CloudConfigUpdate ()
 Default constructor.
 
virtual void loop ()
 Called during loop() to allow update methods to have loop time. More...
 
virtual void startUpdate ()
 Called when subclasses should update the data from the cloud. More...
 

Protected Attributes

String eventName
 Subscribed event name passed to constructor or withEventName. Used during setup().
 

Additional Inherited Members

- Data Fields inherited from CloudConfigUpdate
unsigned long waitAfterCloudConnectedMs = 2000
 How long to wait after cloud connected to update settings.
 
unsigned long updateTimeoutMs = 60000
 If a response is not received in this amount of time, an error is assumed and another attempt will be made later. More...
 
- Protected Member Functions inherited from CloudConfigUpdate
virtual ~CloudConfigUpdate ()
 Destructor. Base class destructor is empty. Also, you can't delete one of these.
 
 CloudConfigUpdate (const CloudConfigUpdate &)=delete
 This class is not copyable.
 
CloudConfigUpdateoperator= (const CloudConfigUpdate &)=delete
 This class is not copyable.
 

Detailed Description

Update configuration via Particle event.

Subscription is a good choice if:

You will probably want to subclass this if you want to be able to have the device request an update since there is no way for this class to know how to request it. See CloudConfigUpdateWebhook for and example of using startUpdate() to make a request.

Constructor & Destructor Documentation

◆ CloudConfigUpdateSubscription()

CloudConfigUpdateSubscription::CloudConfigUpdateSubscription ( const char *  eventName)
inline

Constructor with event name.

Parameters
eventNameThe name of the event to subscribe to

Member Function Documentation

◆ setup()

void CloudConfigUpdateSubscription::setup ( )
virtual

Called during setup()

Be sure to set the eventName before calling setup()!

Reimplemented from CloudConfigUpdate.

◆ withEventName()

CloudConfigUpdateSubscription& CloudConfigUpdateSubscription::withEventName ( const char *  eventName)
inline

Method to set the event name to subscribe to.

Parameters
eventNameThe name of the event to subscribe to

This must be called before setup(). Calling it later will have no effect.


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