PowerLevelController.
More...
template<typename T>
class PowerLevelController< T >
PowerLevelController.
◆ AdjustPowerLevelCallback
Definition for onAdjustPowerLevel callback.
Gets called when device receive a adjustPowerLevel
reuqest
- Parameters
-
[in] | deviceId | String which contains the ID of device |
[in] | powerLevel | integer -100..100 delta value which power level have to be changed |
[out] | powerLevel | integer 0..100 report the absolute powerlevel that the device have been set to |
- Returns
- the success of the request
- Return values
-
true | request handled properly |
false | request can`t be handled properly because of some error |
Example-Code
int absolutePowerLevel;
absolutePowerLevel += powerDelta;
Serial.printf("Device %s brightness changed about %i to %d\r\n", deviceId.c_str(), powerDelta, absolutePowerLevel);
powerDelta = absolutePowerLevel;
return true;
}
void onAdjustPowerLevel(AdjustPowerLevelCallback cb)
Set callback function for adjustPowerLevel request.
Definition: PowerLevelController.h:76
◆ SetPowerLevelCallback
Definition for setPowerLevel callback.
Gets called when device receive a setPowerLevel
reuqest
- Parameters
-
[in] | deviceId | String which contains the ID of device |
[in] | powerLevel | integer 0..100 new powerlevel the device should be set to |
[out] | powerLevel | integer 0..100 report the powerlevel that the device have been 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 onPowerLevel(
const String &deviceId,
int &powerLevel) {
Serial.printf("Device %s powerlevel %d\r\n", deviceId.c_str(), powerLevel);
return true;
}
void onPowerLevel(SetPowerLevelCallback cb)
Set callback function for setPowerLevel request.
Definition: PowerLevelController.h:65
◆ onAdjustPowerLevel()
Set callback function for adjustPowerLevel request.
- Parameters
-
cb | Function pointer to a AdjustPowerLevelCallback function |
- See also
- AdjustPowerLevelCallback
◆ onPowerLevel()
Set callback function for setPowerLevel request.
- Parameters
-
cb | Function pointer to a SetPowerLevelCallback function |
- See also
- SetPowerLevelCallback
◆ sendPowerLevelEvent()
bool sendPowerLevelEvent |
( |
int |
powerLevel, |
|
|
String |
cause = "PHYSICAL_INTERACTION" |
|
) |
| |
Send setPowerLevel
event to SinricPro Server indicating actual power level.
- Parameters
-
powerLevel | integer 0..100 report the powerlevel that the device have been set to |
cause | (optional) Reason why event is sent (default = "PHYSICAL_INTERACTION" ) |
- Returns
- the success of sending the event
- 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 |