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

device name

Hi,

  • I am developing a device using the PCA10028 Dev Kit
  • It is configured as a BLE Central, SDK 7.2, SD 120
  • I am starting out with the example "ble_app_hrs_c_s120_pca10028"
  • I have a DIFFERENT device that advertises as follows:
  • It says "SHNxxxxxxxx" where the "xxxxxxxx" is the MAC address of the chip
  • This allows me to know that the device is one of mine, since it prepends the SHN to the MAC adderss
  • When I scan using nRF Toolbox's UART, I can see my device as SHN3E96E1AE, for example
  • Below that, it also shows me the MAC address: EE:47:3E:96:E1:AE
  • My question is this:
    • How do I get the SHN3E96E1AE in my BLE Central device?
  • I can get the MAC address just fine
  • I can also get the RSSI
  • but I can't find the SHN....
  • I don't even know what to call that, when I search on line
  • When I obtain the Device Name from the advertising info, I get "NRF51822"....

Thanks for your help!

Parents
  • Hi,

    The advertised name can be parsed from the advertising data in the advertising report, as shown in ble_app_multilink_central example:

    case BLE_GAP_EVT_ADV_REPORT:
        {
            data_t adv_data;
            data_t type_data;
    
            // Initialize advertisement report for parsing.
            adv_data.p_data = p_ble_evt->evt.gap_evt.params.adv_report.data;
            adv_data.data_len = p_ble_evt->evt.gap_evt.params.adv_report.dlen;
    
            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);
            }
        }

    Best regards,
    Jørgen

Reply
  • Hi,

    The advertised name can be parsed from the advertising data in the advertising report, as shown in ble_app_multilink_central example:

    case BLE_GAP_EVT_ADV_REPORT:
        {
            data_t adv_data;
            data_t type_data;
    
            // Initialize advertisement report for parsing.
            adv_data.p_data = p_ble_evt->evt.gap_evt.params.adv_report.data;
            adv_data.data_len = p_ble_evt->evt.gap_evt.params.adv_report.dlen;
    
            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);
            }
        }

    Best regards,
    Jørgen

Children
Related