ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
esphome::bluetooth_proxy::AdvertisementFilter Struct Reference

Predicate slot letting an external component drop advertisements before they are queued for the API. More...

#include <bluetooth_proxy.h>

Public Member Functions

bool is_set () const
 A default-constructed slot is "no filter"; the proxy guards on this.
 
bool should_forward (const ble_device_base::RawAdvertisement &adv) const
 

Data Fields

void * instance {nullptr}
 
bool(* fn )(void *instance, const ble_device_base::RawAdvertisement &adv)
 

Detailed Description

Predicate slot letting an external component drop advertisements before they are queued for the API.

Same shape as ble_device_base::RawAdvertisementCallback. Runs on the advertisement hot path, so it must be cheap and must not block.

Usage: proxy->set_advertisement_filter({this, [](void *self, const ble_device_base::RawAdvertisement &adv) { return static_cast<MyFilter *>(self)->should_forward(adv); }});

Returning false drops the advertisement. Not called at all while the API is disconnected, which matters to a stateful filter. Compiled in only when an external component calls bluetooth_proxy.enable_advertisement_filter().

Definition at line 114 of file bluetooth_proxy.h.

Member Function Documentation

◆ is_set()

bool esphome::bluetooth_proxy::AdvertisementFilter::is_set ( ) const
inline

A default-constructed slot is "no filter"; the proxy guards on this.

Definition at line 118 of file bluetooth_proxy.h.

◆ should_forward()

bool esphome::bluetooth_proxy::AdvertisementFilter::should_forward ( const ble_device_base::RawAdvertisement & adv) const
inline

Definition at line 119 of file bluetooth_proxy.h.

Field Documentation

◆ fn

bool(* esphome::bluetooth_proxy::AdvertisementFilter::fn) (void *instance, const ble_device_base::RawAdvertisement &adv)
inline

Definition at line 116 of file bluetooth_proxy.h.

◆ instance

void* esphome::bluetooth_proxy::AdvertisementFilter::instance {nullptr}

Definition at line 115 of file bluetooth_proxy.h.


The documentation for this struct was generated from the following file: