BluetoothLEDevice BluetoothLEDevice BluetoothLEDevice Class

Definition

Represents a Bluetooth LE device.

public sealed class BluetoothLEDevice : IBluetoothLEDevice, IBluetoothLEDevice2, IBluetoothLEDevice3, IClosablepublic sealed class BluetoothLEDevice : IBluetoothLEDevice, IBluetoothLEDevice2, IBluetoothLEDevice3, IDisposablePublic NotInheritable Class BluetoothLEDevice Implements IBluetoothLEDevice, IBluetoothLEDevice2, IBluetoothLEDevice3, IDisposable
Attributes
Windows 10 requirements
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)
Capabilities
bluetooth

Properties

Appearance Appearance Appearance

Gets the BluetoothLEAppearance object for the Bluetooth LE device.

public BluetoothLEAppearance Appearance { get; }public BluetoothLEAppearance Appearance { get; }Public ReadOnly Property Appearance As BluetoothLEAppearance
Value
BluetoothLEAppearance BluetoothLEAppearance BluetoothLEAppearance

The appearance for the Bluetooth LE device.

Attributes

BluetoothAddress BluetoothAddress BluetoothAddress

Gets the device address.

public ulong BluetoothAddress { get; }public ulong BluetoothAddress { get; }Public ReadOnly Property BluetoothAddress As ulong
Value
ulong ulong ulong

The address of the device.

Attributes
Additional features and requirements
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)
Capabilities
bluetooth

BluetoothAddressType BluetoothAddressType BluetoothAddressType

Gets the address type for the Bluetooth LE device.

public BluetoothAddressType BluetoothAddressType { get; }public BluetoothAddressType BluetoothAddressType { get; }Public ReadOnly Property BluetoothAddressType As BluetoothAddressType
Attributes

ConnectionStatus ConnectionStatus ConnectionStatus

Gets the connection status of the device.

public BluetoothConnectionStatus ConnectionStatus { get; }public BluetoothConnectionStatus ConnectionStatus { get; }Public ReadOnly Property ConnectionStatus As BluetoothConnectionStatus
Value
BluetoothConnectionStatus BluetoothConnectionStatus BluetoothConnectionStatus

One of the BluetoothConnectionStatus enumeration values that specifies the connection status of the device.

Attributes
Additional features and requirements
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)
Capabilities
bluetooth

DeviceAccessInformation DeviceAccessInformation DeviceAccessInformation

Gets the DeviceAccessInformation.

public DeviceAccessInformation DeviceAccessInformation { get; }public DeviceAccessInformation DeviceAccessInformation { get; }Public ReadOnly Property DeviceAccessInformation As DeviceAccessInformation
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
bluetooth

DeviceId DeviceId DeviceId

Gets the device Id.

public string DeviceId { get; }public string DeviceId { get; }Public ReadOnly Property DeviceId As string
Value
string string string

The Id of the device.

Attributes
Additional features and requirements
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)
Capabilities
bluetooth

DeviceInformation DeviceInformation DeviceInformation

Gets the DeviceInformation object for the Bluetooth LE device.

public DeviceInformation DeviceInformation { get; }public DeviceInformation DeviceInformation { get; }Public ReadOnly Property DeviceInformation As DeviceInformation
Value
DeviceInformation DeviceInformation DeviceInformation

The device information.

Attributes

GattServices GattServices GattServices

Gets the read-only list of GATT services supported by the device.

public IVectorView<GattDeviceService> GattServices { get; }public IVectorView<GattDeviceService> GattServices { get; }Public ReadOnly Property GattServices As IVectorView<GattDeviceService>
Value

The read-only list of GATT services supported by this Bluetooth LE device.

Attributes
Additional features and requirements
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)
Capabilities
bluetooth

Name Name Name

Gets the name of the Bluetooth LE device.

public string Name { get; }public string Name { get; }Public ReadOnly Property Name As string
Value
string string string

The name of the Bluetooth LE device.

Attributes
Additional features and requirements
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)
Capabilities
bluetooth

Methods

Close() Close() Close()

Closes this Bluetooth LE device.

public void Close()This member is not implemented in C#This member is not implemented in VB.Net
Attributes

Dispose() Dispose() Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

This member is not implemented in C++void Dispose()Sub Dispose
Attributes

FromBluetoothAddressAsync(UInt64) FromBluetoothAddressAsync(UInt64) FromBluetoothAddressAsync(UInt64)

Returns a BluetoothLEDevice object for the given BluetoothAddress.

