flutter_reactive_ble icon indicating copy to clipboard operation
flutter_reactive_ble copied to clipboard

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

Open safield opened this issue 4 years ago • 2 comments

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.

safield avatar Feb 04 '21 23:02 safield

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

werediver avatar Mar 29 '21 07:03 werediver

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

remonh87 avatar Mar 29 '21 09:03 remonh87