BluetoothLEAdvertisementWatcher BluetoothLEAdvertisementWatcher BluetoothLEAdvertisementWatcher BluetoothLEAdvertisementWatcher Class

An object to receive Bluetooth Low Energy (LE) advertisements.

Syntax

Declaration

public sealed class BluetoothLEAdvertisementWatcherpublic sealed class BluetoothLEAdvertisementWatcherPublic NotInheritable Class BluetoothLEAdvertisementWatcher

Constructors summary

Creates a new BluetoothLEAdvertisementWatcher object.

Creates a new BluetoothLEAdvertisementWatcher object with an advertisement filter to initialize the watcher.

Properties summary

Gets or sets a BluetoothLEAdvertisementFilter object used for configuration of Bluetooth LE advertisement filtering that uses payload section-based filtering.

Gets the maximum out of range timeout.

Gets the maximum sampling interval.

Gets the minimum out of range timeout.

Gets the minimum sampling interval.

Gets or sets the Bluetooth LE scanning mode.

Gets or sets a BluetoothSignalStrengthFilter object used for configuration of Bluetooth LE advertisement filtering that uses signal strength-based filtering.

Gets the current status of the BluetoothLEAdvertisementWatcher.

Methods summary

Start the BluetoothLEAdvertisementWatcher to scan for Bluetooth LE advertisements.

Stop the BluetoothLEAdvertisementWatcher and disable the scanning for Bluetooth LE advertisements.

Events summary

Notification for new Bluetooth LE advertisement events received.

Notification to the app that the Bluetooth LE scanning for advertisements has been cancelled or aborted either by the app or due to an error.

Constructors

  • BluetoothLEAdvertisementWatcher()
    BluetoothLEAdvertisementWatcher()
    BluetoothLEAdvertisementWatcher()
    BluetoothLEAdvertisementWatcher()

    Creates a new BluetoothLEAdvertisementWatcher object.

    public BluetoothLEAdvertisementWatcher()public BluetoothLEAdvertisementWatcher()Public Function BluetoothLEAdvertisementWatcher() As
  • BluetoothLEAdvertisementWatcher(Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementFilter)
    BluetoothLEAdvertisementWatcher(Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementFilter)
    BluetoothLEAdvertisementWatcher(Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementFilter)
    BluetoothLEAdvertisementWatcher(Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementFilter)

    Creates a new BluetoothLEAdvertisementWatcher object with an advertisement filter to initialize the watcher.

    public BluetoothLEAdvertisementWatcher(Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementFilter)public BluetoothLEAdvertisementWatcher(Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementFilter)Public Function BluetoothLEAdvertisementWatcher(Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementFilter) As

    Parameters

