Filtering advertisements based on target apperance

I am currently struggling with filtering based on appearance using the Scanning module.

I have a beacon that advertises some dummy data, appearance and service UUID. With the scanning module I was able to filter this advertisement from other advertisements by testing it in an environment with a lot of BLE devices. However, whenever I try to filter both service UUID and appearance or just appearance I do not receive any advertisements that matches with these filters.

The code below works fine.

err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_UUID, &beacon_service_uuid);
	if (err) {
		printk("Service UUID scan filter cannot be set (err %d)\n", err);

		return err;
	}
	
err = bt_scan_filter_enable(BT_SCAN_UUID_FILTER, true);
	if (err) {
		printk("UUID filters cannot be enabled (err %d)\n", err);
		return err;
	}


The following however does not work
err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_APPEARANCE, &beacon_appearance_uuid);
	if (err) {
	    printk("Appearance UUID scan filter cannot be set (err %d)\n", err);
	    return err;
	}

err = bt_scan_filter_enable(BT_SCAN_APPEARANCE_FILTER, true);
	if (err != 0) {
	    printk("Scan filters cannot be enabled (err %d)\n", err);
	    return err;
	}


I can try to do the filtering whenever I parse the data, but I would like to see if I can already filter advertisements with the filters.

Parents
  • Hi,

    I have not tested this myself but it should work.

    Have you enabled the combined filter like below

    err = bt_scan_filter_enable(BT_SCAN_UUID_FILTER | BT_SCAN_APPEARANCE_FILTER, true);

    If yes. Can you tell me the value of the appearance that you have set in beacon_appearance_uuid, so that I can give a quick test?

  • Hi,

    Thanks for responding! I have tested the line that you have send me before, but that sadly did not work either. For now I am just trying to get the appearance filter to work so I left the service UUID filtering out for now, but it would be great if I can get it working together.

    For beacon_appearance_uuid I am using BT_APPEARANCE_GENERIC_SENSOR. When using the nRF Connect for Mobile App I can see that my beacon is advertising the correct value.


Reply
  • Hi,

    Thanks for responding! I have tested the line that you have send me before, but that sadly did not work either. For now I am just trying to get the appearance filter to work so I left the service UUID filtering out for now, but it would be great if I can get it working together.

    For beacon_appearance_uuid I am using BT_APPEARANCE_GENERIC_SENSOR. When using the nRF Connect for Mobile App I can see that my beacon is advertising the correct value.


Children
Related