Bluetooth: samples: Use bt_hci_cmd_alloc()

Use bt_hci_cmd_alloc() instead of the soon to be deprecated
bt_hci_cmd_create().

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
This commit is contained in:
Johan Hedberg 2025-06-19 04:10:03 +03:00 committed by Dan Kalowsky
parent c186a3110c
commit 187ec7012d
2 changed files with 4 additions and 6 deletions

View File

@ -57,7 +57,7 @@ static void read_conn_rssi(uint16_t handle, int8_t *rssi)
int err;
buf = bt_hci_cmd_create(BT_HCI_OP_READ_RSSI, sizeof(*cp));
buf = bt_hci_cmd_alloc(K_FOREVER);
if (!buf) {
printk("Unable to allocate command buffer\n");
return;
@ -86,8 +86,7 @@ static void set_tx_power(uint8_t handle_type, uint16_t handle, int8_t tx_pwr_lvl
struct net_buf *buf, *rsp = NULL;
int err;
buf = bt_hci_cmd_create(BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL,
sizeof(*cp));
buf = bt_hci_cmd_alloc(K_FOREVER);
if (!buf) {
printk("Unable to allocate command buffer\n");
return;
@ -119,8 +118,7 @@ static void get_tx_power(uint8_t handle_type, uint16_t handle, int8_t *tx_pwr_lv
int err;
*tx_pwr_lvl = 0xFF;
buf = bt_hci_cmd_create(BT_HCI_OP_VS_READ_TX_POWER_LEVEL,
sizeof(*cp));
buf = bt_hci_cmd_alloc(K_FOREVER);
if (!buf) {
printk("Unable to allocate command buffer\n");
return;

View File

@ -65,7 +65,7 @@ static void enable_legacy_adv_scan_request_event(bool enable)
struct net_buf *buf;
int err;
buf = bt_hci_cmd_create(BT_HCI_OP_VS_SET_SCAN_REQ_REPORTS, sizeof(*cp));
buf = bt_hci_cmd_alloc(K_FOREVER);
if (!buf) {
printk("%s: Unable to allocate HCI command buffer\n", __func__);
return;