My class method is declared as follows:
void sendCommandToBluetoothModule(String command, SendCommandToBluetoothModuleCallback callback);
Where SendCommandToBluetoothModuleCallback
is:
typedef void (*SendCommandToBluetoothModuleCallback)(String);
So, I'm making this call:
sendCommandToBluetoothModule("AT\r\n", [](String response) -> void {
Serial.println(response);
});
And everything works as expected. The thing is: If I try to call another class member function then I should capture this
. The moment I change the last piece of code to:
sendCommandToBluetoothModule("AT\r\n", [this](String response) -> void {
Serial.println(response);
});
I receive the following error:
error: no matching function for call to 'BluePlotterClient::sendCommandToBluetoothModule(const char [5], BluePlotterClient::setupBluetoothModule()::)'
What I need to do in order to be able to make this call (for example):
sendCommandToBluetoothModule("AT\r\n", [this](String response) -> void {
this->classMemberFunction(response);
});
Aucun commentaire:
Enregistrer un commentaire