語言

BluetoothGatt.WriteCharacteristic 方法

定義

多載

名稱 Description
WriteCharacteristic(BluetoothGattCharacteristic)

將特定特徵及其值寫入對應的遠端裝置。

WriteCharacteristic(BluetoothGattCharacteristic, Byte[], Int32)

將特定特徵及其值寫入對應的遠端裝置。

WriteCharacteristic(BluetoothGattCharacteristic)

將特定特徵及其值寫入對應的遠端裝置。

[Android.Runtime.Register("writeCharacteristic", "(Landroid/bluetooth/BluetoothGattCharacteristic;)Z", "")]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public bool WriteCharacteristic(Android.Bluetooth.BluetoothGattCharacteristic? characteristic);
[<Android.Runtime.Register("writeCharacteristic", "(Landroid/bluetooth/BluetoothGattCharacteristic;)Z", "")>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.WriteCharacteristic : Android.Bluetooth.BluetoothGattCharacteristic -> bool

參數

characteristic
BluetoothGattCharacteristic

在遠端裝置上寫入的特性

傳回

若寫入操作成功啟動,則為 true。

屬性

備註

將特定特徵及其值寫入對應的遠端裝置。

寫入操作完成後, BluetoothGattCallback#onCharacteristicWrite 會呼叫回調,回報操作結果。

此會員已被棄用。 因為這 BluetoothGatt#writeCharacteristic(BluetoothGattCharacteristic, byte[], int) 不安全,因為它依賴 BluetoothGattCharacteristic 一個物件,其底層欄位在此方法之外會變動。

Java 文件 android.bluetooth.BluetoothGatt.writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic)。

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

適用於

WriteCharacteristic(BluetoothGattCharacteristic, Byte[], Int32)

將特定特徵及其值寫入對應的遠端裝置。

[Android.Runtime.Register("writeCharacteristic", "(Landroid/bluetooth/BluetoothGattCharacteristic;[BI)I", "", ApiSince=33)]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public int WriteCharacteristic(Android.Bluetooth.BluetoothGattCharacteristic characteristic, byte[] value, int writeType);
[<Android.Runtime.Register("writeCharacteristic", "(Landroid/bluetooth/BluetoothGattCharacteristic;[BI)I", "", ApiSince=33)>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.WriteCharacteristic : Android.Bluetooth.BluetoothGattCharacteristic * byte[] * int -> int

參數

characteristic
BluetoothGattCharacteristic

在遠端裝置上寫入的特性

value
Byte[]
writeType
Int32

價值是以下之一:BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT;BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE;BluetoothGattCharacteristic.WRITE_TYPE_SIGNED

傳回

特徵是否成功寫入

屬性

備註

將特定特徵及其值寫入對應的遠端裝置。

寫入操作完成後, BluetoothGattCallback#onCharacteristicWrite 會呼叫回調,回報操作結果。

Java 文件 android.bluetooth.BluetoothGatt.writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic, byte[], int)。

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

適用於