public static IAsyncOperation<BluetoothLEDevice> FromBluetoothAddressAsync(UInt64 bluetoothAddress)public static IAsyncOperation<BluetoothLEDevice> FromBluetoothAddressAsync(UInt64 bluetoothAddress)Public Static Function FromBluetoothAddressAsync(bluetoothAddress As UInt64) As IAsyncOperation( Of BluetoothLEDevice )
Parameters
bluetoothAddress
System.UInt64 System.UInt64 System.UInt64

The address of the Bluetooth LE device.

Returns

After the asynchronous operation completes, returns the BluetoothLEDevice object with the given BluetoothAddress.

Attributes

FromBluetoothAddressAsync(UInt64, BluetoothAddressType) FromBluetoothAddressAsync(UInt64, BluetoothAddressType) FromBluetoothAddressAsync(UInt64, BluetoothAddressType)

Returns a BluetoothLEDevice object for the given BluetoothAddress value and BluetoothAddressType value.

public static IAsyncOperation<BluetoothLEDevice> FromBluetoothAddressAsync(UInt64 bluetoothAddress, BluetoothAddressType bluetoothAddressType)public static IAsyncOperation<BluetoothLEDevice> FromBluetoothAddressAsync(UInt64 bluetoothAddress, BluetoothAddressType bluetoothAddressType)Public Static Function FromBluetoothAddressAsync(bluetoothAddress As UInt64, bluetoothAddressType As BluetoothAddressType) As IAsyncOperation( Of BluetoothLEDevice )
Parameters
bluetoothAddress
System.UInt64 System.UInt64 System.UInt64

The 64-bit address of the Bluetooth LE device.

bluetoothAddressType
BluetoothAddressType BluetoothAddressType BluetoothAddressType

The address type of the Bluetooth LE device.

Returns

Returns an asynchronous operation that completes with the BluetoothLEDevice object.

Attributes

FromIdAsync(String) FromIdAsync(String) FromIdAsync(String)

Returns a BluetoothLEDevice object for the given Id.

public static IAsyncOperation<BluetoothLEDevice> FromIdAsync(String deviceId)public static IAsyncOperation<BluetoothLEDevice> FromIdAsync(String deviceId)Public Static Function FromIdAsync(deviceId As String) As IAsyncOperation( Of BluetoothLEDevice )
Parameters
deviceId
System.String System.String System.String

The Id of the Bluetooth LE device.

Returns

After the asynchronous operation completes, returns the BluetoothLEDevice object with the given Id.

Attributes
Additional features and requirements
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)
Capabilities
bluetooth

GetDeviceSelector() GetDeviceSelector() GetDeviceSelector()

Gets an Advanced Query Syntax (AQS) string for identifying all Bluetooth Low Energy (LE) devices. This string is passed to the FindAllAsync or CreateWatcher method in order to get a list of Bluetooth LE devices.

public static string GetDeviceSelector()public static string GetDeviceSelector()Public Static Function GetDeviceSelector() As string
Returns
string string string

The device selector for this device.

Attributes
Additional features and requirements
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)
Capabilities
bluetooth

GetDeviceSelectorFromAppearance(BluetoothLEAppearance) GetDeviceSelectorFromAppearance(BluetoothLEAppearance) GetDeviceSelectorFromAppearance(BluetoothLEAppearance)

Creates an Advanced Query Syntax (AQS) filter string from a BluetoothLEAppearance object. The AQS string is passed into the CreateWatcher method to return a collection of DeviceInformation objects with the specified appearance.

public static string GetDeviceSelectorFromAppearance(BluetoothLEAppearance appearance)public static string GetDeviceSelectorFromAppearance(BluetoothLEAppearance appearance)Public Static Function GetDeviceSelectorFromAppearance(appearance As BluetoothLEAppearance) As string
Parameters
appearance
BluetoothLEAppearance BluetoothLEAppearance BluetoothLEAppearance

The Bluetooth LE appearance used for constructing the AQS string.

Returns
string string string

An AQS string that can be passed as a parameter to the CreateWatcher method.

Attributes

GetDeviceSelectorFromBluetoothAddress(UInt64) GetDeviceSelectorFromBluetoothAddress(UInt64) GetDeviceSelectorFromBluetoothAddress(UInt64)

Creates an Advanced Query Syntax (AQS) filter string from a 64-bit address that represents a Bluetooth LE device. The AQS string is passed into the CreateWatcher method to return a collection of DeviceInformation objects.

public static string GetDeviceSelectorFromBluetoothAddress(UInt64 bluetoothAddress)public static string GetDeviceSelectorFromBluetoothAddress(UInt64 bluetoothAddress)Public Static Function GetDeviceSelectorFromBluetoothAddress(bluetoothAddress As UInt64) As string
Parameters
bluetoothAddress
System.UInt64 System.UInt64 System.UInt64

A 64-bit Bluetooth LE device address used for constructing the AQS string.

