PhilipsHue / flutter_reactive_ble

Flutter library that handles BLE operations for multiple devices.
https://developers.meethue.com/
Other
668 stars 335 forks source link

WriteCharacteristicFailure.unknown, message: "Writechar timed-out" #418

Open avinashjoshi-canary opened 3 years ago

avinashjoshi-canary commented 3 years ago

This bug is produced by working with a nRF custom device. The bug occurs some of times and once I terminate the app and restart it disappears. Not able figure out what is the matter.

I have tried both writeCharacteristicWithoutResponse and writeCharacteristicWithResponse following is the log

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Exception: GenericFailure<WriteCharacteristicFailure>(code: WriteCharacteristicFailure.unknown, message: "Writechar timed-out")
E/flutter (22971): #0      Result.dematerialize.<anonymous closure> (package:reactive_ble_platform_interface/src/model/result.dart:22:13)
E/flutter (22971): #1      Result.iif (package:reactive_ble_platform_interface/src/model/result.dart:34:21)
E/flutter (22971): #2      Result.dematerialize (package:reactive_ble_platform_interface/src/model/result.dart:15:28)
E/flutter (22971): #3      ConnectedDeviceOperationImpl.writeCharacteristicWithoutResponse.<anonymous closure> (package:flutter_reactive_ble/src/connected_device_operation.dart:72:39)
E/flutter (22971): #4      _rootRunUnary (dart:async/zone.dart:1436:47)
E/flutter (22971): #5      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (22971): <asynchronous suspension>
remonh87 commented 3 years ago

In general this occurs when the the peripheral is not responding anymore. Does this issue happen when you do a lot of subsequent writes (e.g. updating some firmware)?

avinashjoshi-canary commented 3 years ago

I have this error when I Perform hot restart from android studio.

akillika commented 2 years ago

I have this error when I Perform hot restart from android studio.

Same here. I have the device connected, but when I write the data, it pops this issue

Baxi19 commented 1 year ago

Could you please provide an update on this? I'm encountering the same error.

TNorbury commented 6 months ago

I'm encountering this error as well. Though my scenario seems different from those mentioned here:

Some other things to note:

Realize I'm getting into the weeds a bit by using the foreground service, but any insight would be appreciated!

TNorbury commented 6 months ago

Another interesting thing to note. It seems like this issue only happens with writeWithResponse and not writeCharacteristicWithoutResponse