OSDN Git Service

Add stack/include/btm_api_types::io_capabilities_text
authorChris Manton <cmanton@google.com>
Fri, 6 Nov 2020 17:09:01 +0000 (09:09 -0800)
committerChris Manton <cmanton@google.com>
Wed, 20 Jan 2021 16:05:28 +0000 (08:05 -0800)
Towards loggable code

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

Change-Id: I43b8a393929b9d6da042e991c08a9bfac22c557a

stack/include/btm_api_types.h

index 1f4b878..f639729 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef BTM_API_TYPES_H
 #define BTM_API_TYPES_H
 
+#include <base/strings/stringprintf.h>
 #include <cstdint>
 #include <string>
 
@@ -620,6 +621,23 @@ enum : uint8_t {
 };
 typedef uint8_t tBTM_IO_CAP;
 
+inline std::string io_capabilities_text(const tBTM_IO_CAP& io_caps) {
+  switch (io_caps) {
+    case BTM_IO_CAP_OUT:
+      return std::string("Display only");
+    case BTM_IO_CAP_IO:
+      return std::string("Display yes-no");
+    case BTM_IO_CAP_IN:
+      return std::string("Keyboard Only");
+    case BTM_IO_CAP_NONE:
+      return std::string("No input or output");
+    case BTM_IO_CAP_KBDISP:
+      return std::string("Keyboard-Display");
+    default:
+      return base::StringPrintf("UNKNOWN[%hhu]", io_caps);
+  }
+}
+
 #define BTM_MAX_PASSKEY_VAL (999999)
 
 typedef enum : uint8_t {