/******************************************************************************
*
- * Copyright (C) 1999-2012 Broadcom Corporation
+ * Copyright 1999-2012 Broadcom Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
******************************************************************************/
+#define LOG_TAG "bt_hciblecmds"
+
#include "bt_common.h"
#include "bt_target.h"
#include "btu.h"
#include "hcidefs.h"
#include "hcimsgs.h"
+#include "osi/include/log.h"
#include <base/bind.h>
#include <stddef.h>
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
-void btsnd_hcic_ble_set_random_addr(BD_ADDR random_bda) {
+void btsnd_hcic_ble_set_random_addr(const RawAddress& random_bda) {
BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
uint8_t* pp = (uint8_t*)(p + 1);
void btsnd_hcic_ble_write_adv_params(uint16_t adv_int_min, uint16_t adv_int_max,
uint8_t adv_type, uint8_t addr_type_own,
- uint8_t addr_type_dir, BD_ADDR direct_bda,
+ uint8_t addr_type_dir,
+ const RawAddress& direct_bda,
uint8_t channel_map,
uint8_t adv_filter_policy) {
BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
}
/* link layer connection management commands */
-void btsnd_hcic_ble_create_ll_conn(uint16_t scan_int, uint16_t scan_win,
- uint8_t init_filter_policy,
- uint8_t addr_type_peer, BD_ADDR bda_peer,
- uint8_t addr_type_own, uint16_t conn_int_min,
- uint16_t conn_int_max, uint16_t conn_latency,
- uint16_t conn_timeout, uint16_t min_ce_len,
- uint16_t max_ce_len) {
+void btsnd_hcic_ble_create_ll_conn(
+ uint16_t scan_int, uint16_t scan_win, uint8_t init_filter_policy,
+ uint8_t addr_type_peer, const RawAddress& bda_peer, uint8_t addr_type_own,
+ uint16_t conn_int_min, uint16_t conn_int_max, uint16_t conn_latency,
+ uint16_t conn_timeout, uint16_t min_ce_len, uint16_t max_ce_len) {
BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
uint8_t* pp = (uint8_t*)(p + 1);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
-void btsnd_hcic_ble_add_white_list(uint8_t addr_type, BD_ADDR bda) {
+void btsnd_hcic_ble_add_white_list(uint8_t addr_type, const RawAddress& bda) {
BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
uint8_t* pp = (uint8_t*)(p + 1);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
-void btsnd_hcic_ble_remove_from_white_list(uint8_t addr_type, BD_ADDR bda) {
+void btsnd_hcic_ble_remove_from_white_list(uint8_t addr_type,
+ const RawAddress& bda) {
BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
uint8_t* pp = (uint8_t*)(p + 1);
base::Bind(
[](base::Callback<void(BT_OCTET8)> cb,
uint8_t* param, uint16_t param_len) {
- CHECK(param[0] == 0)
- << "LE Rand return status must be zero";
+ LOG_WARN(LOG_TAG,
+ "LE Rand return status is not zero: %u", param[0]);
cb.Run(param + 1 /* skip status */);
},
std::move(cb)));
#endif
void btsnd_hcic_ble_add_device_resolving_list(
- uint8_t addr_type_peer, BD_ADDR bda_peer,
+ uint8_t addr_type_peer, const RawAddress& bda_peer,
uint8_t irk_peer[HCIC_BLE_IRK_SIZE], uint8_t irk_local[HCIC_BLE_IRK_SIZE]) {
BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
uint8_t* pp = (uint8_t*)(p + 1);
}
void btsnd_hcic_ble_rm_device_resolving_list(uint8_t addr_type_peer,
- BD_ADDR bda_peer) {
+ const RawAddress& bda_peer) {
BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
uint8_t* pp = (uint8_t*)(p + 1);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
-void btsnd_hcic_ble_set_privacy_mode(uint8_t addr_type_peer, BD_ADDR bda_peer,
+void btsnd_hcic_ble_set_privacy_mode(uint8_t addr_type_peer,
+ const RawAddress& bda_peer,
uint8_t privacy_type) {
BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
uint8_t* pp = (uint8_t*)(p + 1);
}
void btsnd_hcic_ble_read_resolvable_addr_peer(uint8_t addr_type_peer,
- BD_ADDR bda_peer) {
+ const RawAddress& bda_peer) {
BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
uint8_t* pp = (uint8_t*)(p + 1);
}
void btsnd_hcic_ble_read_resolvable_addr_local(uint8_t addr_type_peer,
- BD_ADDR bda_peer) {
+ const RawAddress& bda_peer) {
BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
uint8_t* pp = (uint8_t*)(p + 1);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
+void btsnd_hcic_ble_enh_rx_test(uint8_t rx_chan, uint8_t phy,
+ uint8_t mod_index) {
+ BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
+ uint8_t* pp = (uint8_t*)(p + 1);
+
+ p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_ENH_RX_TEST;
+ p->offset = 0;
+
+ UINT16_TO_STREAM(pp, HCI_BLE_ENH_RECEIVER_TEST);
+ UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_BLE_ENH_RX_TEST);
+
+ UINT8_TO_STREAM(pp, rx_chan);
+ UINT8_TO_STREAM(pp, phy);
+ UINT8_TO_STREAM(pp, mod_index);
+
+ btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
+}
+
+void btsnd_hcic_ble_enh_tx_test(uint8_t tx_chan, uint8_t data_len,
+ uint8_t payload, uint8_t phy) {
+ BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
+ uint8_t* pp = (uint8_t*)(p + 1);
+
+ p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_ENH_TX_TEST;
+ p->offset = 0;
+
+ UINT16_TO_STREAM(pp, HCI_BLE_ENH_TRANSMITTER_TEST);
+ UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_BLE_ENH_TX_TEST);
+ UINT8_TO_STREAM(pp, tx_chan);
+ UINT8_TO_STREAM(pp, data_len);
+ UINT8_TO_STREAM(pp, payload);
+ UINT8_TO_STREAM(pp, phy);
+
+ btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
+}
+
void btsnd_hcic_ble_set_extended_scan_params(uint8_t own_address_type,
uint8_t scanning_filter_policy,
uint8_t scanning_phys,
void btsnd_hcic_ble_ext_create_conn(uint8_t init_filter_policy,
uint8_t addr_type_own,
- uint8_t addr_type_peer, BD_ADDR bda_peer,
+ uint8_t addr_type_peer,
+ const RawAddress& bda_peer,
uint8_t initiating_phys,
EXT_CONN_PHY_CFG* phy_cfg) {
BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);