SinricPro Library
SinricProGarageDoor

Device to control a garage door. More...

Inheritance diagram for SinricProGarageDoor:

Public Types

using DoorCallback = std::function< bool(const String &, bool &)>
 Callback definition for onDoorState function. More...
 

Public Member Functions

void onDoorState (DoorCallback cb)
 Set callback function for onDoorState request. More...
 
bool sendDoorStateEvent (bool state, String cause="PHYSICAL_INTERACTION")
 Send DoorState event to update actual door state on SinricPro Server. More...
 

Detailed Description

Device to control a garage door.

Supporting

  • open / close

Member Typedef Documentation

◆ DoorCallback

using DoorCallback = std::function<bool(const String &, bool &)>
inherited

Callback definition for onDoorState function.

Gets called when device receive a open or close request

Parameters
[in]deviceIdString which contains the ID of device
[in]doorStatefalse = open, device is requested to open the garage door
true = close, device is requested to close the garage door
[out]doorStatebool with actual state false = open, true = closed
Returns
the success of the request
Return values
truerequest handled properly
falserequest was not handled properly because of some error

Example-Code

bool onDoorState(const String &deviceId, bool &doorState) {
Serial.printf("Device %s garage door is now %s\r\n", deviceId.c_str(), doorState?"closed":"open");
return true;
}
void onDoorState(DoorCallback cb)
Set callback function for onDoorState request.
Definition: DoorController.h:48

Member Function Documentation

◆ onDoorState()

void onDoorState ( DoorCallback  cb)
inherited

Set callback function for onDoorState request.

Parameters
cbFunction pointer to a onDoorState function
Returns
void
See also
DoorStateCallback

◆ sendDoorStateEvent()

bool sendDoorStateEvent ( bool  state,
String  cause = "PHYSICAL_INTERACTION" 
)
inherited

Send DoorState event to update actual door state on SinricPro Server.

Parameters
statebool true = close
false = open
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