OSDN Git Service

Add hci role text
authorChris Manton <cmanton@google.com>
Mon, 21 Sep 2020 20:55:50 +0000 (13:55 -0700)
committerChris Manton <cmanton@google.com>
Wed, 23 Sep 2020 04:01:26 +0000 (04:01 +0000)
Towards loggable code

Bug: 163134718
Tag: #refactor
Test: acts -tc BleCocTest
Test: ble paired 2 phones
Change-Id: I713403023a53905821e39ad9a8251bab9a8779ca

stack/include/hcidefs.h

index 69e517a..f283d17 100644 (file)
@@ -848,6 +848,16 @@ enum : uint8_t {
   HCI_ROLE_UNKNOWN = 0xff,
 };
 typedef uint8_t hci_role_t;
+inline std::string RoleText(hci_role_t role) {
+  switch (role) {
+    case HCI_ROLE_MASTER:
+      return std::string("master");
+    case HCI_ROLE_SLAVE:
+      return std::string("slave");
+    default:
+      return std::string("unknown");
+  }
+}
 
 /* HCI mode defenitions */
 #define HCI_MODE_ACTIVE 0x00