語言

BluetoothDevice.CreateUsingSocketSettings(BluetoothSocketSettings) 方法

定義

建立用戶端套接字以連接遠端藍牙伺服器,並設定為指定套接字 BluetoothSocketSettings 。此 API 用於連接由 BluetoothAdapter#listenUsingSocketSettings所承載的遠端伺服器。

[Android.Runtime.Register("createUsingSocketSettings", "(Landroid/bluetooth/BluetoothSocketSettings;)Landroid/bluetooth/BluetoothSocket;", "", ApiSince=36)]
public Android.Bluetooth.BluetoothSocket CreateUsingSocketSettings(Android.Bluetooth.BluetoothSocketSettings settings);
[<Android.Runtime.Register("createUsingSocketSettings", "(Landroid/bluetooth/BluetoothSocketSettings;)Landroid/bluetooth/BluetoothSocket;", "", ApiSince=36)>]
member this.CreateUsingSocketSettings : Android.Bluetooth.BluetoothSocketSettings -> Android.Bluetooth.BluetoothSocket

參數

settings
BluetoothSocketSettings

藍牙插座設定 BluetoothSocketSettings

傳回

一個 BluetoothSocket 準備好外向連結的時刻。

屬性

備註

建立用戶端套接字以連接遠端藍牙伺服器,並設定為指定套接字 BluetoothSocketSettings 。此 API 用於連接由 BluetoothAdapter#listenUsingSocketSettings所承載的遠端伺服器。

<ul><li>對「BluetoothSocket.TYPE_RFCOMM」:必須使用 RFCOMM UUID 提供。BluetoothSocketSettings#setRfcommUuid() <li>對於「BluetoothSocket.TYPE_LE」:L2cap 協定/服務多工器(PSM)值必須使用 BluetoothSocketSettings#setL2capPsm()。 </ul>

使用此 API 的應用程式負責從遠端裝置取得協定/服務多工器(PSM)值。

用來 BluetoothSocket#connect 啟動外線連線。

Java 文件 android.bluetooth.BluetoothDevice.createUsingSocketSettings(android.bluetooth.BluetoothSocketSettings)

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於