aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/emulator
diff options
context:
space:
mode:
authorTedd Ho-Jeong An <tedd.an@intel.com>2021-06-22 21:49:43 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-06-23 11:51:11 -0700
commit468d6f1191161f544c509494652f55810e3ac81c (patch)
tree80fef2589c25dc2f497f1ae292d32a7282157042 /emulator
parentd9979f26e6711295e13b4c643089802acfae8e76 (diff)
emulator/bthost: Create ext adv params before setting adv data
Based on the SPEC 5.2 Vol 4, Part E, Section 7.8.54, the LE_Set_Extended_Advertising_Data_Command may be issued after an advertising set identifed by the Advertising_Handle has been created using the HCI_LE_Set_Extended_Advertising_Parameters command.
Diffstat (limited to 'emulator')
-rw-r--r--emulator/bthost.c26
-rw-r--r--emulator/bthost.h1
2 files changed, 21 insertions, 6 deletions
diff --git a/emulator/bthost.c b/emulator/bthost.c
index 16934d35a5..62f5a1bae0 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
@@ -2549,6 +2549,7 @@ void bthost_set_ext_adv_data(struct bthost *bthost, const uint8_t *data,
memset(adv_cp, 0, sizeof(*adv_cp));
memset(adv_cp->data, 0, 31);
+ adv_cp->handle = 1;
adv_cp->operation = 0x03;
adv_cp->fragment_preference = 0x01;
@@ -2572,20 +2573,33 @@ void bthost_set_adv_enable(struct bthost *bthost, uint8_t enable)
send_command(bthost, BT_HCI_CMD_LE_SET_ADV_ENABLE, &enable, 1);
}
-void bthost_set_ext_adv_enable(struct bthost *bthost, uint8_t enable)
+void bthost_set_ext_adv_params(struct bthost *bthost)
{
struct bt_hci_cmd_le_set_ext_adv_params cp;
- struct bt_hci_cmd_le_set_ext_adv_enable cp_enable;
memset(&cp, 0, sizeof(cp));
+ cp.handle = 0x01;
cp.evt_properties = cpu_to_le16(0x0013);
send_command(bthost, BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS,
&cp, sizeof(cp));
+}
+
+void bthost_set_ext_adv_enable(struct bthost *bthost, uint8_t enable)
+{
+ struct bt_hci_cmd_le_set_ext_adv_enable *cp_enable;
+ struct bt_hci_cmd_ext_adv_set *cp_set;
+ uint8_t cp[6];
+
+ memset(cp, 0, 6);
+
+ cp_enable = (struct bt_hci_cmd_le_set_ext_adv_enable *)cp;
+ cp_set = (struct bt_hci_cmd_ext_adv_set *)(cp + sizeof(*cp_enable));
+
+ cp_enable->enable = enable;
+ cp_enable->num_of_sets = 1;
+ cp_set->handle = 1;
- memset(&cp_enable, 0, sizeof(cp_enable));
- cp_enable.enable = enable;
- send_command(bthost, BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE, &cp_enable,
- sizeof(cp_enable));
+ send_command(bthost, BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE, cp, 6);
}
void bthost_write_ssp_mode(struct bthost *bthost, uint8_t mode)
diff --git a/emulator/bthost.h b/emulator/bthost.h
index 7e5286df3a..5a85b7232c 100644
--- a/emulator/bthost.h
+++ b/emulator/bthost.h
@@ -80,6 +80,7 @@ void bthost_set_adv_enable(struct bthost *bthost, uint8_t enable);
void bthost_set_ext_adv_data(struct bthost *bthost, const uint8_t *data,
uint8_t len);
+void bthost_set_ext_adv_params(struct bthost *bthost);
void bthost_set_ext_adv_enable(struct bthost *bthost, uint8_t enable);
void bthost_write_ssp_mode(struct bthost *bthost, uint8_t mode);