RfcommDeviceService RfcommDeviceService RfcommDeviceService Class

Definition

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

public sealed class RfcommDeviceService : IRfcommDeviceService, IRfcommDeviceService2, IRfcommDeviceService3, IClosablepublic sealed class RfcommDeviceService : IRfcommDeviceService, IRfcommDeviceService2, IRfcommDeviceService3, IDisposablePublic NotInheritable Class RfcommDeviceService Implements IRfcommDeviceService, IRfcommDeviceService2, IRfcommDeviceService3, 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)

Properties

ConnectionHostName ConnectionHostName ConnectionHostName

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

public HostName ConnectionHostName { get; }public HostName ConnectionHostName { get; }Public ReadOnly Property ConnectionHostName As HostName
Value
HostName HostName HostName

The HostName object of the RFCOMM service instance.

Attributes

ConnectionServiceName ConnectionServiceName ConnectionServiceName

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

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

The ServiceName object of the RFCOMM service instance.

Attributes

Device Device Device

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

public BluetoothDevice Device { get; }public BluetoothDevice Device { get; }Public ReadOnly Property Device As BluetoothDevice
Value
BluetoothDevice BluetoothDevice BluetoothDevice

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

Attributes

DeviceAccessInformation DeviceAccessInformation DeviceAccessInformation

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

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

MaxProtectionLevel MaxProtectionLevel MaxProtectionLevel

Gets the maximum SocketProtectionLevel supported by this RFCOMM service instance.

public SocketProtectionLevel MaxProtectionLevel { get; }public SocketProtectionLevel MaxProtectionLevel { get; }Public ReadOnly Property MaxProtectionLevel As SocketProtectionLevel
Value
SocketProtectionLevel SocketProtectionLevel SocketProtectionLevel

The maximum SocketProtectionLevel of the RFCOMM service instance. This level can be passed to StreamSocket.ConnectAsync to upgrade the RFCOMM link protection level.

Attributes

ProtectionLevel ProtectionLevel ProtectionLevel

Gets the current SocketProtectionLevel of the RFCOMM service instance.

public SocketProtectionLevel ProtectionLevel { get; }public SocketProtectionLevel ProtectionLevel { get; }Public ReadOnly Property ProtectionLevel As SocketProtectionLevel
Value
SocketProtectionLevel SocketProtectionLevel SocketProtectionLevel

The current SocketProtectionLevel of the remote RFCOMM service instance.

Attributes

ServiceId ServiceId ServiceId

Gets the RfcommServiceId of this RFCOMM service instance.

public RfcommServiceId ServiceId { get; }public RfcommServiceId ServiceId { get; }Public ReadOnly Property ServiceId As RfcommServiceId
Value
RfcommServiceId RfcommServiceId RfcommServiceId

The RfcommServiceId of the RFCOMM service instance.

Attributes

Methods

Close() Close() Close()

Closes the RFCOMM 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

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

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

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

The DeviceInformation Id that identifies the RFCOMM service instance. This id can be retrieved from Windows.Devices.Enumeration.

Returns

The RfcommDeviceService object that represents the RFCOMM service instance.

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

Remarks

The first time this method is invoked by a store app, it should be called from a UI thread in order to display the consent prompt. After the user has granted consent, the method can be invoked from any application thread.

If a store app has not declared the right capabilities or the user does not grant consent, the method returns a null object.

Warning

If the device acting as the RFCOMM server does not have the correct channel registered in its manifest, this method throws an exception when called on the device acting as the RFCOMM client.

GetDeviceSelector(RfcommServiceId) GetDeviceSelector(RfcommServiceId) GetDeviceSelector(RfcommServiceId)

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

public static string GetDeviceSelector(RfcommServiceId serviceId)public static string GetDeviceSelector(RfcommServiceId serviceId)Public Static Function GetDeviceSelector(serviceId As RfcommServiceId) As string
Parameters
serviceId
RfcommServiceId RfcommServiceId RfcommServiceId

The service id for which to query.

Returns
string string string

An AQS string for identifying RFCOMM service instances.

Attributes

GetDeviceSelectorForBluetoothDevice(BluetoothDevice) GetDeviceSelectorForBluetoothDevice(BluetoothDevice) GetDeviceSelectorForBluetoothDevice(BluetoothDevice)

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

public static string GetDeviceSelectorForBluetoothDevice(BluetoothDevice bluetoothDevice)public static string GetDeviceSelectorForBluetoothDevice(BluetoothDevice bluetoothDevice)Public Static Function GetDeviceSelectorForBluetoothDevice(bluetoothDevice As BluetoothDevice) As string
Parameters
bluetoothDevice
BluetoothDevice BluetoothDevice BluetoothDevice

The remote bluetooth device.

Returns
string string string

The AQS string for identifying instances of all Rfcomm services on a remote Bluetooth device.

Attributes

