Bluetooth: 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: Ib10f7ec8cdf92dd67e602a9b57d20a35ebacde4e
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
This commit is contained in:
Mariusz Skamra 2016-03-22 14:34:33 +01:00 committed by Gerrit Code Review
commit 3d35533c95

View file

@ -2668,8 +2668,18 @@ static bool valid_adv_param(const struct bt_le_adv_param *param)
{ {
switch (param->type) { switch (param->type) {
case BT_LE_ADV_IND: case BT_LE_ADV_IND:
break;
case BT_LE_ADV_SCAN_IND: case BT_LE_ADV_SCAN_IND:
case BT_LE_ADV_NONCONN_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; break;
default: default:
return false; return false;