Bluetooth: Simplify setting advertising parameters
There is no need for special handling of command complete when using bt_hci_cmd_send_sync for sending HCI command. Change-Id: I60671e490958e67f5d20dc8c6ddbf51ca839c338 Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
parent
e5493c9ac8
commit
4e4b81f06f
1 changed files with 7 additions and 23 deletions
|
@ -2090,20 +2090,6 @@ static void hci_cmd_done(uint16_t opcode, uint8_t status, struct net_buf *buf)
|
|||
}
|
||||
}
|
||||
|
||||
static void set_adv_param_complete(struct net_buf *buf)
|
||||
{
|
||||
struct bt_hci_cp_le_set_adv_param *cp = (void *)bt_dev.sent_cmd->data;
|
||||
uint8_t *status = (void *)buf->data;
|
||||
|
||||
BT_DBG("status 0x%02x", *status);
|
||||
|
||||
if (*status) {
|
||||
return;
|
||||
}
|
||||
|
||||
bt_dev.adv_addr_type = cp->own_addr_type;
|
||||
}
|
||||
|
||||
static void hci_cmd_complete(struct net_buf *buf)
|
||||
{
|
||||
struct hci_evt_cmd_complete *evt = (void *)buf->data;
|
||||
|
@ -2119,12 +2105,6 @@ static void hci_cmd_complete(struct net_buf *buf)
|
|||
*/
|
||||
status = buf->data[0];
|
||||
|
||||
switch (opcode) {
|
||||
case BT_HCI_OP_LE_SET_ADV_PARAM:
|
||||
set_adv_param_complete(buf);
|
||||
break;
|
||||
}
|
||||
|
||||
hci_cmd_done(opcode, status, buf);
|
||||
|
||||
if (evt->ncmd && !bt_dev.ncmd) {
|
||||
|
@ -3465,8 +3445,7 @@ int bt_le_adv_start(const struct bt_le_adv_param *param,
|
|||
}
|
||||
}
|
||||
|
||||
buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM,
|
||||
sizeof(*set_param));
|
||||
buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(*set_param));
|
||||
if (!buf) {
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
@ -3505,7 +3484,12 @@ int bt_le_adv_start(const struct bt_le_adv_param *param,
|
|||
break;
|
||||
}
|
||||
|
||||
bt_hci_cmd_send(BT_HCI_OP_LE_SET_ADV_PARAM, buf);
|
||||
err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_SET_ADV_PARAM, buf, NULL);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
bt_dev.adv_addr_type = set_param->own_addr_type;
|
||||
|
||||
err = set_advertise_enable();
|
||||
if (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue