BluetoothLEDevice Class

Definition

Represents a Bluetooth LE device.

public ref class BluetoothLEDevice sealed : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.DualApiPartition(version=167772160)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Static(Windows.Devices.Bluetooth.IBluetoothLEDeviceStatics, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class BluetoothLEDevice sealed : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.DualApiPartition(version=167772160)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Static(Windows.Devices.Bluetooth.IBluetoothLEDeviceStatics, 65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.Static(Windows.Devices.Bluetooth.IBluetoothLEDeviceStatics2, 131072, "Windows.Foundation.UniversalApiContract")]
class BluetoothLEDevice sealed : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.DualApiPartition(version=167772160)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Static(typeof(Windows.Devices.Bluetooth.IBluetoothLEDeviceStatics), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class BluetoothLEDevice : System.IDisposable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.DualApiPartition(version=167772160)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Static(typeof(Windows.Devices.Bluetooth.IBluetoothLEDeviceStatics), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Static(typeof(Windows.Devices.Bluetooth.IBluetoothLEDeviceStatics2), 131072, "Windows.Foundation.UniversalApiContract")]
public sealed class BluetoothLEDevice : System.IDisposable
Public NotInheritable Class BluetoothLEDevice
Implements IDisposable
Inheritance
BluetoothLEDevice
Attributes
Implements

Windows 10 requirements

Device family
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)
App capabilities
bluetooth

Remarks

Version history

Windows version SDK version Value added
1511 10586 Appearance
1511 10586 BluetoothAddressType
1511 10586 DeviceInformation
1511 10586 FromBluetoothAddressAsync(UInt64,BluetoothAddressType)
1511 10586 GetDeviceSelectorFromAppearance
1511 10586 GetDeviceSelectorFromBluetoothAddress(UInt64)
1511 10586 GetDeviceSelectorFromBluetoothAddress(UInt64,BluetoothAddressType)
1511 10586 GetDeviceSelectorFromConnectionStatus
1511 10586 GetDeviceSelectorFromDeviceName
1511 10586 GetDeviceSelectorFromPairingState
1703 15063 DeviceAccessInformation
1703 15063 GetGattServicesAsync
1703 15063 GetGattServicesAsync(BluetoothCacheMode)
1703 15063 GetGattServicesForUuidAsync(Guid)
1703 15063 GetGattServicesForUuidAsync(Guid,BluetoothCacheMode)
1703 15063 RequestAccessAsync
1709 16299 BluetoothDeviceId
1803 17134 WasSecureConnectionUsedForPairing

Properties

Appearance

Gets the BluetoothLEAppearance object for the Bluetooth LE device.

BluetoothAddress

Gets the device address.

BluetoothAddressType

Gets the address type for the Bluetooth LE device.

BluetoothDeviceId

Gets the bluetooth device ID.

ConnectionStatus

Gets the connection status of the device.

DeviceAccessInformation

Gets the DeviceAccessInformation.

DeviceId

Gets the device Id.

DeviceInformation

Gets the device information for the Bluetooth LE device.

GattServices

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

Important

The GattServices API is deprecated, and it may not be available in future versions of Windows. Instead, use GetGattServicesAsync.

Name

Gets the name of the Bluetooth LE device.

WasSecureConnectionUsedForPairing

Gets a boolean indicating whether the BluetoothLEDevice was paired using a Secure Connection.

Methods

Close()

Closes this Bluetooth LE device. This may close the connection to the device if this is the only app with a connection.

Dispose()

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

FromBluetoothAddressAsync(UInt64)

Returns a BluetoothLEDevice object representing the peer Bluetooth LE device with the given address. See Remarks in the member topic.

FromBluetoothAddressAsync(UInt64, BluetoothAddressType)

Returns a BluetoothLEDevice object representing the peer device with the given address and address type. See Remarks in the member topic.

FromIdAsync(String)

Returns a BluetoothLEDevice object for the given Id. See Remarks in the member topic.

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.

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.

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.

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.

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.

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.

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.

GetGattService(Guid)

Returns the GATT service with the given service Id.

Important

The GetGattService API is deprecated, and it may not be available in future versions of Windows. Instead, use GetGattServicesAsync.

GetGattServicesAsync()

Gets the GattDeviceServices for this Bluetooth LowEnergy device.

GetGattServicesAsync(BluetoothCacheMode)

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

GetGattServicesForUuidAsync(Guid)

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

GetGattServicesForUuidAsync(Guid, BluetoothCacheMode)

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

RequestAccessAsync()

Requests access to the Bluetooth LowEnergy device.

Events

ConnectionStatusChanged

Occurs when the connection status for the device has changed.

GattServicesChanged

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

NameChanged

Occurs when the name of the device has changed.

Applies to

See also