Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Notification Sent While Subscribing #68

Closed
WkGl001 opened this issue Nov 8, 2023 · 0 comments · Fixed by #79
Closed

Missing Notification Sent While Subscribing #68

WkGl001 opened this issue Nov 8, 2023 · 0 comments · Fixed by #79

Comments

@WkGl001
Copy link

WkGl001 commented Nov 8, 2023

Hello,

Thank you for this library. I'm currently using it with a peripheral that has several notify only characteristics. The initial value of the characteristic is sent out by the peripheral as soon as it receives the notification descriptor write request from the central. When using this library, I often find that this notification is received by the device and the library, but that it does not make it to my own code.

Specifically, I call getNotifications on the ClientBleGattCharacteristic object associated with the notify only characteristic. Often, before this function is able to return a Flow and my code is able to collect from it, the peripheral has already sent the initial value notification. The library gets this notification, logs it, and tries to emit it; however, it does not make it to my own code since it has not either received the returned Flow or been able to start collecting from it yet. The notifications field in the ClientBleGattCharacteristic object:

private val _notifications = MutableSharedFlow<DataByteArray>(extraBufferCapacity = 10, onBufferOverflow = BufferOverflow.DROP_OLDEST)

also does not keep any replay cache or expose a way to configure that so I can't go back to get the missed value.

For now, as a workaround, I've used reflection to collect from this private _notifications Flow until I know that the Flow I received from getNotifications has started to collect. Any help from the library on handling this type of situation would be much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant