Page 1 of 1

Unable to read characteristics since new API

Posted: Tue Oct 31, 2017 12:36 pm
by f.h-f.s.
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:

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

Re: Unable to read characteristics since new API

Posted: Thu Nov 02, 2017 1:43 pm
by f.h-f.s.
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.