Returns
string string string

An AQS string that can be passed as a parameter to the CreateWatcher method.

Attributes

GetDeviceSelectorFromBluetoothAddress(UInt64, BluetoothAddressType) GetDeviceSelectorFromBluetoothAddress(UInt64, BluetoothAddressType) GetDeviceSelectorFromBluetoothAddress(UInt64, BluetoothAddressType)

Creates an Advanced Query Syntax (AQS) filter string from a 64-bit address and address type that represents a Bluetooth LE device. The AQS string is passed into the CreateWatcher method.

public static string GetDeviceSelectorFromBluetoothAddress(UInt64 bluetoothAddress, BluetoothAddressType bluetoothAddressType)public static string GetDeviceSelectorFromBluetoothAddress(UInt64 bluetoothAddress, BluetoothAddressType bluetoothAddressType)Public Static Function GetDeviceSelectorFromBluetoothAddress(bluetoothAddress As UInt64, bluetoothAddressType As BluetoothAddressType) As string
Parameters
bluetoothAddress
System.UInt64 System.UInt64 System.UInt64

A 64-bit Bluetooth LE device address used for constructing the AQS string.

bluetoothAddressType
BluetoothAddressType BluetoothAddressType BluetoothAddressType

The Bluetooth LE device address type.

Returns
string string string

An AQS string that can be passed as a parameter to the CreateWatcher method.

Attributes

GetDeviceSelectorFromConnectionStatus(BluetoothConnectionStatus) GetDeviceSelectorFromConnectionStatus(BluetoothConnectionStatus) GetDeviceSelectorFromConnectionStatus(BluetoothConnectionStatus)

Creates an Advanced Query Syntax (AQS) filter string that contains a query for Bluetooth LE devices with the indicated BluetoothConnectionStatus. The AQS string is passed into the CreateWatcher method to return a collection of DeviceInformation objects with the indicated Bluetooth connection status.

public static string GetDeviceSelectorFromConnectionStatus(BluetoothConnectionStatus connectionStatus)public static string GetDeviceSelectorFromConnectionStatus(BluetoothConnectionStatus connectionStatus)Public Static Function GetDeviceSelectorFromConnectionStatus(connectionStatus As BluetoothConnectionStatus) As string
Parameters
connectionStatus
BluetoothConnectionStatus BluetoothConnectionStatus BluetoothConnectionStatus

The connection status used for constructing the AQS string.

Returns
string string string

An AQS string that can be passed as a parameter to the CreateWatcher method.

Attributes

GetDeviceSelectorFromDeviceName(String) GetDeviceSelectorFromDeviceName(String) GetDeviceSelectorFromDeviceName(String)

Creates an Advanced Query Syntax (AQS) filter string that contains a query for the Bluetooth LE device name. The AQS string is passed into the CreateWatcher method to return a collection of DeviceInformation objects containing the specified Bluetooth LE device name.

public static string GetDeviceSelectorFromDeviceName(String deviceName)public static string GetDeviceSelectorFromDeviceName(String deviceName)Public Static Function GetDeviceSelectorFromDeviceName(deviceName As String) As string
Parameters
deviceName
System.String System.String System.String

The Bluetooth LE device name used for constructing the AQS string.

Returns
string string string

An AQS string that is passed as a parameter to the CreateWatcher method.

Attributes

GetDeviceSelectorFromPairingState(Boolean) GetDeviceSelectorFromPairingState(Boolean) GetDeviceSelectorFromPairingState(Boolean)

Creates an Advanced Query Syntax (AQS) filter string that contains a query for Bluetooth LE devices that are either paired or unpaired. The AQS string is passed into the CreateWatcher method to return a collection of DeviceInformation objects.

public static string GetDeviceSelectorFromPairingState(Boolean pairingState)public static string GetDeviceSelectorFromPairingState(Boolean pairingState)Public Static Function GetDeviceSelectorFromPairingState(pairingState As Boolean) As string
Parameters
pairingState
System.Boolean System.Boolean System.Boolean

The current pairing state for Bluetooth LE devices used for constructing the AQS string. Bluetooth LE devices can be either paired (true) or unpaired (false). The AQS Filter string will request scanning to be performed when the pairingState is false.

Returns
string string string

An AQS string that can be passed as a parameter to the CreateWatcher method.

Attributes

GetGattService(Guid) GetGattService(Guid) GetGattService(Guid)

Returns the GATT service with the given service Id.

public GattDeviceService GetGattService(Guid serviceUuid)public GattDeviceService GetGattService(Guid serviceUuid)Public Function GetGattService(serviceUuid As Guid) As GattDeviceService
Parameters
serviceUuid
System.Guid System.Guid System.Guid

