-
Notifications
You must be signed in to change notification settings - Fork 2k
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
pkg/nimble: optimize package initialization #11131
pkg/nimble: optimize package initialization #11131
Conversation
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.
Minor nit-pick
bluetil_ad_t ad; | ||
bluetil_ad_init_with_flags(&ad, buf, sizeof(buf), BLUETIL_AD_FLAGS_DEFAULT); | ||
bluetil_ad_add_name(&ad, device_name); | ||
ble_gap_adv_set_data(ad.buf, ad.pos); |
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.
Could you please add a comment to the commit why you unrolled this function.
Tested ACK. We can merge if you at least acknowledge my comment ;-) |
This static function was a leftover from very early stages of this example and at the current state there is not sense in keeping it. Having these few lines directly where the advertising is triggered makes the code more clean and readible.
35a56a3
to
4e49fa5
Compare
put the justification in the commit message. |
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.
Thanks. ACK.
all green, lets go. |
Contribution description
Some typical initialization steps for nimBLE need to be (re-)written for any application, so it makes sense to put them in the shared initialization code path to prevent (future) code duplication. I have a couple of additional example applications that I am preparing (mostly around ICN and IPv6 over BLE), and all of these will benefit from these proposed changes.
This PR collects some generic initialization artifacts and places them in the global init function. It then removes these lines from the
nimble_gatt
example.Testing procedure
Run the
examples/nimble_gatt
example an verify that all services are still working.Issues/PRs references
none