-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Samples: Bluetooth: Vendor Specific: support for HCI Scan Request #68659
Samples: Bluetooth: Vendor Specific: support for HCI Scan Request #68659
Conversation
9b32b5e
to
27d559f
Compare
Tested the changes here. Controller changes already reviewed here: Tested the sample when not using Vendor Specific feature (Using Advertising Extensions): |
CONFIG_BT_CTLR_VS_SCAN_REQ_RX=y | ||
CONFIG_BT_CTLR_ADVANCED_FEATURES=y | ||
CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y |
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.
These should be placed in a separate overlay file, say overlay-bt_ll_sw_split.conf
and have a sample.yaml
file that be by CI to test building this sample (take a look at other samples that do something similar).
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.
I pushed you change proposal. The sample app builds on my machine. I don't know why it's getting this error in CI:
FileNotFoundError: [Errno 2] No such file or directory: '_test_plan_partial.json'
When I try running on my console:
scripts/twister -c -T tests/bluetooth/init -T samples/bluetooth/hci_vs_scan_req --all --save-tests _test_plan_partial.json
I see no errors, yet not sure if it's done correctly.
@giansta With the sample in this PR, with I do not see your upto ~5.5 KB saving in RAM... is your saving in your product application? |
27d559f
to
0c72bb5
Compare
Thanks for your reply :) Specific savings will always depend on your configuration, and for the nRF52840 that I did my tests on, the savings would be less than 1 kB using the newest main for the samples, but of course this depends on the Kconfig values as well as the application (Which I why I wanted to get any specific numbers be removed). With everything in the sample now (thank you!), I'm no longer against this :) Given that this is a sample, and that samples should, IMO, be as simple as possible (and not defined to be used for performance experimentation), I would still suggest to remove the EXT_ADV stuff from it, so that it be much clearer what it does, and be a lot easier to read. If you do want to keep the EXT_ADV stuff, then I would suggest to modify the code so that everything related to one is in a single block (or even in a single file), and ditto for the other, although I'm still in favor of just removing everything related to EXT_ADV as this VS command is specifically for devices that does not want to use that, right? |
46c9294
to
653cf1f
Compare
I've both removed specific values of memory saving and all code using extended adv. |
The BabbleSim Tests seem to have errors somewhere else, right? |
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.
No further comments. The rest of the PR is ok for me
/* Allow different TX power per role/connection. It requires CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL. | ||
* same as in samples/bluetooth/hci_pwr_ctrl/src | ||
*/ | ||
static void set_tx_power(uint8_t handle_type, uint16_t handle, int8_t tx_pwr_lvl) |
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.
Does this sample really need to set the TX power?
I think you should remove it if not absolutely necessary, as to make the sample as focused and streamlined as possible.
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.
It's necessary in our app module, not in this sample: removed.
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.
A few more minor requests
653cf1f
to
869aed1
Compare
RAM usage than using extended advertising. | ||
This is quite important in applications in which the broadcaster role is added | ||
to the central role, where the RAM saving can be bigger. | ||
This sample implements only the broadcaster role; the peripheral role with |
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.
A last comment and then I'll approve:
The sample can be slimmed down even more, by removing the CONFIG_BT_PERIPHERAL
support.
I don't see it adding anything related to this VS event in the code. Users can easily copy code from peripheral samples if they need it.
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.
I agree with this. Since the purpose of this sample is to show the VS command, then it should do just that.
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.
removed
CONFIG_LOG=y | ||
CONFIG_BT_BROADCASTER=y | ||
CONFIG_BT_DEVICE_NAME="VS Scan Notify" | ||
#CONFIG_BT_PERIPHERAL=y |
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.
remove
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.
removed
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.
A few final thoughts, but otherwise LGTM.
Thanks for your quick updates and patience :)
@@ -0,0 +1 @@ | |||
CONFIG_BT_CTLR_VS_SCAN_REQ_RX=y |
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.
Should this be moved to the prj.conf file?
Since the main purpose of the sample is to use this, it shouldn't be in an overlay IMO
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.
It was asked above to move some configs into this overlay file. Config moved and overlay removed, if it doesn't break anything in CI.
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.
I see. I guess you are referring to #68659 (comment)
@cvinayak Should CONFIG_BT_CTLR_VS_SCAN_REQ_RX
really be in an overlay if the sample's primary purpose is to test this feature?
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.
I was only concern if the sample was to be used with other Controllers that may decide to add the feature in which case supplying overlay files seemed fair.
I have no objections as-is to have in prj.conf, and changes can be done in the future if required.
869aed1
to
320b2bf
Compare
@cvinayak could you re-review? |
No way to merge this PR? |
@giansta You need to rebase the PR as there is a merge conflict |
Example of usage of HCI vendor specific Set Scan Request Reports command, Scan Request Received Event and corresponding callback to get application events. The sample application shows usage as an alternative to extended advertisent saving precious RAM. Signed-off-by: Giancarlo Stasi <[email protected]>
320b2bf
to
f807980
Compare
Sorry, I was focusing on the above request for review and missed the below conflict. Rebased now. |
@cvinayak please dismiss your review or re-review this |
Can I ask if something is preventing this PR to be merged? Any further action required? |
Example of usage of HCI vendor specific Set Scan Request Reports command, Scan Request Received Event and corresponding callback to get application events.
The sample application shows usage as an alternative to extended advertisement saving precious RAM.
With sample application the RAM saving as an alternative to extended advertisement is about 1.5 kB RAM. Building more complex applications gives larger RAM usage saving, around 5 kB.
This PR depends on previous #66529