The service Id of the GATT service.

Returns

The GATT service represented by the given service Id.

Attributes
Additional features and requirements
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)
Capabilities
bluetooth

GetGattServicesAsync() GetGattServicesAsync() GetGattServicesAsync()

Gets the GattDeviceServices for this Bluetooth LowEnergy device.

public IAsyncOperation<GattDeviceServicesResult> GetGattServicesAsync()public IAsyncOperation<GattDeviceServicesResult> GetGattServicesAsync()Public Function GetGattServicesAsync() As IAsyncOperation( Of GattDeviceServicesResult )
Returns

Returns an asynchronous operation that completes with a GattDeviceServicesResult.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
bluetooth

GetGattServicesAsync(BluetoothCacheMode) GetGattServicesAsync(BluetoothCacheMode) GetGattServicesAsync(BluetoothCacheMode)

Returns the GattDeviceServices for this Bluetooth LowEnergy device with the specified cache mode.

public IAsyncOperation<GattDeviceServicesResult> GetGattServicesAsync(BluetoothCacheMode cacheMode)public IAsyncOperation<GattDeviceServicesResult> GetGattServicesAsync(BluetoothCacheMode cacheMode)Public Function GetGattServicesAsync(cacheMode As BluetoothCacheMode) As IAsyncOperation( Of GattDeviceServicesResult )
Parameters
Returns

Returns an asynchronous operation that completes with a GattDeviceServicesResult.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
bluetooth

GetGattServicesForUuidAsync(Guid) GetGattServicesForUuidAsync(Guid) GetGattServicesForUuidAsync(Guid)

Returns the GattDeviceServices for the Bluetooth LowEnergy device with the specified UUID.

public IAsyncOperation<GattDeviceServicesResult> GetGattServicesForUuidAsync(Guid serviceUuid)public IAsyncOperation<GattDeviceServicesResult> GetGattServicesForUuidAsync(Guid serviceUuid)Public Function GetGattServicesForUuidAsync(serviceUuid As Guid) As IAsyncOperation( Of GattDeviceServicesResult )
Parameters
serviceUuid
System.Guid System.Guid System.Guid

The service UUID.

Returns
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
bluetooth

Remarks

Returns an asynchronous operation that completes with a GattDeviceServicesResult.

GetGattServicesForUuidAsync(Guid, BluetoothCacheMode) GetGattServicesForUuidAsync(Guid, BluetoothCacheMode) GetGattServicesForUuidAsync(Guid, BluetoothCacheMode)

Returns the GattDeviceServices for the Bluetooth LowEnergy device with the specified UUID.

public IAsyncOperation<GattDeviceServicesResult> GetGattServicesForUuidAsync(Guid serviceUuid, BluetoothCacheMode cacheMode)public IAsyncOperation<GattDeviceServicesResult> GetGattServicesForUuidAsync(Guid serviceUuid, BluetoothCacheMode cacheMode)Public Function GetGattServicesForUuidAsync(serviceUuid As Guid, cacheMode As BluetoothCacheMode) As IAsyncOperation( Of GattDeviceServicesResult )
Parameters
serviceUuid
System.Guid System.Guid System.Guid

The service UUID.

Returns

Returns an asynchronous operation that completes with a GattDeviceServicesResult.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
bluetooth

RequestAccessAsync() RequestAccessAsync() RequestAccessAsync()

Requests access to the Bluetooth LowEnergy device.

public IAsyncOperation<DeviceAccessStatus> RequestAccessAsync()public IAsyncOperation<DeviceAccessStatus> RequestAccessAsync()Public Function RequestAccessAsync() As IAsyncOperation( Of DeviceAccessStatus )
Returns

Returns an asynchronous operation that completes with a DeviceAccessStatus.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
bluetooth

Events

ConnectionStatusChanged ConnectionStatusChanged ConnectionStatusChanged

Occurs when the connection status for the device has changed.

public event TypedEventHandler ConnectionStatusChangedpublic event TypedEventHandler ConnectionStatusChangedPublic Event ConnectionStatusChanged
Attributes
Additional features and requirements
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)
Capabilities
bluetooth

GattServicesChanged GattServicesChanged GattServicesChanged

Occurs when the list of GATT services supported by the device has changed.

public event TypedEventHandler GattServicesChangedpublic event TypedEventHandler GattServicesChangedPublic Event GattServicesChanged
Attributes
Additional features and requirements
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)
Capabilities
bluetooth

NameChanged NameChanged NameChanged

Occurs when the name of the device has changed.

public event TypedEventHandler NameChangedpublic event TypedEventHandler NameChangedPublic Event NameChanged
Attributes
Additional features and requirements
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)
Capabilities
bluetooth