GetDeviceSelectorForBluetoothDevice(BluetoothDevice, BluetoothCacheMode) GetDeviceSelectorForBluetoothDevice(BluetoothDevice, BluetoothCacheMode) GetDeviceSelectorForBluetoothDevice(BluetoothDevice, BluetoothCacheMode)

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

public static string GetDeviceSelectorForBluetoothDevice(BluetoothDevice bluetoothDevice, BluetoothCacheMode cacheMode)public static string GetDeviceSelectorForBluetoothDevice(BluetoothDevice bluetoothDevice, BluetoothCacheMode cacheMode)Public Static Function GetDeviceSelectorForBluetoothDevice(bluetoothDevice As BluetoothDevice, cacheMode As BluetoothCacheMode) As string
Parameters
bluetoothDevice
BluetoothDevice BluetoothDevice BluetoothDevice

The remote Bluetooth device.

Returns
string string string

The AQS string for identifying cached instances of all Rfcomm services on a remote Bluetooth device.

Attributes

GetDeviceSelectorForBluetoothDeviceAndServiceId(BluetoothDevice, RfcommServiceId) GetDeviceSelectorForBluetoothDeviceAndServiceId(BluetoothDevice, RfcommServiceId) GetDeviceSelectorForBluetoothDeviceAndServiceId(BluetoothDevice, RfcommServiceId)

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

public static string GetDeviceSelectorForBluetoothDeviceAndServiceId(BluetoothDevice bluetoothDevice, RfcommServiceId serviceId)public static string GetDeviceSelectorForBluetoothDeviceAndServiceId(BluetoothDevice bluetoothDevice, RfcommServiceId serviceId)Public Static Function GetDeviceSelectorForBluetoothDeviceAndServiceId(bluetoothDevice As BluetoothDevice, serviceId As RfcommServiceId) As string
Parameters
bluetoothDevice
BluetoothDevice BluetoothDevice BluetoothDevice

The remote Bluetooth device.

serviceId
RfcommServiceId RfcommServiceId RfcommServiceId

The service ID.

Returns
string string string

The AQS string for identifying instances of Rfcomm services.

Attributes

GetDeviceSelectorForBluetoothDeviceAndServiceId(BluetoothDevice, RfcommServiceId, BluetoothCacheMode) GetDeviceSelectorForBluetoothDeviceAndServiceId(BluetoothDevice, RfcommServiceId, BluetoothCacheMode) GetDeviceSelectorForBluetoothDeviceAndServiceId(BluetoothDevice, RfcommServiceId, BluetoothCacheMode)

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

public static string GetDeviceSelectorForBluetoothDeviceAndServiceId(BluetoothDevice bluetoothDevice, RfcommServiceId serviceId, BluetoothCacheMode cacheMode)public static string GetDeviceSelectorForBluetoothDeviceAndServiceId(BluetoothDevice bluetoothDevice, RfcommServiceId serviceId, BluetoothCacheMode cacheMode)Public Static Function GetDeviceSelectorForBluetoothDeviceAndServiceId(bluetoothDevice As BluetoothDevice, serviceId As RfcommServiceId, cacheMode As BluetoothCacheMode) As string
Parameters
bluetoothDevice
BluetoothDevice BluetoothDevice BluetoothDevice

The remote bluetooth device.

serviceId
RfcommServiceId RfcommServiceId RfcommServiceId

The service ID.

Returns
string string string

The AQS string for identifying instances of Rfcomm services.

Attributes

GetSdpRawAttributesAsync() GetSdpRawAttributesAsync() GetSdpRawAttributesAsync()

Gets the cached SDP attributes of the RFCOMM service instance.

public IAsyncOperation<IMapView<uint, IBuffer>> GetSdpRawAttributesAsync()public IAsyncOperation<IMapView<uint, IBuffer>> GetSdpRawAttributesAsync()Public Function GetSdpRawAttributesAsync() As IAsyncOperation( Of IMapViewuint, IBuffer )
Returns

The SDP attributes of the RFCOMM service instance.

Attributes

GetSdpRawAttributesAsync(BluetoothCacheMode) GetSdpRawAttributesAsync(BluetoothCacheMode) GetSdpRawAttributesAsync(BluetoothCacheMode)

Gets the SDP attributes of the RFCOMM service instance.

public IAsyncOperation<IMapView<uint, IBuffer>> GetSdpRawAttributesAsync(BluetoothCacheMode cacheMode)public IAsyncOperation<IMapView<uint, IBuffer>> GetSdpRawAttributesAsync(BluetoothCacheMode cacheMode)Public Function GetSdpRawAttributesAsync(cacheMode As BluetoothCacheMode) As IAsyncOperation( Of IMapViewuint, IBuffer )
Parameters
cacheMode
BluetoothCacheMode BluetoothCacheMode BluetoothCacheMode

Indicates whether SDP attributes should be retrieved from the cache or from the device.

Returns

The SDP attributes of the RFCOMM service instance.

Attributes

RequestAccessAsync() RequestAccessAsync() 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.

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

After the async operation completes, returns a DeviceAccessStatus object.

Attributes