EqualizerController.
More...
|
using | SetBandsCallback = std::function< bool(const String &, const String &, int &)> |
| Callback definition for onSetBands function. More...
|
|
using | AdjustBandsCallback = std::function< bool(const String &, const String &, int &)> |
| Callback definition for onAdjustBands function. More...
|
|
using | ResetBandsCallback = std::function< bool(const String &, const String &, int &)> |
| Callback definition for onResetBands function. More...
|
|
template<typename T>
class EqualizerController< T >
EqualizerController.
◆ AdjustBandsCallback
Callback definition for onAdjustBands function.
Gets called when device receive a adjustBands
request
- Parameters
-
[in] | deviceId | String which contains the ID of device |
[in] | bands | String with requested bands to change
BASS , MIDRANGE , TREBBLE |
[in] | levelDelta | Integer with relative level value device should change bands about |
[out] | bands | String with changed bands
BASS , MIDRANGE , TREBBLE |
[out] | levelDelta | Integer value with level bands changed 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
std::map<String, int> equalizerBands;
bool onAdjustBands(
const String &deviceId, String &bands,
int &levelDelta) {
equalizerBands[bands] += levelDelta;
Serial.printf("Device %s bands %s changed about %d to %d\r\n", deviceId.c_str(), bands.c_str(), levelDelta, equalizerBands[bands]);
levelDelta = equalizerBands[bands];
return true;
}
void onAdjustBands(AdjustBandsCallback cb)
Set callback function for adjustBands request.
Definition: EqualizerController.h:100
◆ ResetBandsCallback
Callback definition for onResetBands function.
Gets called when device receive a onResetBands
request
- Parameters
-
[in] | deviceId | String which contains the ID of device |
[in] | bands | String with requested bands to reset
BASS , MIDRANGE , TREBBLE |
[out] | bands | String with changed bands
BASS , MIDRANGE , TREBBLE |
[out] | level | Integer value with level bands changed 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
std::map<String, int> equalizerBands;
bool onResetBands(
const String &deviceId, String &bands,
int &level) {
equalizerBands[bands] = 0;
Serial.printf("Device %s bands %s reset to %d\r\n", deviceId.c_str(), bands.c_str(), equalizerBands[bands]);
return true;
}
void onResetBands(ResetBandsCallback cb)
Set callback function for resetBands request.
Definition: EqualizerController.h:110
◆ SetBandsCallback
using SetBandsCallback = std::function<bool(const String &, const String &, int &)> |
Callback definition for onSetBands function.
Gets called when device receive a setBands
request
- Parameters
-
[in] | deviceId | String which contains the ID of device |
[in] | bands | String with requested bands to change
BASS , MIDRANGE , TREBBLE |
[in] | level | Integer value with level bands should set to |
[out] | bands | String with changed bands
BASS , MIDRANGE , TREBBLE |
[out] | level | Integer value with level bands changed 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
std::map<String, int> equalizerBands;
bool onSetBands(
const String &deviceId, String &bands,
int &level) {
Serial.printf("Device %s bands %s set to %d\r\n", deviceId.c_str(), bands.c_str(), level);
equalizerBands[bands] = level;
return true;
}
void onSetBands(SetBandsCallback cb)
Set callback function for setBands request.
Definition: EqualizerController.h:90
◆ onAdjustBands()
Set callback function for adjustBands
request.
- Parameters
-
cb | Function pointer to a AdjustBandsCallback function |
- Returns
- void
- See also
- AdjustBandsCallback
◆ onResetBands()
Set callback function for resetBands
request.
- Parameters
-
cb | Function pointer to a ResetBandsCallback function |
- Returns
- void
- See also
- ResetBandsCallback
◆ onSetBands()
Set callback function for setBands
request.
- Parameters
-
cb | Function pointer to a SetBandsCallback function |
- Returns
- void
- See also
- SetBandsCallback
◆ sendBandsEvent()
bool sendBandsEvent |
( |
String |
bands, |
|
|
int |
level, |
|
|
String |
cause = "PHYSICAL_INTERACTION" |
|
) |
| |
Send setBands
event to SinricPro Server indicating bands level has changed.
- Parameters
-
bands | String which bands has changed
BASS , MIDRANGE , TREBBLE |
level | Integer with changed bands level |
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 |