From: Chris Manton Date: Wed, 2 Sep 2020 04:45:37 +0000 (-0700) Subject: Update main/shim/::ble_addr_type X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=0f6f6e0b10ef952f1ce773a048feda228e616238;p=android-x86%2Fsystem-bt.git Update main/shim/::ble_addr_type Using strict types tBLE_ADDR_TYPE Towards readable code Bug: 163134718 Tag: #refactor Test: compile & verify basic functions working Change-Id: Ieb3b5a50f12317b926a96d6886f431686ef2d37d --- diff --git a/main/shim/btif_dm.cc b/main/shim/btif_dm.cc index 1c94360af..fd1f4e857 100644 --- a/main/shim/btif_dm.cc +++ b/main/shim/btif_dm.cc @@ -152,8 +152,8 @@ void BTIF_RegisterBondStateChangeListener( void BTIF_DM_ssp_reply(const RawAddress bd_addr, uint8_t addr_type, bt_ssp_variant_t variant, uint8_t accept) { // TODO: GD expects to receive correct address type. // pass addr_type once it's properly set in btif layer - hci::AddressWithType address = ToAddressWithType(bd_addr, 0); - hci::AddressWithType address2 = ToAddressWithType(bd_addr, 1); + hci::AddressWithType address = ToAddressWithType(bd_addr, BLE_ADDR_PUBLIC); + hci::AddressWithType address2 = ToAddressWithType(bd_addr, BLE_ADDR_RANDOM); auto security_manager = bluetooth::shim::GetSecurityModule()->GetSecurityManager(); if (variant == BT_SSP_VARIANT_PASSKEY_CONFIRMATION) { @@ -182,8 +182,8 @@ void BTIF_DM_ssp_reply(const RawAddress bd_addr, uint8_t addr_type, bt_ssp_varia void BTIF_DM_pin_reply(const RawAddress bd_addr, uint8_t addr_type, uint8_t accept, uint8_t pin_len, bt_pin_code_t pin_code) { // TODO: GD expects to receive correct address type. // pass addr_type once it's properly set in btif layer - hci::AddressWithType address = ToAddressWithType(bd_addr, 0); - hci::AddressWithType address2 = ToAddressWithType(bd_addr, 1); + hci::AddressWithType address = ToAddressWithType(bd_addr, BLE_ADDR_PUBLIC); + hci::AddressWithType address2 = ToAddressWithType(bd_addr, BLE_ADDR_RANDOM); auto security_manager = bluetooth::shim::GetSecurityModule()->GetSecurityManager(); if (!accept) { diff --git a/main/shim/btm.cc b/main/shim/btm.cc index b30095679..d56ef9512 100644 --- a/main/shim/btm.cc +++ b/main/shim/btm.cc @@ -58,7 +58,7 @@ using BtmRemoteDeviceName = tBTM_REMOTE_DEV_NAME; extern void btm_process_cancel_complete(uint8_t status, uint8_t mode); extern void btm_process_inq_complete(uint8_t status, uint8_t result_type); extern void btm_ble_process_adv_addr(RawAddress& raw_address, - uint8_t* address_type); + tBLE_ADDR_TYPE* address_type); extern void btm_ble_process_adv_pkt_cont( uint16_t event_type, uint8_t address_type, const RawAddress& raw_address, uint8_t primary_phy, uint8_t secondary_phy, uint8_t advertising_sid, @@ -153,7 +153,8 @@ static void store_le_address_type(RawAddress address, tBLE_ADDR_TYPE type) { void Btm::ScanningCallbacks::on_advertisements( std::vector> reports) { for (auto le_report : reports) { - uint8_t address_type = static_cast(le_report->address_type_); + tBLE_ADDR_TYPE address_type = + static_cast(le_report->address_type_); uint16_t extended_event_type = 0; uint8_t* report_data = nullptr; size_t report_len = 0; diff --git a/main/shim/l2c_api.cc b/main/shim/l2c_api.cc index 7b96714ea..37193299a 100644 --- a/main/shim/l2c_api.cc +++ b/main/shim/l2c_api.cc @@ -275,7 +275,7 @@ struct LeFixedChannelHelper { (freg_.pL2CA_FixedConn_Cb)(cid_, address, true, 0, BT_TRANSPORT_LE); bluetooth::shim::Btm::StoreAddressType( - address, static_cast(device.GetAddressType())); + address, static_cast(device.GetAddressType())); } void on_incoming_data(bluetooth::hci::AddressWithType remote) {