Page 1 of 1
Cannot get all characteristics of a service
Posted: Mon Apr 03, 2017 8:21 pm
by james89
From what I understand the
Code: Select all
esp_ble_gattc_get_characteristic()
is called with
= NULL to get the first characteristic, and then in the callback
,
Code: Select all
esp_ble_gattc_get_characteristic()
is called again with
= char_id received to get the next characteristic.
When I do this however I keep getting:
E (12025) App: get_char.status: 0x85
E (12029) BT: btc_to_bta_uuid UUID len is invalid 0
This happens for both 16 bit UUIDs and 128 bit UUIDs.
Can anyone help?
Re: Cannot get all characteristics of a service
Posted: Tue Apr 04, 2017 5:09 am
by kolban
Your theory looks sound but the devil will undoubtedly be in the details. What I'd suggest is to create the smallest application possible that attempts to achieve what you want (i.e. remove all code unrelated to the problem area) and validate that you are still getting the error. Then, when done, attach it to this thread and let the community take a look in context. Ideally describe your thinking and for extra credit, post the whole solution ready to be compiled on Github under your respository so that others can download, compile and test on their devices.
Re: Cannot get all characteristics of a service
Posted: Tue Apr 04, 2017 5:58 am
by dave111
Hi james89, the exact same thing is happening to me, too. But it only happens in combination with certain peripherals. For instance, it never happens with Android (Bluedroid) based peripherals. Android peripherals always let my ESP32 fetch all characteristics. The problem occurs when I connect my ESP32 to a peripheral based on Bluez. Bluez-based peripherals give me this problem every the time. It is absolutely consistent.
Interestingly: If I use some other client (say, an Android client), the same Bluez-based peripheral lets me fetch all characteristics. So it is not simply an issue with Bluez. The problem seems to occur only in this combination: ESP32 as client, peripheral based on Bluez. What Bt stack does your peripheral use?
Re: Cannot get all characteristics of a service
Posted: Tue Apr 04, 2017 3:48 pm
by james89
I am using the example gatt_client from the espressif github:
https://github.com/espressif/esp-idf/tr ... att_client
I just modified the ESP_GAP_BLE_SCAN_RESULT_EVT() callback to look for my peripheral and connect to it, everything else is the same.
What is interesting is that I do get the first characteristic for each service, but I cannot get the rest of a service's characteristics.
Hi dave111, my peripheral is a BT module from Nordic Semiconductor so its their own BT stack. But I have tried it with many other types of peripherals like Apple TVs, Amazon Echos, and connectBlue devices and the result is the same.
Re: Cannot get all characteristics of a service
Posted: Tue Apr 04, 2017 9:26 pm
by james89
I figured out the problem. In the call to esp_ble_gattc_get_characteristic() I was passing in p_data->search_res.srvc_id for the srvc_id param, the correct srvc_id to use is p_data->get_char.srvc_id.
Re: Cannot get all characteristics of a service
Posted: Wed Apr 05, 2017 1:01 am
by kolban
@james89,
Great find and glad it works. Thank you especially for taking the time to help future users and readers by posting the error and what you did to correct.