Bluetooth: host: Document and check for disallowed directed advertising

Document and validate advertising parameters for the disallowed
advertising mode high duty cycle directed connectable advertising
using extended advertising PDUs.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2020-10-26 13:09:08 +01:00 committed by Johan Hedberg
commit 92deb9ddba
2 changed files with 11 additions and 0 deletions

View file

@ -534,6 +534,8 @@ struct bt_le_adv_param {
*
* The advertising type will either be high duty cycle, or low duty
* cycle if the BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY option is enabled.
* When using @ref BT_LE_ADV_OPT_EXT_ADV then only low duty cycle is
* allowed.
*
* In case of connectable high duty cycle if the connection could not
* be established within the timeout the connected() callback will be

View file

@ -7580,6 +7580,15 @@ static bool valid_adv_ext_param(const struct bt_le_adv_param *param)
return false;
}
if (param->peer &&
(param->options & BT_LE_ADV_OPT_EXT_ADV) &&
!(param->options & BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY)) {
/* High duty cycle directed connectable advertising
* shall not be used with Extended Advertising.
*/
return false;
}
if (!(param->options & BT_LE_ADV_OPT_EXT_ADV) &&
param->options & (BT_LE_ADV_OPT_EXT_ADV |
BT_LE_ADV_OPT_NO_2M |