BrightnessController.
More...
template<typename T>
class BrightnessController< T >
BrightnessController.
◆ AdjustBrightnessCallback
Callback definition for onAdjustBrightness function.
Gets called when device receive a adjustBrightness
request
- Parameters
-
[in] | deviceId | String which contains the ID of device |
[in] | brightness | Relative integer value the device should change the brightness about |
[out] | brightness | Absolute integer value with new brightness the device is set to |
- Returns
- the success of the request
- Return values
-
true | request handled properly |
false | request was not handled properly because of some error |
Example-Code
int absoluteBrightness;
absoluteBrightness += brightnessDelta;
Serial.printf("Device %s brightness changed about %i to %d\r\n", deviceId.c_str(), brightnessDelta, absoluteBrightness);
brightnessDelta = absoluteBrightness;
return true;
}
void onAdjustBrightness(AdjustBrightnessCallback cb)
Set callback function for adjustBrightness request.
Definition: BrightnessController.h:77
◆ BrightnessCallback
Callback definition for onBrightness function.
Gets called when device receive a setBrightness
request
- Parameters
-
[in] | deviceId | String which contains the ID of device |
[in] | brightness | Absolute integer value the device should set its brightness to |
[out] | brightness | Absolute integer value with new brightness the device is set to |
- Returns
- the success of the request
- Return values
-
true | request handled properly |
false | request was not handled properly because of some error |
Example-Code
bool onBrightness(
const String &deviceId,
int &brightness) {
Serial.printf("Device %s brightness %d\r\n", deviceId.c_str(), brightness);
return true;
}
void onBrightness(BrightnessCallback cb)
Set callback function for setBrightness request.
Definition: BrightnessController.h:65
◆ onAdjustBrightness()
Set callback function for adjustBrightness
request.
- Parameters
-
cb | Function pointer to a AdjustBrightnessCallback function |
- Returns
- void
- See also
- AdjustBrightnessCallback
◆ onBrightness()
Set callback function for setBrightness
request.
- Parameters
-
cb | Function pointer to a BrightnessCallback function |
- Returns
- void
- See also
- BrightnessCallback
◆ sendBrightnessEvent()
bool sendBrightnessEvent |
( |
int |
brightness, |
|
|
String |
cause = "PHYSICAL_INTERACTION" |
|
) |
| |
Send setBrightness
event to SinricPro Server indicating actual brightness.
- Parameters
-
brightness | Integer value with actual brightness the device is set to |
cause | (optional) String reason why event is sent (default = "PHYSICAL_INTERACTION" ) |
- Returns
- the success of sending the even
- Return values
-
true | event has been sent successfully |
false | event has not been sent, maybe you sent to much events in a short distance of time |