PhilipsHue / flutter_reactive_ble

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

It would be nice if subscribeToCharacteristic threw an error on invalid characteristic data. #219

Open safield opened 3 years ago

safield commented 3 years ago

When using the subscribeToCharacteristic, no error is thrown when invalid data is used.

subscribeToCharacteristic takes a QualifiedCharacteristic as its sole parameter. I can pass a QualifiedCharacteristic with an invalid serviceId, characteristicId, or deviceId. In this scenario the library just silently fails. None of the callbacks provided to the stream are ever called.

My concrete example, is that I have a specific service that contains a specific characteristic. If the service exists, but the characteristic doesn't, I consider this an error case that I would explicitly like to handle. In the current implementation, I must use discoverServices for the sole reason to validate that the expected services and characteristics exist.

Ideally, subscribeToCharacteristic would be able to handle that for me, and reduce work on my end.

werediver commented 3 years ago

Is this behavior specific to a platform? It doesn't seem to be an improvement, but rather a bug, @remonh87.

remonh87 commented 3 years ago

yes it is a bug we should investigate this. Do not know why I labeled this an enhancement