[solved] BLE GATTC: Issue reading advertising/scan response data
Posted: 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:
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
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]);
}
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