This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to scan ibeacon mac adress and name using nRF51

how can i scan ibeacon name and mac address by using nRF51 ?

do you have sample code for keil ?

Parents
  • 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)

Reply
  • 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)

Children
Related