Skip to content

Add optional primary flag when creating a service.#167

Merged
kevincar merged 3 commits intokevincar:masterfrom
akiller:master
Jan 13, 2026
Merged

Add optional primary flag when creating a service.#167
kevincar merged 3 commits intokevincar:masterfrom
akiller:master

Conversation

@akiller
Copy link
Copy Markdown
Contributor

@akiller akiller commented Jan 11, 2026

Hi,

This is a fix for issue #146 which has also caused me problems.

When creating services the current logic seems to be:

  • WinRT: every service is primary (WinRT doesn't seem to let you change this)
  • corebluetooth: every service is set to primary
  • bluezdbus: only the first added service is set to primary

What this PR does is add a new optional primary parameter to add_new_service.

If set to None (the default), the existing logic above is used.
If set to True, the service is set to primary.
If set to False, the service isn't set as primary

(this has no effect on WinRT)

I've done some limited testing and it seems to work for me.

Thanks

@kevincar kevincar linked an issue Jan 13, 2026 that may be closed by this pull request
@kevincar kevincar merged commit 2a40a43 into kevincar:master Jan 13, 2026
9 checks passed
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.

Server advertising only 1 custom service out of 2

2 participants