BluetoothGatt.WriteCharacteristic 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | 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 一個物件,其底層欄位在此方法之外會變動。
本頁部分內容為基於 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 會呼叫回調,回報操作結果。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。