BluetoothGatt.WriteCharacteristic 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| 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基础字段在此方法外部发生更改的对象,因此它不能安全使用内存。
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。
适用于
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 将调用回调,报告操作的结果。
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。