// TODO(zachoverflow): Eww...we need to move these out. These are peer specific,
// not config general.
-bool btif_get_address_type(const RawAddress& bd_addr, int* p_addr_type);
+bool btif_get_address_type(const RawAddress& bd_addr,
+ tBLE_ADDR_TYPE* p_addr_type);
bool btif_get_device_type(const RawAddress& bd_addr, int* p_device_type);
void btif_debug_config_dump(int fd);
Octet16* key_value);
bt_status_t btif_storage_get_remote_addr_type(const RawAddress* remote_bd_addr,
- int* addr_type);
+ tBLE_ADDR_TYPE* addr_type);
bt_status_t btif_storage_set_remote_addr_type(const RawAddress* remote_bd_addr,
- uint8_t addr_type);
+ tBLE_ADDR_TYPE addr_type);
/*******************************************************************************
* Function btif_storage_load_hidd
}
void bta_scan_results_cb_impl(RawAddress bd_addr, tBT_DEVICE_TYPE device_type,
- int8_t rssi, uint8_t addr_type,
+ int8_t rssi, tBLE_ADDR_TYPE addr_type,
uint16_t ble_evt_type, uint8_t ble_primary_phy,
uint8_t ble_secondary_phy,
uint8_t ble_advertising_sid, int8_t ble_tx_power,
int addr_type, int discard_rule, Callback cb) override {
do_in_main_thread(
FROM_HERE, base::Bind(&BTM_BleEnableBatchScan, scan_mode, scan_interval,
- scan_window, discard_rule, addr_type,
+ scan_window, discard_rule,
+ static_cast<tBLE_ADDR_TYPE>(addr_type),
jni_thread_wrapper(FROM_HERE, cb)));
}
return true;
}
-bool btif_get_address_type(const RawAddress& bda, int* p_addr_type) {
+bool btif_get_address_type(const RawAddress& bda, tBLE_ADDR_TYPE* p_addr_type) {
if (p_addr_type == NULL) return false;
std::string addrstr = bda.ToString();
const char* bd_addr_str = addrstr.c_str();
- if (!btif_config_get_int(bd_addr_str, "AddrType", p_addr_type)) return false;
+ int val = 0;
+ if (!btif_config_get_int(bd_addr_str, "AddrType", &val)) return false;
+ *p_addr_type = static_cast<tBLE_ADDR_TYPE>(val);
LOG_DEBUG("%s: Device [%s] address type %d", __func__, bd_addr_str,
*p_addr_type);
bond_state_changed(BT_STATUS_SUCCESS, bd_addr, BT_BOND_STATE_BONDING);
int device_type = 0;
- int addr_type;
+ tBLE_ADDR_TYPE addr_type = BLE_ADDR_PUBLIC;
std::string addrstr = bd_addr.ToString();
const char* bdstr = addrstr.c_str();
if (transport == BT_TRANSPORT_LE) {
// Try to read address type. OOB pairing might have set it earlier, but
// didn't store it, it defaults to BLE_ADDR_PUBLIC
uint8_t tmp_dev_type;
- uint8_t tmp_addr_type;
+ tBLE_ADDR_TYPE tmp_addr_type = BLE_ADDR_PUBLIC;
BTM_ReadDevInfo(bd_addr, &tmp_dev_type, &tmp_addr_type);
addr_type = tmp_addr_type;
bt_device_type_t dev_type;
uint32_t num_properties = 0;
bt_status_t status;
- int addr_type = 0;
+ tBLE_ADDR_TYPE addr_type = BLE_ADDR_PUBLIC;
memset(properties, 0, sizeof(properties));
/* RawAddress */
// value.
if (memcmp(oob_data.le_bt_dev_addr, empty, 7) != 0) {
/* byte no 7 is address type in LE Bluetooth Address OOB data */
- uint8_t address_type = oob_data.le_bt_dev_addr[6];
+ tBLE_ADDR_TYPE address_type =
+ static_cast<tBLE_ADDR_TYPE>(oob_data.le_bt_dev_addr[6]);
if (address_type == BLE_ADDR_PUBLIC || address_type == BLE_ADDR_RANDOM) {
// bd_addr->address is already reversed, so use it instead of
// oob_data->le_bt_dev_addr
if (bluetooth::shim::is_gd_shim_enabled()) {
uint8_t tmp_dev_type = 0;
- uint8_t tmp_addr_type = 0;
+ tBLE_ADDR_TYPE tmp_addr_type = BLE_ADDR_PUBLIC;
BTM_ReadDevInfo(bd_addr, &tmp_dev_type, &tmp_addr_type);
bluetooth::shim::BTIF_DM_pin_reply(bd_addr, tmp_addr_type, accept, pin_len,
void btif_dm_ssp_reply(const RawAddress bd_addr, bt_ssp_variant_t variant,
uint8_t accept) {
if (bluetooth::shim::is_gd_shim_enabled()) {
- uint8_t tmp_dev_type = 0;
- uint8_t tmp_addr_type = 0;
+ tBT_DEVICE_TYPE tmp_dev_type;
+ tBLE_ADDR_TYPE tmp_addr_type = BLE_ADDR_PUBLIC;
BTM_ReadDevInfo(bd_addr, &tmp_dev_type, &tmp_addr_type);
bluetooth::shim::BTIF_DM_ssp_reply(bd_addr, tmp_addr_type, variant, accept);
if (p_auth_cmpl->success) {
status = BT_STATUS_SUCCESS;
state = BT_BOND_STATE_BONDED;
- int addr_type;
+ tBLE_ADDR_TYPE addr_type;
RawAddress bdaddr = p_auth_cmpl->bd_addr;
if (btif_storage_get_remote_addr_type(&bdaddr, &addr_type) !=
BT_STATUS_SUCCESS)
int transport_p, bool opportunistic,
int initiating_phys) {
// Ensure device is in inquiry database
- int addr_type = 0;
+ tBLE_ADDR_TYPE addr_type = BLE_ADDR_PUBLIC;
int device_type = 0;
tBT_TRANSPORT transport = (tBT_TRANSPORT)BT_TRANSPORT_LE;
static void btif_gatts_open_impl(int server_if, const RawAddress& address,
bool is_direct, int transport_param) {
// Ensure device is in inquiry database
- int addr_type = 0;
+ tBLE_ADDR_TYPE addr_type = BLE_ADDR_PUBLIC;
int device_type = 0;
tBT_TRANSPORT transport = BT_TRANSPORT_LE;
if (params->u1 == BT_DEVICE_TYPE_BLE)
BTM_SecAddBleDevice(*params->bda1, NULL, BT_DEVICE_TYPE_BLE,
- params->u2);
+ static_cast<tBLE_ADDR_TYPE>(params->u2));
if (!GATT_Connect(test_cb.gatt_if, *params->bda1, true, BT_TRANSPORT_LE,
false)) {
flags |= BTSOCK_FLAG_LE_COC;
// Ensure device is in inquiry database
- int addr_type = 0;
+ tBLE_ADDR_TYPE addr_type = BLE_ADDR_PUBLIC;
int device_type = 0;
if (btif_get_address_type(*bd_addr, &addr_type) &&
}
static void btif_read_le_key(const uint8_t key_type, const size_t key_len,
- RawAddress bd_addr, const uint8_t addr_type,
+ RawAddress bd_addr, const tBLE_ADDR_TYPE addr_type,
const bool add_key, bool* device_added,
bool* key_found) {
CHECK(device_added);
const std::string& remote_bd_addr, int add,
btif_bonded_devices_t* p_bonded_devices) {
int device_type;
- int addr_type;
+ tBLE_ADDR_TYPE addr_type;
bool device_added = false;
bool key_found = false;
}
bt_status_t btif_storage_set_remote_addr_type(const RawAddress* remote_bd_addr,
- uint8_t addr_type) {
+ tBLE_ADDR_TYPE addr_type) {
int ret = btif_config_set_int(remote_bd_addr->ToString(), "AddrType",
(int)addr_type);
return ret ? BT_STATUS_SUCCESS : BT_STATUS_FAIL;
*
******************************************************************************/
bt_status_t btif_storage_get_remote_addr_type(const RawAddress* remote_bd_addr,
- int* addr_type) {
- int ret =
- btif_config_get_int(remote_bd_addr->ToString(), "AddrType", addr_type);
+ tBLE_ADDR_TYPE* addr_type) {
+ int val;
+ int ret = btif_config_get_int(remote_bd_addr->ToString(), "AddrType", &val);
+ *addr_type = static_cast<tBLE_ADDR_TYPE>(val);
return ret ? BT_STATUS_SUCCESS : BT_STATUS_FAIL;
}
/*******************************************************************************