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

Provide mechanism to define characteristic read callback #337

Open
kortschak opened this issue Jan 22, 2025 · 0 comments
Open

Provide mechanism to define characteristic read callback #337

kortschak opened this issue Jan 22, 2025 · 0 comments

Comments

@kortschak
Copy link
Contributor

Currently, reads do not give any opportunity to allow event-driven behaviour. This is worked around in the examples by periodically writing to the value data in the characteristic, but this is a brittle approach when the application is more than very simple, and introduces the possibility of data and logic races.

To address this, there should be a read call-back mechanism that allows application logic to be run prior to sending bytes over the air. An example of how to do this for HCI is here. It should be relatively straightforward to inject a callback path in the Windows code, and from a relatively shallow look into BlueZ, there appears to be a way to inject this into the Linux code as well, though my understanding of D-Bus Bluetooth is weak (I have seen examples of this kind of thing in the python BlueZ stack).

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

No branches or pull requests

1 participant