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
I am trying to use Tasker in an instance class. The method has to be a member so that it can access class variables for that instance. Norml functions work but I need to bind to the call to an instance. I have dine it with other callbacks using the same syntax. I have tried to add int as parameter and changed member from private to public but no change.
void ChannelStateService::updateStateTime(){
update([&](ChannelState& channelState) {
return StateUpdateResult::CHANGED;
}, _state.channel.name);
}
`
I get the following error:
src/automation/ChannelStateService.cpp: In member function 'void ChannelStateService::begin()':
src/automation/ChannelStateService.cpp:187:90: error: no matching function for call to 'Tasker::setInterval(std::_Bind_helper<false, void (ChannelStateService::)(), ChannelStateService const>::type, int)'
_deviceTime.setInterval(std::bind(&ChannelStateService::updateStateTime, this), 10000);
^
src/automation/ChannelStateService.cpp:187:90: note: candidates are:
In file included from src/automation/ChannelStateService.h:18:0,
from src/automation/ChannelStateService.cpp:2:
.pio/libdeps/esp12e/Tasker/Tasker.h:92:6: note: bool Tasker::setInterval(TaskCallback0, long unsigned int, byte)
bool Tasker::setInterval(TaskCallback0 func, unsigned long interval, byte prio)
^
.pio/libdeps/esp12e/Tasker/Tasker.h:92:6: note: no known conversion for argument 1 from 'std::_Bind_helper<false, void (ChannelStateService::)(), ChannelStateService const>::type {aka std::_Bind<std::_Mem_fn<void (ChannelStateService::)()>(ChannelStateService)>}' to 'TaskCallback0 {aka void (*)()}'
.pio/libdeps/esp12e/Tasker/Tasker.h:87:6: note: bool Tasker::setInterval(TaskCallback1, long unsigned int, int, byte)
bool Tasker::setInterval(TaskCallback1 func, unsigned long interval, int param, byte prio)
The text was updated successfully, but these errors were encountered:
I am trying to use Tasker in an instance class. The method has to be a member so that it can access class variables for that instance. Norml functions work but I need to bind to the call to an instance. I have dine it with other callbacks using the same syntax. I have tried to add int as parameter and changed member from private to public but no change.
`
void ChannelStateService::begin() {
_deviceTime.setInterval(std::bind(&ChannelStateService::updateStateTime, this), 10000);
}
void ChannelStateService::updateStateTime(){
update([&](ChannelState& channelState) {
return StateUpdateResult::CHANGED;
}, _state.channel.name);
}
`
I get the following error:
src/automation/ChannelStateService.cpp: In member function 'void ChannelStateService::begin()':
src/automation/ChannelStateService.cpp:187:90: error: no matching function for call to 'Tasker::setInterval(std::_Bind_helper<false, void (ChannelStateService::)(), ChannelStateService const>::type, int)'
_deviceTime.setInterval(std::bind(&ChannelStateService::updateStateTime, this), 10000);
^
src/automation/ChannelStateService.cpp:187:90: note: candidates are:
In file included from src/automation/ChannelStateService.h:18:0,
from src/automation/ChannelStateService.cpp:2:
.pio/libdeps/esp12e/Tasker/Tasker.h:92:6: note: bool Tasker::setInterval(TaskCallback0, long unsigned int, byte)
bool Tasker::setInterval(TaskCallback0 func, unsigned long interval, byte prio)
^
.pio/libdeps/esp12e/Tasker/Tasker.h:92:6: note: no known conversion for argument 1 from 'std::_Bind_helper<false, void (ChannelStateService::)(), ChannelStateService const>::type {aka std::_Bind<std::_Mem_fn<void (ChannelStateService::)()>(ChannelStateService)>}' to 'TaskCallback0 {aka void (*)()}'
.pio/libdeps/esp12e/Tasker/Tasker.h:87:6: note: bool Tasker::setInterval(TaskCallback1, long unsigned int, int, byte)
bool Tasker::setInterval(TaskCallback1 func, unsigned long interval, int param, byte prio)
The text was updated successfully, but these errors were encountered: