OSDN Git Service

Add btif/src/btif_gatt_client::bta_gattc_event_text
authorChris Manton <cmanton@google.com>
Wed, 11 Nov 2020 22:03:43 +0000 (14:03 -0800)
committerChris Manton <cmanton@google.com>
Thu, 12 Nov 2020 17:14:04 +0000 (09:14 -0800)
Toward loggable code

Bug: 163134718
Tag: #refactor
Test: CtsVerifier

Change-Id: I041492f74c5e0d91f1b8f45370c263bcd8f5b343

btif/src/btif_gatt_client.cc

index 3737259..f7c4a82 100644 (file)
@@ -91,8 +91,47 @@ namespace {
 
 uint8_t rssi_request_client_if;
 
+std::string bta_gattc_event_text(const tBTA_GATTC_EVT& event) {
+  switch (event) {
+    case BTA_GATTC_DEREG_EVT:
+      return std::string("GATT client deregistered");
+    case BTA_GATTC_OPEN_EVT:
+      return std::string("GATTC open request status");
+    case BTA_GATTC_CLOSE_EVT:
+      return std::string("GATTC close request status");
+    case BTA_GATTC_SEARCH_CMPL_EVT:
+      return std::string("GATT discovery complete");
+    case BTA_GATTC_SEARCH_RES_EVT:
+      return std::string("GATT discovery result");
+    case BTA_GATTC_SRVC_DISC_DONE_EVT:
+      return std::string("GATT service discovery done");
+    case BTA_GATTC_NOTIF_EVT:
+      return std::string("GATT attribute notification");
+    case BTA_GATTC_EXEC_EVT:
+      return std::string("execute write complete");
+    case BTA_GATTC_ACL_EVT:
+      return std::string("ACL up");
+    case BTA_GATTC_CANCEL_OPEN_EVT:
+      return std::string("cancel open");
+    case BTA_GATTC_SRVC_CHG_EVT:
+      return std::string("service change");
+    case BTA_GATTC_ENC_CMPL_CB_EVT:
+      return std::string("encryption complete callback");
+    case BTA_GATTC_CFG_MTU_EVT:
+      return std::string("configure MTU complete");
+    case BTA_GATTC_CONGEST_EVT:
+      return std::string("congestion");
+    case BTA_GATTC_PHY_UPDATE_EVT:
+      return std::string("PHY change");
+    case BTA_GATTC_CONN_UPDATE_EVT:
+      return std::string("connection parameters update");
+  }
+}
+
 void btif_gattc_upstreams_evt(uint16_t event, char* p_param) {
-  LOG_VERBOSE("%s: Event %d", __func__, event);
+  LOG_DEBUG("Event %s [%d]",
+            bta_gattc_event_text(static_cast<tBTA_GATTC_EVT>(event)).c_str(),
+            event);
 
   tBTA_GATTC* p_data = (tBTA_GATTC*)p_param;
   switch (event) {