Skip to content

Conversation

@matteo-meluzzi
Copy link

add_service has an additional argument advertised which is None by default.
if advertised is None, then the behavior is unchanged compared to before.
if advertised is True or False, its value is used to determine whether the service should be advertised.

Since advertised has default value None, this pull request is backwards compatible with all existing bluezero code.
In addition, it gives developers the option to not advertise a primary service. This is useful because BLE has a maximum advertising size of 31 bytes, and a service UUID can use up to 16 bytes, which leaves little or no room for other data.

@ukBaz
Copy link
Owner

ukBaz commented Dec 7, 2024

The CI/CD has failed on this pull request so please take a look at that.

With the change that you have suggested, hasn't primary_services been replaced with advertised_services. I don't know the specific set of services you are creating and how they relate, but isn't the primary option giving the control that is required?

@matteo-meluzzi
Copy link
Author

The CI/CD issue has been resolved — it was just a linter problem due to it not being installed on my machine.

As for the change with primary_services and advertised_services, it's simply a variable rename. The behavior remains fully backward compatible, and the control you’re referring to is still intact. There’s no change in functionality, just clearer naming of variables.

@ukBaz
Copy link
Owner

ukBaz commented Dec 28, 2024

There is still an issue with the lint failing CI/CD.

If you used the original code with add_service parameter primary=False, would that achieve the same as your modified code?

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