SinricPro Library
SinricProLock

Device to control a smart lock. More...

Inheritance diagram for SinricProLock:

Public Types

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

Public Member Functions

void onLockState (LockStateCallback cb)
 Set callback function for setLockState request. More...
 
bool sendLockStateEvent (bool state, String cause="PHYSICAL_INTERACTION")
 Send lockState event to SinricPro Server indicating actual lock state. More...
 

Detailed Description

Device to control a smart lock.

Supporting

  • on / off
  • lock / unlock

Member Typedef Documentation

◆ LockStateCallback

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

Callback definition for onLockState function.

Gets called when device receive a setLockState request

Parameters
[in]deviceIdString which contains the ID of device
[in]statetrue = device is requested to lock
false = device is requested to unlock
[out]statetrue = device has been locked
false = device has been unlocked
Returns
the success of the request
Return values
truerequest handled properly
falserequest was not handled properly because of some error

Example-Code

bool onLockState(const String &deviceId, bool &lockState) {
Serial.printf("Device is %s\r\n", lockState?"locked":"unlocked");
return true;
}
void onLockState(LockStateCallback cb)
Set callback function for setLockState request.
Definition: LockController.h:53

Member Function Documentation

◆ onLockState()

void onLockState ( LockStateCallback  cb)
inherited

Set callback function for setLockState request.

Parameters
cbFunction pointer to a LockStateCallback function
Returns
void
See also
LockStateCallback

◆ sendLockStateEvent()

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

Send lockState event to SinricPro Server indicating actual lock state.

Parameters
statetrue = device is locked
false = device is unlocked
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