drivers/nble: Fix validation of advertising parameters

According to the Core Sepcification, Advertising Interval Min/Max
shall not be set to less than 0x00a0 if ADV_SCAN_IND or ADV_NONCONN_IND
type is used.

Change-Id: I6c4ef4f73b82841c3a96694dda670cdd12a40a54
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2016-03-22 18:41:13 +02:00 committed by Gerrit Code Review
parent 7a585ee137
commit cb5f5d2423
1 changed files with 10 additions and 0 deletions

View File

@ -177,8 +177,18 @@ static bool valid_adv_param(const struct bt_le_adv_param *param)
{
switch (param->type) {
case BT_LE_ADV_IND:
break;
case BT_LE_ADV_SCAN_IND:
case BT_LE_ADV_NONCONN_IND:
/*
* BT Core 4.2 [Vol 2, Part E, 7.8.5]
* The Advertising_Interval_Min and Advertising_Interval_Max
* shall not be set to less than 0x00A0 (100 ms) if the
* Advertising_Type is set to ADV_SCAN_IND or ADV_NONCONN_IND.
*/
if (param->interval_min < 0x00a0) {
return false;
}
break;
default:
return false;