I have a question on how to retrieve the Local Name after scanning BLE and retrieved its Adv Data. Currently I am using CYBT-213043 Mesh Kit and after following lots of information in the forum I manage to get information all scanned devices from mesh_application.c (mesh_adv_report()).
I also have an application in my phone that provides information about nearby devices, see in the attachment picture, there is an information about its local name which is "Amazfit GTR".
So I am adding wiced_bt_ble_check_advertising_data() in the code with BTM_BLE_ADVERT_TYPE_NAME_COMPLETE and also BTM_BLE_ADVERT_TYPE_NAME_SHORT but still, I cant see the in the result of scanned of adv data.
Would you kindly guide me on how to retrieve that local name in my code ? so far I can only see the RSSI, MAC, ble_addr_type, ble_evt_type and p_adv_data (I think its raw data). Below is the usage of the code wiced_bt_ble_check_advertising_data() that I am using, just in case I am doing wrongly in here.
uint8_t p_len = 0;
p_name = wiced_bt_ble_check_advertising_data(p_adv_data, BTM_BLE_ADVERT_TYPE_NAME_COMPLETE , &p_len);
if( p_len > 0 )
WICED_BT_TRACE(" checked_adv_data: ");
for(int i=0; i<p_len; i++)
WICED_BT_TRACE("%02X", p_name[i + 1]);
Thanks and Best Regards,
Please refer the below code to understand the usage. Can you try using memcpy and print the name?
Thank you for link and I did follow with memcpy and printing the name, it is still the same actually, still cannot get the Local Name. I did some experiment (to make sure my code alright), I set my bluetooth mouse unpair and let it broadcast at that state and I can see via (wiced_bt_ble_check_advertising_data()) but ... sadly only that mouse among other devices.
So I proceed further, create some dummy project with changes in this code
wiced_bt_cfg_settings.device_name = (uint8_t *)"Can U See Me";
and I scan it with mesh app (during device registering) and I can see that device, see below :
And I also check with the other app (lightblue), it is detected ... and I can see that name, see below :
But unfortunately cannot be detected via code (wiced_bt_ble_check_advertising_data()), no name can be retrieved, could you try my experiment at your end too just to make sure that perhaps I am doing something wrong or different, thanks.