[solved] BLE GATTC: Issue reading advertising/scan response data

Lucas.Hutchinson
Posts: 79
Joined: Tue Apr 26, 2016 5:10 am

[solved] BLE GATTC: Issue reading advertising/scan response data

Postby Lucas.Hutchinson » Wed Feb 22, 2017 11:07 pm

Hi all,

Hopefully this has not been previously reported.
I am using the esp-idf with the GATT_Client example.
I am currently at commit: 61c7bd3, as and commit after this when i try to load either the GATT_Client or GATT_Server examples i get the "NVDS MAGIC FAILED" error. But that is an issue for another thread.

I am currently looking into the reading and resolving the advertising and scan response data when performing a BLE scan.

This scan returns various BLE devices I have around me, including another esp32 running an un-modified version of the GATT_Server example.

However for some reason when I look at the raw advertising data, after the 31st byte the data seems to either be 0x00 or garbage. This means that on some devices only half of the device name is decoded, on others the 128bit uuid is incomplete.

The GATT_Client seems to be receiving at least part of the scan response data as on one of the devices, part of the data that is in the response packet (at least the first few bytes) are contained in this first 31 bytes.

I initially discovered this when trying to resolve the name of a device which has the full device name in the scan response data rather than the advertising data.

I am reading the raw data using:

Code: Select all

 case ESP_GAP_BLE_SCAN_RESULT_EVT: {
        esp_ble_gap_cb_param_t *scan_result = (esp_ble_gap_cb_param_t *)param;
        switch (scan_result->scan_rst.search_evt) {
        case ESP_GAP_SEARCH_INQ_RES_EVT:
			printf("\nRAW: ");
			for(int j=0; j<62; j++)
			{
				printf("%c", scan_result->scan_rst.ble_adv[j]);
			}
			
I seem to be able to decode/read other data within the scan result.
Eg, i can read the RSSI and it doesn't seem to be garbage (eg it returns plausible results such as -55dBm)

Please let me know if I am doing something wrong, if you need more information, or if you have a solution.

EDIT: This has now been solved. please refer to issue #369 on the esp-idf github
Last edited by Lucas.Hutchinson on Thu Mar 02, 2017 5:22 am, edited 1 time in total.

Lucas.Hutchinson
Posts: 79
Joined: Tue Apr 26, 2016 5:10 am

Re: BLE GATTC: Issue reading advertising/scan response data

Postby Lucas.Hutchinson » Thu Feb 23, 2017 8:04 pm

Hi All,

Just wondering if anyone has any information about this issue?

Also there was mention in the github issues section that there might be a bit of a re-work or improvement to the ble api?
Is this going to be the case, and if so what sort of timeframe might we expect for this?
@ESP_igrr

Thanks!
Lucas

Lucas.Hutchinson
Posts: 79
Joined: Tue Apr 26, 2016 5:10 am

Re: BLE GATTC: Issue reading advertising/scan response data

Postby Lucas.Hutchinson » Mon Feb 27, 2017 7:50 pm

Is there any update on this issue?

I have also reported this as an issue on github, but I have not got a response there either. (issue #369).

There were mentions of various improvements to the BLE stack/examples mentioned in the forum. Are these still in progress?
As i have mentioned in another post it would be good to have improved examples.

In particular on gatt_server:
- clearer examples/documentation on how to setup a service
- how to then add multiple characteristics to this service
- How to handle the the client characteristic configuration (eg notifications)
- How and where to alter and set values for particular characteristics.

An example such as a UART<->BLE bridge on both the GATT_Server and GATT_Client would be very useful, both as an example and as a way of explaining what certain stack functions do and how we should use the BLE stack.

Who is online

Users browsing this forum: wevets and 36 guests