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

NRF.setServices 'advertise' puts advertisements in Scan Response #1966

Open
gfwilliams opened this issue Dec 16, 2020 · 2 comments
Open

NRF.setServices 'advertise' puts advertisements in Scan Response #1966

gfwilliams opened this issue Dec 16, 2020 · 2 comments
Labels

Comments

@gfwilliams
Copy link
Member

@gfwilliams gfwilliams commented Dec 16, 2020

As found at:

As well as some other posts - it's really catching a lot of people out. Unless they won't fit, services should go in the standard Advertising packet.

The API is also a bit rubbish since the service should really be specified in 'setAdvertising' - we should maybe deprecate the old method.

Also related to #1371 Espruino uses the Nordic API to work out the advertising packet, but there isn't really a nice way of detecting when there's too much stuff to advertise. It's so simple we should probably make Espruino create the advertising packet, then we might have some options about how we notify the user and/or start moving advertised services into the scan response.

@gfwilliams gfwilliams added the nRF5x label Dec 16, 2020
@fanoush
Copy link
Contributor

@fanoush fanoush commented Dec 16, 2020

just comment about idea 'put there everything what fits', there are low power guides that mention making advertising packet smallest and return rest only on request (=in scan response). So should be overridable in some way for those wanting to maximize battery life, see https://www.novelbits.io/ble-power-consumption-optimization/ part Advertising state - Advertising data length

@gfwilliams
Copy link
Member Author

@gfwilliams gfwilliams commented Dec 16, 2020

Thanks - good idea. Maybe it's best not to even bother doing it automatically and to just error. One issue is the Nordic UART and HID service IDs get automatically added to the scan response when enabled, but maybe we actually just ignore that and when you specify a scan response the UART/HID stuff is overwritten.

Right now NRF.setAdvertising basically uses NRF.getAdvertisingData to get the data internally.

What I'm hoping is where you want to stick stuff in a scan response, you do NRF.setScanResponse(NRF.getAdvertisingData(...)).

Note to me: Scan Response is currently broken for SDK15 builds because of the way it needs setting alongside advertising data. This would be a good opportunity to fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants