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

S120 - incomplete advertising data (no service data, name)

Hi,

I'm developing beacon-scanner software using nrf51822 and S120 softdevice. Using softdevice v1.0.1.

I need to scan ibeacon type advertising devices and get service-specific data from them, which is broadcasted.

I cannot get some data on S120 SD. When using nRF Master Control Panel i get in advertise: flags (0x01) full iBeacon data (0xFF), Complete local name (0x09), TX Power Level (0x0A) and Service data (0x16) - screens in attachment. On S120 SD i get only flags (0x01) and manuf specific data (ibeacon, 0xFF).

I predict that's because adv_data buffer is only 32 bytes long. I get 30 bytes of data. It's possible to get all advertising data? I need access to service data (0x16) and device name.

Screens (because of privaty policy i've hidden device-specific data): Beacon data  view Raw data

S120 code:

static void on_ble_evt(ble_evt_t * p_ble_evt)
{
    uint32_t                err_code;
    const ble_gap_evt_t   * p_gap_evt = &p_ble_evt->evt.gap_evt;

    switch (p_ble_evt->header.evt_id)
    {
        case BLE_GAP_EVT_ADV_REPORT:
        {
            data_t adv_data;
            data_t type_data;
						const ble_gap_addr_t* addr;
					
            // Initialize advertisement report for parsing.
						adv_data.p_data = (uint8_t *)p_gap_evt->params.adv_report.data;
            adv_data.data_len = p_gap_evt->params.adv_report.dlen;
						addr = &p_gap_evt->params.adv_report.peer_addr;
						uint8_t dev_addr[6] = {0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX};
									    					
						if(memcmp(addr->addr,dev_addr, 6))
							break;					
						APPL_LOG("[SCAN]: Device: %X:%X:%X:%X:%X:%X RSSI: %d\r\n",addr->addr[0], addr->addr[1], addr->addr[2],     																												 addr->addr[3], addr->addr[4], addr->addr[5],    																												 p_gap_evt->params.adv_report.rssi);    						
						APPL_LOG("Len:  %d\r\n", adv_data.data_len);
						APPL_LOG("Data: ");
						for(int i = 0; i < adv_data.data_len; i++)
							APPL_LOG("%02X ", adv_data.p_data[i]);
						APPL_LOG("\r\n");
				
}}}

Data i get in serial port: Serial port received data Tried to use S120 v.2.0 but cannot find any working example.

  • In your application on the nRF51 are you setting up for Active Scanning or Passive Scanning?

    Passive Scanning will only get you the first (up to) 31 bytes of advertising data that are in the main advertising packet.

    If you are Active Scanning, your Central/Observer will follow up the receipt of an advertising packet by sending a SCAN_REQ(uest). The SCAN_RSP (response) will contain up to an additional 31 bytes of advertising data.

    The iBeacon spec which calls for a Flags element and an iBeacon format Manufacturer Specific Data element eats up all but one byte of the main advertising packet. A SCAN_REQ/SCAN_RSP sequence is required to get the rest of the data if it exists.

    As I recall, if the Peripheral/Broadcaster is responding to Scan Requests and has Scan Response data defined you will get a two events: one for the main advertising packet and one for the secondary packet.

    BTW, Master Control Panel does Active Scanning...

    Cheers!

    --- ta2

  • Hi

    Have you examined if you can receive the scan response packet as a second packet? To get scan response packets, I assume you need to set

    m_scan_param_active = 1

    before scan start.

Related