Unable to read characteristics since new API

f.h-f.s.
Posts: 214
Joined: Thu Dec 08, 2016 2:53 pm

Unable to read characteristics since new API

Postby f.h-f.s. » Tue Oct 31, 2017 12:36 pm

Since the new GATTC API I am unable to read the characteristics.

The same flow is used.
Scan for advertising devices and gattc_open the proper device.
A GATTC_CONNECT event is followed by a GATTC_OPEN event.
A ESP_GAP_BLE_SEC_REQ_EVT is raised and we respond with true.
The devices successfully pair after confirming on the android phone app.
MTU is configured and we call esp_ble_gattc_search_service().
A service is found in the SEARCH_RES_EVT.

The search completes and we call esp_ble_gattc_read_char(gattc_if, conn_id, 0xff00, ESP_GATT_AUTH_REQ_SIGNED_NO_MITM); This is the only call we changed in our sources.

Resulting in a ESP_GATTC_READ_CHAR_EVT with read.status == ESP_BT_STATUS_FAIL.


I noticed a error:
E (1808) BT: bta_gattc_cache_write: can't open GATT cache file for writing: /data/misc/bluetooth/gatt_cache_6789c2b071c6, errno: 2, No such file or directory
It seems bta_gattc_cache_write wants to open a file for writing.
I mounted the wear_level filesystem and hardcoded the filepath, the error disappeared but I am still unable to read my characteristic.

log output: https://pastebin.com/7qCUn2ZA
log with BT_TRACE_LEVEL_VERBOSE https://pastebin.com/bhR5t4ks

How do I find out why the read characteristic is failing?
Any help would be appreciated =)

f.h-f.s.
Posts: 214
Joined: Thu Dec 08, 2016 2:53 pm

Re: Unable to read characteristics since new API

Postby f.h-f.s. » Thu Nov 02, 2017 1:43 pm

esp_ble_gattc_get_char_by_uuid() returns a type that contains a char_handle.
My problem was I didnt know the handle is not the same as a 16bit uuid.

Who is online

Users browsing this forum: MicroController and 196 guests