BluetoothDevice BluetoothDevice BluetoothDevice BluetoothDevice BluetoothDevice Class

Definition

Represents a Bluetooth device.

public : sealed class BluetoothDevice : IClosable
struct winrt::Windows::Devices::Bluetooth::BluetoothDevice : IClosable
public sealed class BluetoothDevice : IDisposable
Public NotInheritable Class BluetoothDevice Implements IDisposable
// This class does not provide a public constructor.
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

Remarks

Version history

Windows version SDK version Value added
1511 10586 DeviceInformation
1511 10586 GetDeviceSelectorFromBluetoothAddress
1511 10586 GetDeviceSelectorFromClassOfDevice
1511 10586 GetDeviceSelectorFromConnectionStatus
1511 10586 GetDeviceSelectorFromDeviceName
1511 10586 GetDeviceSelectorFromPairingState
1607 14393 DeviceAccessInformation
1607 14393 GetRfcommServicesAsync
1607 14393 GetRfcommServicesAsync(BluetoothCacheMode)
1607 14393 GetRfcommServicesForIdAsync(RfcommServiceId)
1607 14393 GetRfcommServicesForIdAsync(RfcommServiceId,BluetoothCacheMode)
1607 14393 RequestAccessAsync
1709 16299 BluetoothDeviceId
1803 17134 WasSecureConnectionUsedForPairing

Properties

BluetoothAddress BluetoothAddress BluetoothAddress BluetoothAddress BluetoothAddress

Gets the device address.

BluetoothDeviceId BluetoothDeviceId BluetoothDeviceId BluetoothDeviceId BluetoothDeviceId

Gets the bluetooth device ID.

ClassOfDevice ClassOfDevice ClassOfDevice ClassOfDevice ClassOfDevice

Gets the Bluetooth Class Of Device information of the device.

ConnectionStatus ConnectionStatus ConnectionStatus ConnectionStatus ConnectionStatus

Gets the connection status of the device.

DeviceAccessInformation DeviceAccessInformation DeviceAccessInformation DeviceAccessInformation DeviceAccessInformation

The current DeviceAccessInformation object for the device. Used to check and monitor access changes to the device.

DeviceId DeviceId DeviceId DeviceId DeviceId

Gets the device ID that came from the Windows.Devices.Enumeration.DeviceInformation.Id

DeviceInformation DeviceInformation DeviceInformation DeviceInformation DeviceInformation

Gets the DeviceInformation object for the Bluetooth device.

HostName HostName HostName HostName HostName

Gets the HostName of the device.

Name Name Name Name Name

Gets the Name of the device.

RfcommServices RfcommServices RfcommServices RfcommServices RfcommServices

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

SdpRecords SdpRecords SdpRecords SdpRecords SdpRecords

Gets the read-only list of Service Discovery Protocol (SDP) records for the device.

WasSecureConnectionUsedForPairing WasSecureConnectionUsedForPairing WasSecureConnectionUsedForPairing WasSecureConnectionUsedForPairing WasSecureConnectionUsedForPairing

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

Methods

Close() Close() Close() Close() Close()

Closes the Bluetooth device.

Dispose() Dispose() Dispose() Dispose() Dispose()

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

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

Returns a BluetoothDevice object for the given BluetoothAddress.

FromHostNameAsync(HostName) FromHostNameAsync(HostName) FromHostNameAsync(HostName) FromHostNameAsync(HostName) FromHostNameAsync(HostName)

Returns a BluetoothDevice object identified by the given HostName.

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

Returns a BluetoothDevice object identified by the given DeviceId.

GetDeviceSelector() GetDeviceSelector() GetDeviceSelector() GetDeviceSelector() GetDeviceSelector()

Gets an Advanced Query Syntax (AQS) string for identifying instances of this device. This string is passed to the FindAllAsync or CreateWatcher method.

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

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

GetDeviceSelectorFromClassOfDevice(BluetoothClassOfDevice) GetDeviceSelectorFromClassOfDevice(BluetoothClassOfDevice) GetDeviceSelectorFromClassOfDevice(BluetoothClassOfDevice) GetDeviceSelectorFromClassOfDevice(BluetoothClassOfDevice) GetDeviceSelectorFromClassOfDevice(BluetoothClassOfDevice)

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

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

Creates an Advanced Query Syntax (AQS) filter string that contains a query for Bluetooth 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) GetDeviceSelectorFromDeviceName(String) GetDeviceSelectorFromDeviceName(String) GetDeviceSelectorFromDeviceName(String) GetDeviceSelectorFromDeviceName(String)

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

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

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

GetRfcommServicesAsync() GetRfcommServicesAsync() GetRfcommServicesAsync() GetRfcommServicesAsync() GetRfcommServicesAsync()

Retrieves all Rfcomm Services on the remote Bluetooth Device.

GetRfcommServicesAsync(BluetoothCacheMode) GetRfcommServicesAsync(BluetoothCacheMode) GetRfcommServicesAsync(BluetoothCacheMode) GetRfcommServicesAsync(BluetoothCacheMode) GetRfcommServicesAsync(BluetoothCacheMode)

Retrieves all cached Rfcomm Services on the remote Bluetooth Device.

GetRfcommServicesForIdAsync(RfcommServiceId) GetRfcommServicesForIdAsync(RfcommServiceId) GetRfcommServicesForIdAsync(RfcommServiceId) GetRfcommServicesForIdAsync(RfcommServiceId) GetRfcommServicesForIdAsync(RfcommServiceId)

Retrieves all Rfcomm Services on the Remote Bluetooth Device matching the specified RfcommServiceId.

GetRfcommServicesForIdAsync(RfcommServiceId, BluetoothCacheMode) GetRfcommServicesForIdAsync(RfcommServiceId, BluetoothCacheMode) GetRfcommServicesForIdAsync(RfcommServiceId, BluetoothCacheMode) GetRfcommServicesForIdAsync(RfcommServiceId, BluetoothCacheMode) GetRfcommServicesForIdAsync(RfcommServiceId, BluetoothCacheMode)

Retrieves all cached Rfcomm Services on the Remote Bluetooth Device matching the specified RfcommServiceId.

RequestAccessAsync() RequestAccessAsync() RequestAccessAsync() RequestAccessAsync() RequestAccessAsync()

Used to request explicit access to the Bluetooth device. This invokes Device Consent and must be called on the UI thread.

Events

ConnectionStatusChanged ConnectionStatusChanged ConnectionStatusChanged ConnectionStatusChanged ConnectionStatusChanged

Occurs when the connection status of the device has changed.

NameChanged NameChanged NameChanged NameChanged NameChanged

Occurs when the name of the device has changed.

SdpRecordsChanged SdpRecordsChanged SdpRecordsChanged SdpRecordsChanged SdpRecordsChanged

Occurs when the list SDP records for the device has changed.