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

Function to collate data from Advertisement and Scan Response packets?

If I understand correctly, a peripheral can distribute data such as UUID, device name, flags, appearance etc. between advertisement and scan response packets. To gather all the data provided by an advertising peripheral it is necessary to receive both packets and then extract and store this information.

Before I write my own function to do this, are there any existing functions (or examples) in the SDK to perform the task of collating data from advertisement and scan response packets?

Parents
  • Hi Chris,

    When scanning for devices using the S120 or S130, the SoftDevice provides an advertising report as a callback. I'm not 100% sure, but I believe scanning with automatically request a scan response from the device. If it provides one, then the scan response data will be provided as an additional advertising report event with its scan_rsp bit set to 1 indicating scan response data. You can check out this structure here: infocenter.nordicsemi.com/.../structble__gap__evt__adv__report__t.html

    I think you'll have to write your own structure to contain these bits of information but it could be something simple such as:

    struct advertising_data_s {
        uint8_t adv_data[32];
        uint8_t scn_data[32];
    }
    

    Then you can copy the data into the structure based on that scan_rsp parameter of the event and process it later.

    Hope this helps,

    Eric

  • The thing is that various possible items of data - UUID, flags, name etc. - can appear in either (or neither) structure, plus there may be advertisements and scan response reports coming in from various devices with different MAC addresses. It would be nice to have a function that automatically takes each report, detects and extracts whatever information is available, collates it with the MAC address of the source, and stores it. Then, at the end of a period of scanning, it would be easy to see what peripherals are present and the data provided by each.

Reply
  • The thing is that various possible items of data - UUID, flags, name etc. - can appear in either (or neither) structure, plus there may be advertisements and scan response reports coming in from various devices with different MAC addresses. It would be nice to have a function that automatically takes each report, detects and extracts whatever information is available, collates it with the MAC address of the source, and stores it. Then, at the end of a period of scanning, it would be easy to see what peripherals are present and the data provided by each.

Children
No Data
Related