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

Callbacks for interval change and FRC request #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Heiko-L
Copy link

@Heiko-L Heiko-L commented Jan 4, 2025

Instead of polling for FRC request there is now an option to register a callback function which is called on request.
Furthermore an option for a callback function on interval change is given.

@qfisch
Copy link
Contributor

qfisch commented Jan 20, 2025

Hello @Heiko-L
Thank you for your contribution.
Could you make 2 commits out of it in order to clearly detail changes ?
Cheers
Q

@qfisch qfisch self-requested a review January 20, 2025 08:02
@Heiko-L
Copy link
Author

Heiko-L commented Jan 20, 2025

Now I reconsidered a bit and think that I keep my hands off the constructor and add callback functionality externally to keep compatibility.
At the same time I also plan to add a lot new characteristics- should there be a commit for every characteristic?

@qfisch
Copy link
Contributor

qfisch commented Jan 20, 2025

Your new approach would indeed be better IMO.
Implementing a new DataProvider that implements src/IProviderCallbacks.h but relies on call forwarding is also an option...

Concerning the "paperwork":
I would even make 2 PRs in this case.
One for the callbacks, and one for the characteristics (with detailed commits)
Thanks for your contribution

Q.

@Heiko-L
Copy link
Author

Heiko-L commented Jan 28, 2025

I added SCDDataProvider (derived from DataProvider) and SCD4xDataProvider (derived from SCDDataProvider).
Therefore I had to add both as friends of DataProvider. I also had to separate the setup of the BLE services in DataProvider to extend them in the derived classes.
In IBLELibraryWrapper I added a method to register callbacks (which are stored in a std::map in struct WrapperPrivateData) and added 7 new characteristics. I also changed WrapperPrivateData::onWrite to call the registered callbacks.

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 this pull request may close these issues.

2 participants