You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found bug with receiving multiple consecutive notifications from same characteristic. I'm expecting 6 consecutive notifications from my bluetooth device with different values but getting 6 notifications with some duplicated values. Firmware on device is not an issue because everything works fine on iOS app.
I have subscribed on characteristic with connection.openNotificationSubscription(notifyCharacteristic)
and try to receive values with receiveChannel.receive().value in while loop and also with receiveChannel.consumeEach{ } and nothing worked properly, still getting duplicates.
and everything was fine. So I'm creating new BluetoothGattCharacteristic object with same value before sending to channel so value doesn't get overwritten. Not sure what is the best approach to this but I'm sure that it's a bug.
The text was updated successfully, but these errors were encountered:
Thanks for the report and the solution suggestion. Another user reach out to me and confirmed the copying of the BGC solved it. I'll see how I can fix it right into the library.
Hi,
I found bug with receiving multiple consecutive notifications from same characteristic. I'm expecting 6 consecutive notifications from my bluetooth device with different values but getting 6 notifications with some duplicated values. Firmware on device is not an issue because everything works fine on iOS app.
I have subscribed on characteristic with
connection.openNotificationSubscription(notifyCharacteristic)
and try to receive values with
receiveChannel.receive().value
in while loop and also withreceiveChannel.consumeEach{ }
and nothing worked properly, still getting duplicates.Then I dug deeper and noticed that I'm alway getting same
BluetoothGattCharacteristic
object so I put breakpoint on 279 line in https://github.com/Beepiz/BleGattCoroutines/blob/master/core/src/androidMain/kotlin/com/beepiz/bluetooth/gattcoroutines/GattConnectionImpl.kt and realised that value inBluetoothGattCharacteristic
object is changed before it's consumed by channel.To prove my theory, I fork your project https://github.com/arsfutura/BleGattCoroutines/tree/fix-notification-channel and instead of your line:
I have put this:
and everything was fine. So I'm creating new
BluetoothGattCharacteristic
object with same value before sending to channel so value doesn't get overwritten. Not sure what is the best approach to this but I'm sure that it's a bug.The text was updated successfully, but these errors were encountered: