-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1714,6 +1714,27 @@ int bt_le_ext_adv_delete(struct bt_le_ext_adv *adv); | |
*/ | ||
uint8_t bt_le_ext_adv_get_index(struct bt_le_ext_adv *adv); | ||
|
||
/** Advertising states. */ | ||
enum bt_le_ext_adv_state { | ||
/** The advertising set has been created but not enabled. */ | ||
BT_LE_EXT_ADV_STATE_DISABLED, | ||
|
||
/** The advertising set is enabled. */ | ||
BT_LE_EXT_ADV_STATE_ENABLED, | ||
}; | ||
|
||
/** Periodic Advertising states. */ | ||
enum bt_le_per_adv_state { | ||
/** Not configured for periodic advertising. */ | ||
BT_LE_PER_ADV_STATE_NONE, | ||
|
||
/** The advertising set has been configured for periodic advertising, but is not enabled. */ | ||
BT_LE_PER_ADV_STATE_DISABLED, | ||
|
||
/** Periodic advertising is enabled. */ | ||
BT_LE_PER_ADV_STATE_ENABLED, | ||
}; | ||
|
||
/** @brief Advertising set info structure. */ | ||
struct bt_le_ext_adv_info { | ||
/** Local identity handle. */ | ||
|
@@ -1724,15 +1745,22 @@ struct bt_le_ext_adv_info { | |
|
||
/** Current local advertising address used. */ | ||
const bt_addr_le_t *addr; | ||
|
||
/** Extended advertising state. */ | ||
enum bt_le_ext_adv_state ext_adv_state; | ||
|
||
/** Periodic advertising state. */ | ||
enum bt_le_per_adv_state per_adv_state; | ||
Comment on lines
+1752
to
+1753
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be guarded by the periodic advertising feature support? according to implementation later in this PR, the referencing to conditionally guarded to always return There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did consider this, and was also discussed when I added something similar w.r.t. ISO in #86092, but it was, IIRC, decided that a small increase in the struct for something that is short-lived, would be OK. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ok, as the info struct in typical use is a auto variable, this is acceptable. |
||
}; | ||
|
||
/** | ||
* @brief Get advertising set info | ||
* | ||
* @param adv Advertising set object | ||
* @param info Advertising set info object | ||
* @param info Advertising set info object. The values in this object are only valid on success. | ||
Thalley marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* | ||
* @return Zero on success or (negative) error code on failure. | ||
* @retval 0 Success. | ||
* @retval -EINVAL @p adv is not valid advertising set or @p info is NULL. | ||
*/ | ||
int bt_le_ext_adv_get_info(const struct bt_le_ext_adv *adv, | ||
struct bt_le_ext_adv_info *info); | ||
|
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.
Why no
BT_LE_EXT_ADV_STATE_NONE
?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.
#90185 (comment)
Uh oh!
There was an error while loading. Please reload this page.
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 assume you are asking why there is a none state in one but not the other enum.
The none state in the periodic advertiser case means that no configuration has been set for periodic advertising for this set. We could remove the need for the none state in both of the enums if the Host sets a default configuration for periodic advertising. But this is extra code in the Host, so we should weight up the benefits.
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.
#90185 (comment)
An
enabled
boolean member in theinfo
structure instead is better for application to check.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.
The enum is far more extendable if we ever want to add back a state like PAUSED if that becomes a necessity, and it's also more consistent with the per_adv_state which cannot be a boolean
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.
Agreed. No action required from my side.