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.
  1. class MyCallbacks: public BLECharacteristicCallbacks {
  2.  
  3.     // on received bluetooth message
  4.     void onWrite(BLECharacteristic *pCharacteristic) {
  5. ...
  6.    }
  7. }
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