OSDN Git Service

Add and Use stack//btm_acl::internal::set_default_packet_types_supported
authorChris Manton <cmanton@google.com>
Sat, 9 Jan 2021 22:14:52 +0000 (14:14 -0800)
committerChris Manton <cmanton@google.com>
Wed, 20 Jan 2021 02:54:12 +0000 (18:54 -0800)
Towards encapsulated code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run
Change-Id: Iab53674505ab691565b7b83a282aa28c76454614

stack/acl/acl.h
stack/acl/btm_acl.cc

index 5d0faa1..f6bc965 100644 (file)
@@ -388,7 +388,6 @@ struct sACL_CB {
   friend uint16_t acl_get_supported_packet_types();
   friend uint8_t btm_handle_to_acl_index(uint16_t hci_handle);
   friend void BTM_SetDefaultLinkSuperTout(uint16_t timeout);
-  friend void BTM_acl_after_controller_started(const controller_t* controller);
   friend void BTM_default_block_role_switch();
   friend void BTM_default_unblock_role_switch();
   friend void acl_initialize_power_mode(const tACL_CONN& p_acl);
index ff9ec3b..c691f57 100644 (file)
@@ -69,6 +69,8 @@ void gatt_find_in_device_record(const RawAddress& bd_addr,
 void l2c_link_hci_conn_comp(uint8_t status, uint16_t handle,
                             const RawAddress& p_bda);
 
+extern tBTM_CB btm_cb;
+
 struct StackAclBtmAcl {
   tACL_CONN* acl_allocate_connection();
   tACL_CONN* acl_get_connection_from_handle(uint16_t handle);
@@ -80,6 +82,9 @@ struct StackAclBtmAcl {
   void btm_acl_role_changed(tHCI_STATUS hci_status, const RawAddress& bd_addr,
                             uint8_t new_role);
   void hci_start_role_switch_to_central(tACL_CONN& p_acl);
+  void set_default_packet_types_supported(uint16_t packet_types_supported) {
+    btm_cb.acl_cb_.btm_acl_pkt_types_supported = packet_types_supported;
+  }
 };
 
 namespace {
@@ -117,8 +122,6 @@ inline bool IsEprAvailable(const tACL_CONN& p_acl) {
          controller_get_interface()->supports_encryption_pause();
 }
 
-extern tBTM_CB btm_cb;
-
 static bool acl_is_role_central(const RawAddress& bda, tBT_TRANSPORT transport);
 static void btm_acl_chk_peer_pkt_type_support(tACL_CONN* p,
                                               uint16_t* p_pkt_type);
@@ -258,7 +261,7 @@ void BTM_acl_after_controller_started(const controller_t* controller) {
       btm_acl_pkt_types_supported |=
           (HCI_PKT_TYPES_MASK_NO_2_DH5 + HCI_PKT_TYPES_MASK_NO_3_DH5);
   }
-  btm_cb.acl_cb_.btm_acl_pkt_types_supported = btm_acl_pkt_types_supported;
+  internal_.set_default_packet_types_supported(btm_acl_pkt_types_supported);
 }
 
 /*******************************************************************************