語言

BluetoothGatt.RequestMtu(Int32) 方法

定義

請求某個連線使用的 MTU 大小。

[Android.Runtime.Register("requestMtu", "(I)Z", "")]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public bool RequestMtu(int mtu);
[<Android.Runtime.Register("requestMtu", "(I)Z", "")>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.RequestMtu : int -> bool

參數

mtu
Int32

傳回

true,若已成功請求新的 MTU 值

屬性

備註

請求某個連線使用的 MTU 大小。 請注意,從 Android 14 開始,當第一個 GATT 用戶端請求 MTU 時,Android 藍牙堆疊會請求 BLE ATT MTU 至 517 位元組,之後所有 MTU 請求則會被忽略。 可以查看 第一個申請MTU的GATT客戶,MTU設定為517 ,以獲取更多資訊。

執行寫入請求操作(寫入無回應)時,所傳送的資料會被截斷為 MTU 大小。 此函式可用來請求更大的 MTU 大小,以便一次傳送更多資料。

回 BluetoothGattCallback#onMtuChanged 調會顯示該操作是否成功。

Java 文件 android.bluetooth.BluetoothGatt.requestMtu(int)。

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

適用於