-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Bluetooth: Host: Add advertising state to bt_le_ext_adv_info #90185
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
base: main
Are you sure you want to change the base?
Conversation
There will be a use of these new fields in #85642:
|
Did also consider to also add the options as field to the info, but I don't have a use case for it at this moment |
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.
Pull Request Overview
Adds tracking and reporting of extended and periodic advertising states to Bluetooth LE advertising info and shell output, with input validation to prevent NULL dereferences.
- Extend
bt_le_ext_adv_info
withext_adv_state
andper_adv_state
enums - Validate arguments and populate new state fields in
bt_le_ext_adv_get_info
- Print the new states in the shell command
cmd_adv_info
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
subsys/bluetooth/host/shell/bt.c | Print extended/periodic advertising states in shell output |
subsys/bluetooth/host/adv.c | Validate inputs and set advertising/periodic state in info struct |
include/zephyr/bluetooth/bluetooth.h | Add enums for advertising states and update struct documentation |
Comments suppressed due to low confidence (1)
subsys/bluetooth/host/shell/bt.c:2573
- [nitpick] Rename the label 'Per Adv state' to 'Periodic Adv state' to more clearly reflect its meaning.
shell_print(sh, "Per Adv state: %d", info.per_adv_state);
include/zephyr/bluetooth/bluetooth.h
Outdated
/** The advertising set is started */ | ||
BT_LE_EXT_ADV_STATE_STARTED, | ||
|
||
/** Ther advertising set is temporarily paused */ |
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.
Fix typo in comment: change 'Ther' to 'The'.
/** Ther advertising set is temporarily paused */ | |
/** The advertising set is temporarily paused */ |
Copilot uses AI. Check for mistakes.
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.
Pull Request Overview
This PR extends the advertising information structure to include extended and periodic advertising states, and improves input validation to prevent NULL pointer accesses.
- Adds printing of advertising and periodic advertising states in the shell command output.
- Introduces new pointer validations and state assignments in bt_le_ext_adv_get_info.
- Updates header file with new state enums and refined documentation.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
subsys/bluetooth/host/shell/bt.c | Prints new extended and periodic advertising state information. |
subsys/bluetooth/host/adv.c | Adds NULL checks, state assignments, and initializes info struct. |
include/zephyr/bluetooth/bluetooth.h | Introduces new advertising state enums and updates documentation. |
The bt_le_ext_adv_info struct has been extended to also contain the advertising and periodic advertising states. Additionally, the function verifies the input to avoid NULL pointer access, and the addr field is more properly documented. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
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.
Pull Request Overview
Adds explicit tracking and display of extended and periodic advertising states in the Bluetooth LE advertising APIs and shell.
- Extend
bt_le_ext_adv_info
withext_adv_state
andper_adv_state
enums. - Add input validation and state population in
bt_le_ext_adv_get_info
. - Update shell command to print the new advertising state fields.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
subsys/bluetooth/host/shell/bt.c | Print extended and periodic advertising states and conditionally show address only when advertising is started. |
subsys/bluetooth/host/adv.c | Validate adv and info pointers, memset info, and set up new state fields based on flags. |
include/zephyr/bluetooth/bluetooth.h | Define enums for extended and periodic advertising states; update struct and function return documentation. |
Comments suppressed due to low confidence (1)
subsys/bluetooth/host/shell/bt.c:2573
- [nitpick] The abbreviation "Per Adv state" may not be immediately clear; consider using "Periodic Adv state" for consistency and clarity.
shell_print(sh, "Per Adv state: %d", info.per_adv_state);
|
The bt_le_ext_adv_info struct has been extended to also contain the advertising and periodic advertising states.
Additionally, the function verifies the input to avoid NULL pointer access, and more importantly does not return 0 with
addr
set to a valid that is notused for advertising.