Dela via


RfcommDeviceService Class

Definition

Represents an instance of a service on a Bluetooth BR device.

public ref class RfcommDeviceService sealed : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class RfcommDeviceService final : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class RfcommDeviceService final : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class RfcommDeviceService : System.IDisposable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class RfcommDeviceService : System.IDisposable
Public NotInheritable Class RfcommDeviceService
Implements IDisposable
Inheritance
Object Platform::Object IInspectable RfcommDeviceService
Attributes
Implements

Windows 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
1607 14393 DeviceAccessInformation
1607 14393 GetDeviceSelectorForBluetoothDevice(BluetoothDevice)
1607 14393 GetDeviceSelectorForBluetoothDevice(BluetoothDevice,BluetoothCacheMode)
1607 14393 GetDeviceSelectorForBluetoothDeviceAndServiceId(BluetoothDevice,RfcommServiceId)
1607 14393 GetDeviceSelectorForBluetoothDeviceAndServiceId(BluetoothDevice,RfcommServiceId,BluetoothCacheMode)
1607 14393 RequestAccessAsync

Properties

ConnectionHostName

Gets the connection host name of the RFCOMM service instance, which is used to connect to the remote device.

ConnectionServiceName

Gets the connection service name of the RFCOMM service instance, which is used to connect to the remote device.

Device

Gets the BluetoothDevice object describing the device associated with the current RfcommDeviceService object.

DeviceAccessInformation

The device access information. Used to check and monitor access.

MaxProtectionLevel

Gets the maximum SocketProtectionLevel supported by this RFCOMM service instance.

ProtectionLevel

Gets the current SocketProtectionLevel of the RFCOMM service instance.

ServiceId

Gets the RfcommServiceId of this RFCOMM service instance.

Methods

Close()

Closes the RFCOMM device.

Dispose()

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

FromIdAsync(String)

Gets an RfcommDeviceService object from a DeviceInformation Id for an RFCOMM service instance.

GetDeviceSelector(RfcommServiceId)

Gets an Advanced Query Syntax (AQS) string for identifying instances of an RFCOMM service. This string is passed to the CreateWatcher method.

GetDeviceSelectorForBluetoothDevice(BluetoothDevice, BluetoothCacheMode)

Gets an Advanced Query Syntax (AQS) string for identifying cached instances of all Rfcomm services on a remote Bluetooth device.

GetDeviceSelectorForBluetoothDevice(BluetoothDevice)

Gets an Advanced Query Syntax (AQS) string for identifying instances of all Rfcomm services on a remote Bluetooth device.

GetDeviceSelectorForBluetoothDeviceAndServiceId(BluetoothDevice, RfcommServiceId, BluetoothCacheMode)

Gets an Advanced Query Syntax (AQS) string for identifying instances of Rfcomm services on a remote Bluetooth device.

GetDeviceSelectorForBluetoothDeviceAndServiceId(BluetoothDevice, RfcommServiceId)

Gets an Advanced Query Syntax (AQS) string for identifying instances of Rfcomm services on a remote Bluetooth device.

GetSdpRawAttributesAsync()

Gets the cached SDP attributes of the RFCOMM service instance.

GetSdpRawAttributesAsync(BluetoothCacheMode)

Gets the SDP attributes of the RFCOMM service instance.

RequestAccessAsync()

Used to request explicit access to the Rfcomm service. This invokes Device Consent and must be called on the UI thread. By default, unpaired devices do not require consent, while paired devices do. FromIdAsync will only display a consent prompt when called for a paired device. RequestAccessAsync allows the app to make the access request explicit in the event where the device may become paired in the future through other uses of the device.

Applies to