writeCharacteristic method
写入 GATT 特征值。
参数:
deviceId:已连接设备标识,无默认值。serviceUuid:服务 UUID,无默认值。characteristicUuid:特征 UUID,无默认值。value:要写入的字节数组,无默认值。writeType:写入类型,默认 BluetoothWriteType.withResponse。可靠性优先推荐withResponse;吞吐优先且特征支持writeWithoutResponse时可用 BluetoothWriteType.withoutResponse。iOS/macOS/Web 的无响应写会立即完成,不等待回调; Linux 使用 BlueZWriteValue的request/command类型;Windows 使用 WinRTGattWriteOption; Web 要求serviceUuid已在设备选择时授权。
Implementation
Future<void> writeCharacteristic({
required String deviceId,
required String serviceUuid,
required String characteristicUuid,
required List<int> value,
BluetoothWriteType writeType = BluetoothWriteType.withResponse,
}) {
throw UnimplementedError('writeCharacteristic() has not been implemented.');
}