BluetoothLEAdvertisementWatcher
BluetoothLEAdvertisementWatcher
BluetoothLEAdvertisementWatcher
BluetoothLEAdvertisementWatcher
Class
Definition
An object to receive Bluetooth Low Energy (LE) advertisements.
public : sealed class BluetoothLEAdvertisementWatcher : IBluetoothLEAdvertisementWatcherpublic sealed class BluetoothLEAdvertisementWatcher : IBluetoothLEAdvertisementWatcherPublic NotInheritable Class BluetoothLEAdvertisementWatcher Implements IBluetoothLEAdvertisementWatcher// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Constructors
BluetoothLEAdvertisementWatcher() BluetoothLEAdvertisementWatcher() BluetoothLEAdvertisementWatcher() BluetoothLEAdvertisementWatcher()
Creates a new BluetoothLEAdvertisementWatcher object.
public : BluetoothLEAdvertisementWatcher()public BluetoothLEAdvertisementWatcher()Public Sub New()// You can use this method in JavaScript.
- See Also
BluetoothLEAdvertisementWatcher(BluetoothLEAdvertisementFilter) BluetoothLEAdvertisementWatcher(BluetoothLEAdvertisementFilter) BluetoothLEAdvertisementWatcher(BluetoothLEAdvertisementFilter) BluetoothLEAdvertisementWatcher(BluetoothLEAdvertisementFilter)
Creates a new BluetoothLEAdvertisementWatcher object with an advertisement filter to initialize the watcher.
public : BluetoothLEAdvertisementWatcher(BluetoothLEAdvertisementFilter advertisementFilter)public BluetoothLEAdvertisementWatcher(BluetoothLEAdvertisementFilter advertisementFilter)Public Sub New(advertisementFilter As BluetoothLEAdvertisementFilter)// You can use this method in JavaScript.
- advertisementFilter
- BluetoothLEAdvertisementFilter BluetoothLEAdvertisementFilter BluetoothLEAdvertisementFilter BluetoothLEAdvertisementFilter
The advertisement filter to initialize the watcher.
- See Also
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// You can use this property in JavaScript.
- Value
- BluetoothLEAdvertisementFilter BluetoothLEAdvertisementFilter BluetoothLEAdvertisementFilter BluetoothLEAdvertisementFilter
Configuration of Bluetooth LE advertisement filtering that uses payload section-based filtering.
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// You can use this property in JavaScript.
- Value
- TimeSpan TimeSpan TimeSpan TimeSpan
The maximum out of range timeout.
MaxSamplingInterval MaxSamplingInterval MaxSamplingInterval MaxSamplingInterval
Gets the maximum sampling interval.
public : TimeSpan MaxSamplingInterval { get; }public TimeSpan MaxSamplingInterval { get; }Public ReadOnly Property MaxSamplingInterval As TimeSpan// You can use this property in JavaScript.
- Value
- TimeSpan TimeSpan TimeSpan TimeSpan
The maximum sampling interval.
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// You can use this property in JavaScript.
- Value
- TimeSpan TimeSpan TimeSpan TimeSpan
The minimum out of range timeout.
MinSamplingInterval MinSamplingInterval MinSamplingInterval MinSamplingInterval
Gets the minimum sampling interval.
public : TimeSpan MinSamplingInterval { get; }public TimeSpan MinSamplingInterval { get; }Public ReadOnly Property MinSamplingInterval As TimeSpan// You can use this property in JavaScript.
- Value
- TimeSpan TimeSpan TimeSpan TimeSpan
The minimum sampling interval.
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// You can use this property in JavaScript.
- Value
- BluetoothLEScanningMode BluetoothLEScanningMode BluetoothLEScanningMode BluetoothLEScanningMode
The Bluetooth LE scanning mode.
- See Also
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// You can use this property in JavaScript.
- Value
- BluetoothSignalStrengthFilter BluetoothSignalStrengthFilter BluetoothSignalStrengthFilter BluetoothSignalStrengthFilter
Configuration of Bluetooth LE advertisement filtering that uses signal strength-based filtering.
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// You can use this property in JavaScript.
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// You can use this method in JavaScript.
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.
- See Also
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// You can use this method in JavaScript.
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.
- See Also
Events
Received Received Received Received
Notification for new Bluetooth LE advertisement events received.
public : event TypedEventHandler Received<BluetoothLEAdvertisementWatcher, BluetoothLEAdvertisementReceivedEventArgs>public event TypedEventHandler Received<BluetoothLEAdvertisementWatcher, BluetoothLEAdvertisementReceivedEventArgs>Public Event Received<BluetoothLEAdvertisementWatcher, BluetoothLEAdvertisementReceivedEventArgs>// You can use this event in JavaScript.
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 Stopped<BluetoothLEAdvertisementWatcher, BluetoothLEAdvertisementWatcherStoppedEventArgs>public event TypedEventHandler Stopped<BluetoothLEAdvertisementWatcher, BluetoothLEAdvertisementWatcherStoppedEventArgs>Public Event Stopped<BluetoothLEAdvertisementWatcher, BluetoothLEAdvertisementWatcherStoppedEventArgs>// You can use this event in JavaScript.