hello I made an end() method which is supposed to stop the BLEMIDI but none of the code after calling all of the end() and stop() below, the esp32 is still advertising ...
can you let me know how to properly shutdown it...
virtual bool end() override{
DEBUG_PRINT("\n%s::end()",interfaceName.c_str());
auto transport = bleMIDI.getTransport(); // ✅ On récupère le transport BLE
hasBegun = false;
if (transport) {
if (hasBegun){
transport->end();
BLEbleMIDI.end(); // does nothing
BLEDevice::getAdvertising()->stop();
}else{
DEBUG_PRINT("\n\ttransport->end() ignored (!hasBegun)");
}
// bleMIDI.end() doesnt exists
return true;
}
return false;
}
and here is my begin() method which is called when enabling the service
virtual bool begin(){
DEBUG_PRINT("\n%s::begin()",interfaceName.c_str());
MIDIInterface::init();
bleInstancePtr = this; // do not forget otherwise callback function will crash
BLEbleMIDI.setHandleConnected(handleConnectedStatic);
BLEbleMIDI.setHandleDisconnected(handleDisconnectedStatic);
bleMIDI.setHandleSystemExclusive(handleSysexStatic);
if (!hasBegun){
if (state.enabled){
setStatePending();
DEBUG_PRINT("\n\tbleMIDI.begin()");
bleMIDI.begin();
hasBegun = true;
}else{
DEBUG_PRINT("\n\tbleMIDI.begin() ignored (disabled)");
}
}else{
DEBUG_PRINT("\n\tbleMIDI.begin() ignored (hasBegun)");
}
return true;
}
hello I made an end() method which is supposed to stop the BLEMIDI but none of the code after calling all of the end() and stop() below, the esp32 is still advertising ...
can you let me know how to properly shutdown it...
and here is my begin() method which is called when enabling the service