From 03487ec592d59bab48bbcfbfd386d15aad694fa7 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Thu, 4 Nov 2021 17:17:10 +0100 Subject: [PATCH] tests: bluetooth: tester: Adjust Directed Advertising to latest BTP This makes implementation in sync with autopts. Signed-off-by: Szymon Janc --- tests/bluetooth/tester/src/bttester.h | 7 +++++-- tests/bluetooth/tester/src/gap.c | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/bluetooth/tester/src/bttester.h b/tests/bluetooth/tester/src/bttester.h index 71e51cd1fc2..f9821a900b4 100644 --- a/tests/bluetooth/tester/src/bttester.h +++ b/tests/bluetooth/tester/src/bttester.h @@ -228,12 +228,15 @@ struct gap_passkey_confirm_cmd { uint8_t match; } __packed; +#define GAP_START_DIRECTED_ADV_HD 0x0001 +#define GAP_START_DIRECTED_ADV_OWN_ID 0x0002 +#define GAP_START_DIRECTED_ADV_PEER_RPA 0x0004 + #define GAP_START_DIRECTED_ADV 0x15 struct gap_start_directed_adv_cmd { uint8_t address_type; uint8_t address[6]; - uint8_t high_duty; - uint8_t own_id_addr; + uint16_t options; } __packed; struct gap_start_directed_adv_rp { uint32_t current_settings; diff --git a/tests/bluetooth/tester/src/gap.c b/tests/bluetooth/tester/src/gap.c index c40ec69dc25..861516c870a 100644 --- a/tests/bluetooth/tester/src/gap.c +++ b/tests/bluetooth/tester/src/gap.c @@ -494,10 +494,12 @@ static void start_directed_advertising(const uint8_t *data, uint16_t len) const struct gap_start_directed_adv_cmd *cmd = (void *)data; struct gap_start_directed_adv_rp rp; struct bt_le_adv_param adv_param; + uint16_t options = sys_le16_to_cpu(cmd->options); + const bt_addr_le_t *peer = (bt_addr_le_t *)data; - adv_param = *BT_LE_ADV_CONN_DIR((bt_addr_le_t *)data); + adv_param = *BT_LE_ADV_CONN_DIR(peer); - if (cmd->high_duty == 0) { + if (!(options & GAP_START_DIRECTED_ADV_HD)) { adv_param.options |= BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY; adv_param.interval_max = BT_GAP_ADV_FAST_INT_MAX_2; adv_param.interval_min = BT_GAP_ADV_FAST_INT_MIN_2;