Share via


RfcommDeviceService 類別

定義

代表藍牙 BR 裝置上服務的實例。

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
繼承
Object Platform::Object IInspectable RfcommDeviceService
屬性
實作

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)
應用程式功能
bluetooth

備註

版本歷程記錄

Windows 版本 SDK 版本 新增值
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

屬性

ConnectionHostName

取得 RFCOMM 服務實例的連線主機名稱,此實例用來連線到遠端裝置。

ConnectionServiceName

取得 RFCOMM 服務實例的聯機服務名稱,此實例用來連線到遠端裝置。

Device

取得 BluetoothDevice 物件,描述與目前 RfcommDeviceService 物件相關聯的裝置。

DeviceAccessInformation

裝置存取訊號。 用來檢查和監視存取。

MaxProtectionLevel

取得這個 RFCOMM 服務實例所支援的最大 SocketProtectionLevel。

ProtectionLevel

取得 RFCOMM 服務實例目前的 SocketProtectionLevel。

ServiceId

取得這個 RFCOMM 服務實例的 RfcommServiceId。

方法

Close()

關閉 RFCOMM 裝置。

Dispose()

執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之應用程式定義的工作。

FromIdAsync(String)

從 RFCOMM 服務實例的 DeviceInformation Id 取得 RfcommDeviceService 物件。

GetDeviceSelector(RfcommServiceId)

取得進階查詢語法 (AQS) 字串,以識別 RFCOMM 服務的實例。 此字串會傳遞至 CreateWatcher 方法。

GetDeviceSelectorForBluetoothDevice(BluetoothDevice)

取得進階查詢語法 (AQS) 字串,以識別遠端藍牙裝置上所有 Rfcomm 服務的實例。

GetDeviceSelectorForBluetoothDevice(BluetoothDevice, BluetoothCacheMode)

取得進階查詢語法 (AQS) 字串,以識別遠端藍牙裝置上所有 Rfcomm 服務的快取實例。

GetDeviceSelectorForBluetoothDeviceAndServiceId(BluetoothDevice, RfcommServiceId)

取得進階查詢語法 (AQS) 字串,以識別遠端藍牙裝置上 Rfcomm 服務的實例。

GetDeviceSelectorForBluetoothDeviceAndServiceId(BluetoothDevice, RfcommServiceId, BluetoothCacheMode)

取得進階查詢語法 (AQS) 字串,以識別遠端藍牙裝置上 Rfcomm 服務的實例。

GetSdpRawAttributesAsync()

取得 RFCOMM 服務實例的快取 SDP 屬性。

GetSdpRawAttributesAsync(BluetoothCacheMode)

取得 RFCOMM 服務實例的 SDP 屬性。

RequestAccessAsync()

用來要求明確存取 Rfcomm 服務。 這會叫用裝置同意,而且必須在 UI 執行緒上呼叫。 根據預設,未配對的裝置不需要同意,而配對的裝置則不需要同意。 FromIdAsync 只會在針對配對的裝置呼叫時顯示同意提示。 RequestAccessAsync 可讓應用程式在裝置在未來透過其他裝置用途配對時明確提出存取要求。

適用於