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

Add binc_application_get_adapter, binc_adapter_set/get_alias #86

Closed
wants to merge 3 commits into from

Conversation

abqjln
Copy link
Contributor

@abqjln abqjln commented Jan 5, 2025

Allow using adapter as unique identifier in callbacks with application arguments.

@abqjln abqjln changed the title Add binc_application_get_adapter Add binc_application_get_adapter, binc_adapter_set/get_alias Jan 5, 2025
@weliem
Copy link
Owner

weliem commented Jan 7, 2025

Can you elaborate why you think this change is necessary?

@abqjln
Copy link
Contributor Author

abqjln commented Jan 7, 2025

Sorry, I didn't realize these two would be combined if I didn't allow the first one to be processed. If you prefer, please reject and I'll split them and resubmit if you prefer.


For the binc_adapter_set/get_alias: This is a workaround for an earlier issue with bluez I posted here with the names of the adapter changing. There is an (still unclear to me) bluez naming process that starts using the advertised name but changes to the hostname plugin name after some reads. One can now just set/get the alias (vs the name that bluez changes) and it sticks.

I also have a device_get_alias I am using and was planning on a PR. Please advise if you don't think these would fit. Thanks.


For the binc_application_get_adapter: Exposing the adapter pointer in Application allows the use of the adapter address as a key in hash tables.

I have multiple servers/adapters and their associated data structures running simultaneously. I use a hash table with server adapter address as the key to get the pointer to the specific server data structure.

The application.c callbacks, e.g., binc_application_set_char_read_cb use typedef that only pass the const Application *application. The application path changes with every run; while the server adapter addresses do not. So exposing the adapter pointer in Application solves this issue by allowing me to get the adapter address. It also leaves me some hope of caching data with this relatively unchanging value. (If there is a better way, please let me know).

@abqjln
Copy link
Contributor Author

abqjln commented Jan 9, 2025

I will break these into simpler pieces after understanding why checks failed.

@abqjln abqjln closed this Jan 9, 2025
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