how can i scan ibeacon name and mac address by using nRF51 ?
do you have sample code for keil ?
how can i scan ibeacon name and mac address by using nRF51 ?
do you have sample code for keil ?
Hi,
I recommend to download nRF5 SDKv12.3 and look at the multilink central example:
\nRF5_SDK_12.3.0_d7731ad\examples\ble_central\ble_app_multilink_central\pca10028\s130\arm5_no_packs
The multilink central example is setup to connect to specific peripheral devices, so in your case you need to modify on_adv_report() in main.c to output for instance peer_addr and advertisment content instead of connecting.
Best regards,
Kenneth
Hi,
I recommend to download nRF5 SDKv12.3 and look at the multilink central example:
\nRF5_SDK_12.3.0_d7731ad\examples\ble_central\ble_app_multilink_central\pca10028\s130\arm5_no_packs
The multilink central example is setup to connect to specific peripheral devices, so in your case you need to modify on_adv_report() in main.c to output for instance peer_addr and advertisment content instead of connecting.
Best regards,
Kenneth
Thank for your reply
i can get mac address and name for normal BLE,
but for ibeacon tag i get mac address only.
err_code = adv_report_parse(BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME, &adv_data, &type_data); if (err_code != NRF_SUCCESS) { // Compare short local name in case complete name does not match. err_code = adv_report_parse(BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME, &adv_data, &type_data); } if (err_code == NRF_SUCCESS) { //NRF_LOG_PRINTF("Succes: %d \r\n", i); if (err_code == NRF_SUCCESS) { NRF_LOG_PRINTF("Name: "); char name[50]; for(int i = 0 ; i < type_data.data_len ;i++) { name[i] = type_data.p_data[i]; name[i+1] = 0; } NRF_LOG_PRINTF(name); NRF_LOG_PRINTF(" MAC [%02X:%02X:%02X:%02X:%02X:%02X]", peer_addr->addr[5], peer_addr->addr[4], peer_addr->addr[3], peer_addr->addr[2], peer_addr->addr[1], peer_addr->addr[0]); NRF_LOG_PRINTF("\r\n"); } }
my output log
Name: Tile MAC [DA:CC:8B:E8:8F:5A] // Success Name: Tile
Name: N/A MAC [22:F1:E9:37:90:21] // Can't get name (ibeacon tag)
Name: N/A MAC [27:E2:B9:B6:F8:59] // Can't get name (ibeacon tag)
Hi,
You can read about the ibeacon format here: https://developer.apple.com/ibeacon/
It does not contain a name.
Best regards,
Kenneth
Thank you Kenneth
i just start on this project. i just wonder why in phone can scan name and nRF51 can get only mac address for some device.
scan from phone
scan from nRF51
Name: N/A MAC [CF:A4:7E:29:AE:A6]
Name: Tile MAC [DA:CC:8B:E8:8F:5A]
Interesting, it might be that the name is cached somehow in the OS (e.g. have this device been connected as a different device previously during development)?
If you download the nRF Sniffer tool, then you can see the actual content on air to confirm:
https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF-Sniffer
Best regards,
Kenneth