You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One annoying thing is having to define different callback functions for each device. If we could also pass the name of the device in the function,we can have only one function and it will be up to the programmer to search for the device to be controlled based on the past name. Each device can direct to the same routine.
for example only for brightness devices:
In espalexadevice.h>
typedef std :: function <void (uint8_t b, String dName)> BrightnessCallbackFunction;
in espalexadecive.cpp>
void EspalexaDevice :: doCallback ()
{
if (_callback! = nullptr) {_callback (_val, _deviceName); return;}
The text was updated successfully, but these errors were encountered:
Callback functions have EspalexaDevice* as a parameter, that pointer refers to the device that caused the callback. You can then identify the device via d->getName() or d->getId()
One annoying thing is having to define different callback functions for each device. If we could also pass the name of the device in the function,we can have only one function and it will be up to the programmer to search for the device to be controlled based on the past name. Each device can direct to the same routine.
for example only for brightness devices:
In espalexadevice.h>
typedef std :: function <void (uint8_t b, String dName)> BrightnessCallbackFunction;
in espalexadecive.cpp>
void EspalexaDevice :: doCallback ()
{
if (_callback! = nullptr) {_callback (_val, _deviceName); return;}
The text was updated successfully, but these errors were encountered: