Page 1 of 1

TinyPico suspend BLE callback

Posted: Sat Jan 29, 2022 1:03 am
by raff5184
Hi all,

I have a TinyPico board which has an ESP32. In my Arduino code I have a class that defines the callback onWrite to read Bluetooth messages.

Code: Untitled.cpp Select all


class MyCallbacks: public BLECharacteristicCallbacks {

// on received bluetooth message
void onWrite(BLECharacteristic *pCharacteristic) {
...
}
}
Then in setup() I instantiate it pCharacteristic->setCallbacks(new MyCallbacks());. Can I "suspend" and reactivate that callback from another function in the code? Basically, at some point I want to ignore BLE messages, but still keep the Bluetooth connection alive and I don't want to enter the onWrite(), then I need to reactivate the callback from another point.

Thank you