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

BEACON SCANNER to read more than 31 byte of advertising data

Hello everyone,

I'm writing a code for Beacon scanner using:

CONTROLLER: nRf52832, 
SDK:                  nRF5_SDK_15.3.0_59ac345
SOFTDEVICE:  s132_nrf52_6.1.1_softdevice.hex

I'm using "ble_app_uart_c" code as a Beacon scanner.


On debugging, the code hits the function "nrf_ble_scan_on_ble_evt" in file "nrf_ble_scan.c" and i can see 31 byte of beacon data
in *(&p_ble_evt->evt.gap_evt.params.adv_report.data.p_data[0 to 30]))

But the problem is my beacon device "MokoVeacon" transmit more than 31 bytes of data which includes Accelerometer data and also Txpower.

(http://doc.mokotechnology.com/index.php?s=/page/26)

How to read more than 30 Bytes of Advertising data, i have changed various possible things to change ADVERTISING Data size, but failed.

Can some one please help me on this...

Thanks.

  • Hi,

    The scan response comes in a separate event, first, you get the data of the main adv. packet (max. 31 bytes), then you get the scan response. Please verify that you do you get scan response packets. One way you can to that is to check the scan response bit in your scanner callback as shown below.

    static void scan_evt_handler(scan_evt_t const * p_scan_evt)
    {
        ret_code_t err_code;
    
        ble_gap_evt_adv_report_t const * adv_report;
    
        switch(p_scan_evt->scan_evt_id)
        {
             case NRF_BLE_SCAN_EVT_NOT_FOUND:
                adv_report = p_scan_evt->params.filter_match.p_adv_report;
    
                if (adv_report->type.scan_response)
                {
                    __BKPT(0); //TODO: parse scan response packet
                }
                break;
    
             default:
                 break;
        }
    }

  • Hi Vidar Berg,

    Have tested the scan response bit in scanner callback, it is hitting the break-point.

    But how can i receive the remaining advertising data (i.e after 31st byte)

    Even in scanner callback i can see only 31 byte of advertising data, also the packet length is 32 bytes

    How to parse scan response packet? can you please help on this..

  • VIGNESH C said:
    But how can i receive the remaining advertising data (i.e after 31st byte)

     It comes in two separate events. Max. payload for each event is 31 bytes.

    VIGNESH C said:
    How to parse scan response packet? can you please help on this..

    You can probably to in the same way as you did for the main advertisement packet. Can you post some code snippets so I can see how you have implemented this?

  • Hi Vidar Berg,

    Now i'm able to receive entire advertising data. Has received the remaining advertising data in separate event.

    Thanks for the help.

Related