From b2a6552fbecab26a5f58aaca6a32c0418ffd3383 Mon Sep 17 00:00:00 2001 From: Chris Manton Date: Fri, 18 Dec 2020 17:59:54 -0800 Subject: [PATCH] Add stack/include/hcidefs::hci_mode_text Towards loggable code Bug: 163134718 Tag: #refactor Test: gd/cert/run --host Change-Id: I3ad073e4db75aad362c02e0e96d768ba40bb8452 --- stack/include/hcidefs.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/stack/include/hcidefs.h b/stack/include/hcidefs.h index 100ac7039..51a175083 100644 --- a/stack/include/hcidefs.h +++ b/stack/include/hcidefs.h @@ -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 -- 2.11.0