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

How can I get Manufacturer Specific Data in central with advertising packet (sdk15 nRF52832)

Although I have already seen this discussion (https://devzone.nordicsemi.com/f/nordic-q-a/35183/no-idea-how-to-get-manufacturer-specific-data-in-central-side-from-advertising-packet-sdk15-nrf52832), I have no idea to use ble_advdata_search() function. If my device manufacturer data through android app named nRF Connect display like this 0x5900232034850009000000000000834F05. How can I determine length for ble_advdata_search() function?

Parents
  • Hi,

    You can try something like this:

    uint8_t * ble_advdata_manuf_data_find(const ble_data_t * p_adv_data, uint8_t * manuf_data_length)
    {
        uint16_t data_offset = 0;
        *manuf_data_length = ble_advdata_search(p_adv_data->p_data,
                                             p_adv_data->len,
                                             &data_offset,
                                             BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA);
    
        return &p_adv_data->p_data[data_offset];
    }
    
    ....
    
    static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
    {
        ....
    
        switch (p_ble_evt->header.evt_id)
        {
            case BLE_GAP_EVT_ADV_REPORT:
                ...
                uint8_t manuf_data_len;
                uint8_t * manuf_data = ble_advdata_manuf_data_find(&p_gap_evt->params.adv_report.data, &manuf_data_len);

    The function ble_advdata_manuf_data_find() will return a pointer to your manufacturer data and set manuf_data_length to the length of the data. 

Reply Children
No Data
Related