TinyPico suspend BLE callback

raff5184
Posts: 9
Joined: Fri Nov 12, 2021 5:55 pm

TinyPico suspend BLE callback

Postby raff5184 » Sat Jan 29, 2022 1:03 am

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

Who is online

Users browsing this forum: No registered users and 71 guests