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

Unexpected packet in beacon scanner.

Hi.

I'm currently receiving advertisement packet from beacon scanner app. (nrf51822) (ble_peripheral/experimental_ble_app_multiactivity_beacon/hrs_scanner)

I tried to receive advertise packet with only specified UUID.

To do that I checked UUID in p_evt handler function as follows.

beacon_evt_handler(ble_scan_beacon_evt_t * p_evt) {
   if(uuid_cmp(p_evt->rcv_adv_packet.adv_data.uuid.uuid128, specified_UUID, UUID_LENGTH) {
      ....
   }
}

I compared "p_evt->rcv_adv_packet.adv_data.uuid.uuid128" value with specified UUID. (for ex. 0x00112233445566778899aabbccddeeff)

And I set up another nrf51822 board as a beacon advertising with specified UUID.

So, there're 1 beacon scanner & 1 beacon configured for a certain UUID.

I guessed that beacon scanner would get advertisement packet of UUID(0x001122...) only from that beacon.

But, not like my expectation, other advertisement packets comes into beacon scanner.

I mean, other beacon(that are configured to have different UUID) advertisement packets.

That packets has unexpected value but with specified UUID.(0x001122...)

I don't understand how other beacon's advertisement packet has custom UUID.

I checked out address value of these strange packets.

and I found that owners of these packet are other devices. ( other beacon scanner, ble device - not iBeacon device, etc)

But, there's no clue how they have same UUID that I specified as custom. (0x001122...)

Is there some sort of broadcasting feature in ble or beacon? (If it is, then, how can I filter out that?)

And one more question for setting up beacon scanner.

Is it possible to setup beacon scanner without advertising?

When I stop advertising in beacon scanner it dies.

I just want to receive advertisement of other beacons. not advertising.

Thanks in advance.

  • Hello.

    When scanning, you will get advertising packets from all devices around you. It is up to you to filter the advertisement packets (Like you are doing in beacon_evt_handler). It does not make any sense that the other advertisement packets have the same uuid. Are you sure of this? Maybe there is a bug in uuid_cmp? For example if the uuid is NULL?

    Is there some sort of broadcasting feature in ble or beacon?

    Yes. Broadcasting and advertising is basically the same thing. Non-connectible advertising is often called broadcasting. This is how a BLE beacon broadcasts its packets. A BLE beacon is simply a device advertising a specific packet with the "non-connectible" flag set. You cannot filter it out, as it is what you are scanning for.

    Is it possible to setup beacon scanner without advertising?

    Yes. In main(), the line

    err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
    

    starts the advertising.

  • Thank you for your kind answer. Scanning without advertising is working nicely. But, for the problem of unexpected packet still not understanding. First of all, uuid_cmp() function is working correctly. (I checked the uuid value using debugger and it is not NULL.) But there's something strange I found out. These unexpected packets comes in scanner only when there's a beacon who is advertising for custom UUID. If I turn off a beacon which is advertising with specified UUID, unexpected packet doesn't apear in a scanner. So, my thinking is something like collision is happening when a beacon advertise. Any idea for this situation? Thanks. +) One more thing, all these unexpected packet has the same major, minor value but just have different addr(which is not fake, but an address of real ble device).

  • I checked out one of the address in the strange packet. and setup nrf sniffer to see if the device with that address is really advertising with specified UUID. But, in the sniffer, there's no packet with specified UUID. In summary, it seems like those strange packet is not actually come from other ble device. but these packets comes in scanner with address of ble devices. I'm now confusing why these packet is scanned in scanner. For your reference, this is uuid_cmp() function.

    static uint8_t uuid_cmp(const unsigned char *strA, const unsigned char *strB, unsigned int size) {
    int i = 0;
    
    int ret = 0;
    
    
    for(i = 0; i<size;i++) {
    	if(strA[i] == strB[i])
    		ret++;
    }
    return (ret == size);
    }
    
  • So other devices are advertising beacon packets with the custom UUID you created? It might seem that the uuid field is not deleted between each scan result.

  • On line 238 of scanner_beacon.c, try changing

    ble_scan_beacon_evt_t evt;
    

    to

    ble_scan_beacon_evt_t evt;
    memset(&evt, 0, sizeof(evt))
    
Related