diff --git a/packages/quick_blue/lib/src/quick_blue_linux.dart b/packages/quick_blue/lib/src/quick_blue_linux.dart index 3c73be8..2b81196 100644 --- a/packages/quick_blue/lib/src/quick_blue_linux.dart +++ b/packages/quick_blue/lib/src/quick_blue_linux.dart @@ -105,6 +105,11 @@ class QuickBlueLinux extends QuickBluePlatform { _findDeviceById(deviceId).connect().then((_) { onConnectionChanged?.call(deviceId, BlueConnectionState.connected,null); }); + //TODO : Listen for PropertisChanged event , to update Connection Status on Disconnection from BleDevice , + + // _findDeviceById(deviceId).propertiesChanged.listen((event) { + // print(event); + // }); } @override @@ -173,13 +178,17 @@ class QuickBlueLinux extends QuickBluePlatform { @override Future writeValue(String deviceId, String service, String characteristic, Uint8List value, BleOutputProperty bleOutputProperty) async { var c = _getCharacteristic(deviceId, service, characteristic); - - if (bleOutputProperty == BleOutputProperty.withResponse) { - await c.writeValue(value, type: BlueZGattCharacteristicWriteType.request); - } else { - await c.writeValue(value, type: BlueZGattCharacteristicWriteType.command); + try{ + if (bleOutputProperty == BleOutputProperty.withResponse) { + await c.writeValue(value, type: BlueZGattCharacteristicWriteType.request); + } else { + await c.writeValue(value, type: BlueZGattCharacteristicWriteType.command); + } + _log('writeValue $characteristic, ${hex.encode(value)}'); + onWrite?.call(deviceId,characteristic,null); + }catch(e){ + onWrite?.call(deviceId,characteristic,e.toString()); } - _log('writeValue $characteristic, ${hex.encode(value)}'); } @override