OSDN Git Service

Use common API to set hci handle
authorChris Manton <cmanton@google.com>
Tue, 22 Sep 2020 17:40:21 +0000 (10:40 -0700)
committerChris Manton <cmanton@google.com>
Thu, 8 Oct 2020 06:08:07 +0000 (06:08 +0000)
Towards readable code

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Id30ad44e8084effd204f168cf3983da8ab31e064

stack/l2cap/l2c_ble.cc
stack/l2cap/l2c_int.h
stack/l2cap/l2c_link.cc

index bd19cc0..ee2349a 100644 (file)
@@ -296,7 +296,7 @@ void l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda,
   if (role == HCI_ROLE_MASTER) alarm_cancel(p_lcb->l2c_lcb_timer);
 
   /* Save the handle */
-  p_lcb->SetHandle(handle);
+  l2cu_set_lcb_handle(*p_lcb, handle);
 
   /* Connected OK. Change state to connected, we were scanning so we are master
    */
index 80f3a8a..7bc3b53 100644 (file)
@@ -336,12 +336,6 @@ typedef struct t_l2c_linkcb {
   alarm_t* l2c_lcb_timer; /* Timer entry for timeout evt */
  private:
   uint16_t handle_; /* The handle used with LM */
-  friend void l2cble_conn_comp(uint16_t handle, uint8_t role,
-                               const RawAddress& bda, tBLE_ADDR_TYPE type,
-                               uint16_t conn_interval, uint16_t conn_latency,
-                               uint16_t conn_timeout);
-  friend void l2c_link_hci_conn_comp(uint8_t status, uint16_t handle,
-                                     const RawAddress& p_bda);
   friend void l2cu_set_lcb_handle(struct t_l2c_linkcb& p_lcb, uint16_t handle);
   void SetHandle(uint16_t handle) { handle_ = handle; }
 
index 0346817..04c61b5 100644 (file)
@@ -163,7 +163,7 @@ void l2c_link_hci_conn_comp(uint8_t status, uint16_t handle,
   }
 
   /* Save the handle */
-  p_lcb->SetHandle(handle);
+  l2cu_set_lcb_handle(*p_lcb, handle);
 
   if (ci.status == HCI_SUCCESS) {
     /* Connected OK. Change state to connected */