SinricPro Library
Loading...
Searching...
No Matches
ToggleController< T >

ToggleController. More...

#include <ToggleController.h>

Public Member Functions

void onToggleState (const String &instance, GenericToggleStateCallback cb)
 Set callback function for toggleState request.
 
bool sendToggleStateEvent (const String &instance, bool state, String cause=FSTR_SINRICPRO_PHYSICAL_INTERACTION)
 Send setToggleState event to SinricPro Server indicating actual toggle state.
 

Detailed Description

template<typename T>
class SINRICPRO_3_0_0::ToggleController< T >

ToggleController.

Member Function Documentation

◆ onToggleState()

template<typename T >
void onToggleState ( const String &  instance,
GenericToggleStateCallback  cb 
)

Set callback function for toggleState request.

Parameters
instanceString instance name (custom device)
cbFunction pointer to a ToggleStateCallback function
Returns
void
See also
ToggleStateCallback

◆ sendToggleStateEvent()

template<typename T >
bool sendToggleStateEvent ( const String &  instance,
bool  state,
String  cause = FSTR_SINRICPRO_PHYSICAL_INTERACTION 
)

Send setToggleState event to SinricPro Server indicating actual toggle state.

Parameters
instanceString instance name (custom device)
statetrue = state turned on
false = tate turned off
cause(optional) String reason why event is sent (default = "PHYSICAL_INTERACTION")
Returns
the success of sending the even
Return values
trueevent has been sent successfully
falseevent has not been sent, maybe you sent to much events in a short distance of time