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.

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

Who is online

Users browsing this forum: No registered users and 2 guests