Properties

  • AdvertisementFilter
    AdvertisementFilter
    AdvertisementFilter
    AdvertisementFilter

    Gets or sets a BluetoothLEAdvertisementFilter object used for configuration of Bluetooth LE advertisement filtering that uses payload section-based filtering.

    public BluetoothLEAdvertisementFilter AdvertisementFilter { get; set; }public BluetoothLEAdvertisementFilter AdvertisementFilter { get; set; }Public ReadWrite Property AdvertisementFilter As BluetoothLEAdvertisementFilter

    Property Value

  • MaxOutOfRangeTimeout
    MaxOutOfRangeTimeout
    MaxOutOfRangeTimeout
    MaxOutOfRangeTimeout

    Gets the maximum out of range timeout.

    public TimeSpan MaxOutOfRangeTimeout { get; }public TimeSpan MaxOutOfRangeTimeout { get; }Public ReadOnly Property MaxOutOfRangeTimeout As TimeSpan

    Property Value

  • MaxSamplingInterval
    MaxSamplingInterval
    MaxSamplingInterval
    MaxSamplingInterval

    Gets the maximum sampling interval.

    public TimeSpan MaxSamplingInterval { get; }public TimeSpan MaxSamplingInterval { get; }Public ReadOnly Property MaxSamplingInterval As TimeSpan

    Property Value

  • MinOutOfRangeTimeout
    MinOutOfRangeTimeout
    MinOutOfRangeTimeout
    MinOutOfRangeTimeout

    Gets the minimum out of range timeout.

    public TimeSpan MinOutOfRangeTimeout { get; }public TimeSpan MinOutOfRangeTimeout { get; }Public ReadOnly Property MinOutOfRangeTimeout As TimeSpan

    Property Value

  • MinSamplingInterval
    MinSamplingInterval
    MinSamplingInterval
    MinSamplingInterval

    Gets the minimum sampling interval.

    public TimeSpan MinSamplingInterval { get; }public TimeSpan MinSamplingInterval { get; }Public ReadOnly Property MinSamplingInterval As TimeSpan

    Property Value

  • ScanningMode
    ScanningMode
    ScanningMode
    ScanningMode

    Gets or sets the Bluetooth LE scanning mode.

    public BluetoothLEScanningMode ScanningMode { get; set; }public BluetoothLEScanningMode ScanningMode { get; set; }Public ReadWrite Property ScanningMode As BluetoothLEScanningMode

    Property Value

  • SignalStrengthFilter
    SignalStrengthFilter
    SignalStrengthFilter
    SignalStrengthFilter

    Gets or sets a BluetoothSignalStrengthFilter object used for configuration of Bluetooth LE advertisement filtering that uses signal strength-based filtering.

    public BluetoothSignalStrengthFilter SignalStrengthFilter { get; set; }public BluetoothSignalStrengthFilter SignalStrengthFilter { get; set; }Public ReadWrite Property SignalStrengthFilter As BluetoothSignalStrengthFilter

    Property Value

    Remarks

    The SignalStrengthFilter has additional limitations on its properties when used by the BluetoothLEAdvertisementWatcher class. An exception will be thrown when the watcher is started with parameters outside of the valid range. If the properties are left as NULL, a default value is selected.

    The additional restrictions and default values are as follows:

    • InRangeThresholdInDBm - The maximum value for RSSI for Bluetooth LE is +20. The minimum value for RSSI for BR/EDR is -127 (default when NULL is -127.
    • OutOfRangeThresholdInDBm - The maximum value for RSSI for Bluetooth LE is +20. The minimum value for RSSI for BR/EDR is -127 (default when NULL is -127).
    • OutOfRangeTimeout - Equal or greater than 1 second and less than or equal to 60 seconds (default when NULL is 60 seconds).
    • SamplingInterval - Equal or greater than 0. Any sampling interval greater or equal to 25.5 seconds will disable sampling entirely. In that special case, the filtering is trigger-based. For more information about the behavior of the RSSI filtering, refer to the BluetoothSignalStrengthFilter.
  • Status
    Status
    Status
    Status

    Gets the current status of the BluetoothLEAdvertisementWatcher.

    public BluetoothLEAdvertisementWatcherStatus Status { get; }public BluetoothLEAdvertisementWatcherStatus Status { get; }Public ReadOnly Property Status As BluetoothLEAdvertisementWatcherStatus

    Property Value

Methods

  • Start()
    Start()
    Start()
    Start()

    Start the BluetoothLEAdvertisementWatcher to scan for Bluetooth LE advertisements.

    public void Start()public void Start()Public Function Start() As void

    Remarks

    This method will transition the BluetoothLEAdvertisementWatcher to the Started state immediately with a pending scan request or to the Aborted state if the request failed immediately due to error.

    If this method is called in the Stopping state, the request will be pended and the state will remain in the Stopping state until the request completes, at which time a new request will be sent and the state will transition to the Started state.

    The BluetoothLEAdvertisementWatcher will be automatically stopped when an app is suspended.

  • Stop()
    Stop()
    Stop()
    Stop()

    Stop the BluetoothLEAdvertisementWatcher and disable the scanning for Bluetooth LE advertisements.

    public void Stop()public void Stop()Public Function Stop() As void

    Remarks

    This method will transition the BluetoothLEAdvertisementWatcher to the Stopping state until the scan is cancelled in which the state will transition to the Stopped state. Calling this method in the Stopped or Aborted state has no effect. Calling this method in the Stopping state will overwrite any advertisements received in the last Start() method call during that state.

    The BluetoothLEAdvertisementWatcher will be automatically stopped when an app is suspended.

    Note

    Stopping the scan for the BluetoothLEAdvertisementWatcher will not actually stop the Bluetooth radio from scanning if another app or the system still requires the radio to remain in a scanning state.

Events

  • Received
    Received
    Received
    Received

    Notification for new Bluetooth LE advertisement events received.

    public event TypedEventHandler Receivedpublic event TypedEventHandler ReceivedPublic Event Received
  • Stopped
    Stopped
    Stopped
    Stopped

    Notification to the app that the Bluetooth LE scanning for advertisements has been cancelled or aborted either by the app or due to an error.

    public event TypedEventHandler Stoppedpublic event TypedEventHandler StoppedPublic Event Stopped

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.ActivatableAttribute

Details

Assembly

Windows.Devices.Bluetooth.Advertisement.dll