Hi guys,
I am using Neil Kolban's cpp_utils from his esp32-snippets github repository for BLE (with esp-idf). In my project the esp32 acts as a server, sending notifications to an central device. It is based on Kolbans BLE example "SampleNotify" using the "pCharacteristic->notify()" method.
The program works fine as long as the client is near by the ESP32, but when it is going to get out of reach, then I got an error massage "esp_ble_gatts_send_ notify: rc=-1 Unknown ESP_ERR error". This seems to be due to the method "esp_ble_gatts_send_indicate" in "esp_gatts_api.h".
I still wonder about this, because I thought using notifications the server doesn't care about whether a client is listening or not. And what is more, I do not have any idea how to handle this error massage. Is there any method to detect if the client is "connected" or nearby? This error only occur when I send more then 10-20 notifications in a second (I want to submit an ECG with 125-250 samples per second .
Does anyone have an idea how to proceed with this error?
Thanks, JJens
unknown BLE error sending notifications to a client out of reach
Re: unknown BLE error sending notifications to a client out of reach
Thats true, but if peer device is too long out of range then connection is closed, when it is closed stack will try to send notification to NULL.I still wonder about this, because I thought using notifications the server doesn't care about whether a client is listening or not.
Try to increase timeout in esp_ble_gap_set_prefer_conn_params:
https://github.com/espressif/arduino-esp32/issues/1913
Re: unknown BLE error sending notifications to a client out of reach
Thanks!
Increasing the timeout doesn't seem to make any difference. According to your explanation, I have to prevent the server from sending notifications to NULL. I assume that my task still pushes notification to a stack before the callback function (onDisconnect) deletes the task. That might be due to the high sample rate which generates notifications every 4ms.
Do you know any direct function to check the connection status before sending a notification. (I have tried "BLEServer::getConnectedCount()", but there are still roughly 20 notifications on stack before the function detects that there is no connected client...)
Increasing the timeout doesn't seem to make any difference. According to your explanation, I have to prevent the server from sending notifications to NULL. I assume that my task still pushes notification to a stack before the callback function (onDisconnect) deletes the task. That might be due to the high sample rate which generates notifications every 4ms.
Do you know any direct function to check the connection status before sending a notification. (I have tried "BLEServer::getConnectedCount()", but there are still roughly 20 notifications on stack before the function detects that there is no connected client...)
Re: unknown BLE error sending notifications to a client out of reach
As long as it doesn't crash app I wouldn't care about it and treat it as info/warnings.
Who is online
Users browsing this forum: ok-home and 101 guests