diff options
author | Keyur Parekh <kpare@dolby.com> | 2021-03-16 07:41:36 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-04-06 17:13:37 -0700 |
commit | 44b82b959d02dfbdd8a592036e8aa14a0872755c (patch) | |
tree | a9bed8e193d69249c1df4a27e51b1d9cf519872b /emulator | |
parent | a2d34c61973fc88c7305fc4907c30940a5f3e16f (diff) | |
download | bluez-44b82b959d02dfbdd8a592036e8aa14a0872755c.tar.gz |
emulator: Add Create BIG command in emulator
This adds support for Create BIG command HCI
command in emulator. These changes are needed for
making the emulator useful for testing
LE Audio broadcast feature.
Diffstat (limited to 'emulator')
-rw-r--r-- | emulator/btdev.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/emulator/btdev.c b/emulator/btdev.c index 742c6864b..99fe3a13c 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -4511,10 +4511,36 @@ static int cmd_reject_cis(struct btdev *dev, const void *data, uint8_t len) static int cmd_create_big(struct btdev *dev, const void *data, uint8_t len) { - /* TODO */ - return -ENOTSUP; + cmd_status(dev, BT_HCI_ERR_SUCCESS, BT_HCI_CMD_LE_CREATE_BIG); + + return 0; } +static int cmd_create_big_complete(struct btdev *dev, const void *data, + uint8_t len) +{ + const struct bt_hci_cmd_le_create_big *cmd = data; + int i; + + for (i = 0; i < cmd->num_bis; i++) { + const struct bt_hci_bis *bis = &cmd->bis[i]; + struct { + struct bt_hci_evt_le_big_complete evt; + uint16_t handle; + } pdu; + + pdu.evt.handle = cmd->handle; + pdu.evt.num_bis = cmd->num_bis; + pdu.evt.phy = bis->phy; + memcpy(&pdu.evt.latency, &(bis->latency), 3); + pdu.evt.handle = cpu_to_le16(ISO_HANDLE + i); + + le_meta_event(dev, BT_HCI_EVT_LE_BIG_COMPLETE, &pdu, + sizeof(pdu)); + } + + return 0; +} static int cmd_create_big_test(struct btdev *dev, const void *data, uint8_t len) { /* TODO */ @@ -4740,7 +4766,8 @@ static int cmd_config_data_path(struct btdev *dev, const void *data, CMD(BT_HCI_CMD_LE_REMOVE_CIG, cmd_remove_cig, NULL), \ CMD(BT_HCI_CMD_LE_ACCEPT_CIS, cmd_accept_cis, NULL), \ CMD(BT_HCI_CMD_LE_REJECT_CIS, cmd_reject_cis, NULL), \ - CMD(BT_HCI_CMD_LE_CREATE_BIG, cmd_create_big, NULL), \ + CMD(BT_HCI_CMD_LE_CREATE_BIG, cmd_create_big, \ + cmd_create_big_complete), \ CMD(BT_HCI_CMD_LE_CREATE_BIG_TEST, cmd_create_big_test, NULL), \ CMD(BT_HCI_CMD_LE_TERM_BIG, cmd_term_big, NULL), \ CMD(BT_HCI_CMD_LE_BIG_CREATE_SYNC, cmd_big_create_sync, NULL), \ |