Restart BLE after 200msec timeout

Jjens*
Posts: 4
Joined: Fri Jul 05, 2019 10:06 am

Restart BLE after 200msec timeout

Postby Jjens* » Fri Jul 05, 2019 10:50 am

Hello,

since some months I am working on a ESP32-Project for the first time and it is going on well. But now I have a great problem with BLE. (So far I am using Neil Kolban's cpp_utils from his esp32-snippets github repository for BLE.)

I need to shut down all BLE activities for ~200msec and than restart the same services and characteristics I have used before. Is there any option to set only BLE to sleep and wake it up again while other my tasks proceed?


I tried to stop advertising, but something still disturbs my time critical task that I have to execute in the meanwhile. (Without using "pServer->getAdvertising()->start()" at all, everything works fine. So the disturbance of my timing is due to BLE and I do need BLE before and after this break. What ever I have done to stop and start BLE again (BLEDevice::deinit/BLEDevice::init; stop/start Service,...) leads to the error massage "E(3229) BLECharacteristic: Characteristic already has a handle". I do not find any solution to get rid of this error.)

Does anyone have a hint how to stop and restart BLE on ESP32?

Thanks to all,
JJens

chegewara
Posts: 2210
Joined: Wed Jun 14, 2017 9:00 pm

Re: Restart BLE after 200msec timeout

Postby chegewara » Sat Jul 06, 2019 4:32 pm

After stop service try:

Code: Select all

delete(service); // service is pointer to service
But i dont think you need to stop services and deinit BLE. If you disconnect ble devices and stop advertising then it should be enough (there may be issue with stop advertising, which is re-starting).

Jjens*
Posts: 4
Joined: Fri Jul 05, 2019 10:06 am

Re: Restart BLE after 200msec timeout

Postby Jjens* » Thu Jul 11, 2019 1:24 pm

@Chegewara:
thanks for your reply, delete(service) solves my problem.
(Somehow only disconnecting devices and stop advertising still disturbed my timing, maybe due to some internal interrupts.)

Who is online

Users browsing this forum: Google [Bot] and 129 guests