writeValue method
Future<void>
writeValue(
- Iterable<
int> data, { - int? offset,
- BlueZGattCharacteristicWriteType? type,
- bool? prepareAuthorize,
Writes data
to the characteristic.
Implementation
Future<void> writeValue(Iterable<int> data,
{int? offset,
BlueZGattCharacteristicWriteType? type,
bool? prepareAuthorize}) async {
var options = <String, DBusValue>{};
if (offset != null) {
options['offset'] = DBusUint16(offset);
}
if (type != null) {
String typeName;
switch (type) {
case BlueZGattCharacteristicWriteType.command:
typeName = 'command';
break;
case BlueZGattCharacteristicWriteType.request:
typeName = 'request';
break;
case BlueZGattCharacteristicWriteType.reliable:
typeName = 'reliable';
break;
}
options['type'] = DBusString(typeName);
}
if (prepareAuthorize != null) {
options['prepare-authorize'] = DBusBoolean(prepareAuthorize);
}
await _object.callMethod(_gattCharacteristicInterfaceName, 'WriteValue',
[DBusArray.byte(data), DBusDict.stringVariant(options)],
replySignature: DBusSignature(''));
}