OSDN Git Service

Re-log stack/l2cap/l2c_ble::l2cble_conn_comp
authorChris Manton <cmanton@google.com>
Mon, 21 Sep 2020 20:57:11 +0000 (13:57 -0700)
committerChris Manton <cmanton@google.com>
Tue, 6 Oct 2020 06:05:20 +0000 (06:05 +0000)
Towards loggable code

Bug: 163134718
Tag: #refactor
Test: act.py -tc BleCocTest
Test: ble paired 2 phones
Test: classic paired Bose SoundLink
Change-Id: I6dfd621e83868b36fdb1ac16825db8176600adb9

stack/l2cap/l2c_ble.cc

index 4e69d9b..b4b0fc6 100644 (file)
@@ -272,11 +272,6 @@ void l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda,
   // role == HCI_ROLE_MASTER => scanner completed connection
   // role == HCI_ROLE_SLAVE => advertiser completed connection
 
-  L2CAP_TRACE_DEBUG(
-      "%s: HANDLE=%d addr_type=%d conn_interval=%d "
-      "slave_latency=%d supervision_tout=%d",
-      __func__, handle, type, conn_interval, conn_latency, conn_timeout);
-
   /* See if we have a link control block for the remote device */
   tL2C_LCB* p_lcb = l2cu_find_lcb_by_bd_addr(bda, BT_TRANSPORT_LE);
 
@@ -285,18 +280,19 @@ void l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda,
     p_lcb = l2cu_allocate_lcb(bda, false, BT_TRANSPORT_LE);
     if (!p_lcb) {
       btm_sec_disconnect(handle, HCI_ERR_NO_CONNECTION);
-      LOG(ERROR) << __func__ << "failed to allocate LCB";
+      LOG_ERROR("Unable to allocate link resource for le acl connection");
       return;
     } else {
       if (!l2cu_initialize_fixed_ccb(p_lcb, L2CAP_ATT_CID)) {
         btm_sec_disconnect(handle, HCI_ERR_NO_CONNECTION);
-        LOG(WARNING) << __func__ << "LCB but no CCB";
+        LOG_ERROR("Unable to allocate channel resource for le acl connection");
         return;
       }
     }
   } else if (role == HCI_ROLE_MASTER && p_lcb->link_state != LST_CONNECTING) {
-    LOG(ERROR) << "L2CAP got BLE scanner conn_comp in bad state: "
-               << +p_lcb->link_state;
+    LOG_ERROR(
+        "Received le acl connection as role master but not in connecting "
+        "state");
     return;
   }