Hello all,
I have trouble with subject of this topic.
I use gatt_client example as base, and can establish connection to Peripherals without problems.
But i can't disconnect from Peripherals later even esp_ble_gattc_app_unregister(gattc_if) not helps - after that conenction was gone from API but real connection to Peripheral stays active in background.
Any help will be appreciated.
Thanks.
BLE graceful disconnect problem
-
- Posts: 9708
- Joined: Thu Nov 26, 2015 4:08 am
Re: BLE graceful disconnect problem
Move to SDK.
-
- Posts: 4
- Joined: Thu Sep 14, 2017 11:22 am
Re: BLE graceful disconnect problem
Hello everyone,
I am facing the same problem. I am unable to disconnect from peripheral even by using "esp_ble_gattc_app_unregister" and "esp_ble_gattc_close".
Can anyone tell me how can I disconnect from the peripheral so that the event ESP_GATTC_DISCONNECT_EVT could be raised.
Thanks
I am facing the same problem. I am unable to disconnect from peripheral even by using "esp_ble_gattc_app_unregister" and "esp_ble_gattc_close".
Can anyone tell me how can I disconnect from the peripheral so that the event ESP_GATTC_DISCONNECT_EVT could be raised.
Thanks
Re: BLE graceful disconnect problem
Testing with the C++ BLE classes found here,
https://github.com/nkolban/esp32-snippe ... /cpp_utils
I seem to find that a esp_ble_gattc_close causes a disconnect. I see the expected event as well as an actual disconnection on the BLE server. Here are the trace logs:
https://github.com/nkolban/esp32-snippe ... /cpp_utils
I seem to find that a esp_ble_gattc_close causes a disconnect. I see the expected event as well as an actual disconnection on the BLE server. Here are the trace logs:
Code: Select all
D (7238) BLEClient: >> disconnect()
E (7240) BT: bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0016
D (7240) BLEDevice: gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_CLOSE_EVT
D (7247) BLEUtils: GATT Event: ESP_GATTC_CLOSE_EVT
D (7251) BLEUtils: [status: ESP_GATT_OK, reason:ESP_GATT_CONN_UNKNOWN, conn_id: 0]
D (7258) BLEDevice: gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_DISCONNECT_EVT
D (7266) BLEUtils: GATT Event: ESP_GATTC_DISCONNECT_EVT
D (7272) BLEUtils: [staus: ESP_GATT_OK, conn_id: 0, remote_bda: 4c:14:6c:ea:23:1c]
D (7280) BLEClient: << disconnect()
D (7283) SampleClientDisconnect: peer address: 00:00:00:00:00:00
D (7330) SampleClientDisconnect: -- End of task
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
-
- Posts: 79
- Joined: Tue Apr 26, 2016 5:10 am
Re: BLE graceful disconnect problem
Yes I will second that "esp_ble_gattc_close" is the correct function to call to disconnect from a peripheral.
The register and un-register api calls are to register an application callback with the stack.
In my application i register 3 of these (My application can handle up to 3 connected peripherals at a time) at startup, then I never un-register these applications.
The register and un-register api calls are to register an application callback with the stack.
In my application i register 3 of these (My application can handle up to 3 connected peripherals at a time) at startup, then I never un-register these applications.
Who is online
Users browsing this forum: No registered users and 59 guests