-
Notifications
You must be signed in to change notification settings - Fork 140
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
hci: add advertiser support for ManufacturerData and ServiceData #307
base: dev
Are you sure you want to change the base?
Conversation
@@ -125,6 +125,26 @@ func (a *Advertisement) Stop() error { | |||
return nil | |||
} | |||
|
|||
// SetServiceData sets the service data for the advertisement. | |||
func (a *Advertisement) SetServiceData(sd []ServiceDataElement) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aykevl do you happen to know how I can do this? 😸
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is your goal?
If you want to change advertisement data then I think you can stop and restart the advertisement with the new service data. Looking at the API I don't see a straightforward way to update any part of the advertisement. But this is straightforward to do from userspace: simply stop and restart the advertisement with the new parameters.
See:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/org.bluez.LEAdvertisement.rst
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/org.bluez.LEAdvertisingManager.rst
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to change advertisement data then I think you can stop and restart the advertisement
OK I will probably do that in a separate PR.
@@ -125,6 +125,26 @@ func (a *Advertisement) Stop() error { | |||
return nil | |||
} | |||
|
|||
// SetServiceData sets the service data for the advertisement. | |||
func (a *Advertisement) SetServiceData(sd []ServiceDataElement) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is your goal?
If you want to change advertisement data then I think you can stop and restart the advertisement with the new service data. Looking at the API I don't see a straightforward way to update any part of the advertisement. But this is straightforward to do from userspace: simply stop and restart the advertisement with the new parameters.
See:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/org.bluez.LEAdvertisement.rst
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/org.bluez.LEAdvertisingManager.rst
gap_nrf528xx-advertisement.go
Outdated
// TODO: implement | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this can be implemented here, but it needs a different API.
https://docs.nordicsemi.com/bundle/s132_v6.0.0_api/page/group_b_l_e_g_a_p_f_u_n_c_t_i_o_n_s.html#ga9969047f4e7485c3f856c841978cc31a
Instead of a SetServiceData
, you'd need to construct an entirely new advertisement payload (bluetooth.AdvertisementOptions
) and set it as a whole.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about preserve the initial options and then set a new payload when SetServiceData
is changed?
Please see the new example beacon
for how I am trying to use this function.
2cc12eb
to
7dbb60e
Compare
Signed-off-by: deadprogram <[email protected]>
…ter Advertisment is started Signed-off-by: deadprogram <[email protected]>
Signed-off-by: deadprogram <[email protected]>
7dbb60e
to
95bf26a
Compare
This PR adds advertiser support for ManufacturerData and ServiceData to the HCI implementation.
Addresses #306