OSDN Git Service

Add stack/include/hcidefs::hci_mode_text
authorChris Manton <cmanton@google.com>
Sat, 19 Dec 2020 01:59:54 +0000 (17:59 -0800)
committerChris Manton <cmanton@google.com>
Thu, 7 Jan 2021 20:12:37 +0000 (12:12 -0800)
Towards loggable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run --host

Change-Id: I3ad073e4db75aad362c02e0e96d768ba40bb8452

stack/include/hcidefs.h

index 100ac70..51a1750 100644 (file)
@@ -721,6 +721,21 @@ typedef enum : uint8_t {
   HCI_MODE_PARK = 0x03,
 } tHCI_MODE;
 
+inline std::string hci_mode_text(const tHCI_MODE& mode) {
+  switch (mode) {
+    case HCI_MODE_ACTIVE:
+      return std::string("active");
+    case HCI_MODE_HOLD:
+      return std::string("hold");
+    case HCI_MODE_SNIFF:
+      return std::string("sniff");
+    case HCI_MODE_PARK:
+      return std::string("park");
+    default:
+      return std::string("UNKNOWN");
+  }
+}
+
 /* Page scan period modes */
 #define HCI_PAGE_SCAN_REP_MODE_R1 0x01