OSDN Git Service

Add stack/include/btm_api_types::security_mode_text
authorChris Manton <cmanton@google.com>
Sat, 17 Oct 2020 15:49:23 +0000 (08:49 -0700)
committerChris Manton <cmanton@google.com>
Fri, 29 Jan 2021 16:31:39 +0000 (08:31 -0800)
Towards loggable code

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

Change-Id: Ifbc618d55052ae6d090f2deb6d8f4de4e065fd85

stack/include/btm_api_types.h

index f639729..0604164 100644 (file)
@@ -471,6 +471,19 @@ typedef enum : uint8_t {
   BTM_SEC_MODE_SC = 6,
 } tSECURITY_MODE;
 
+inline std::string security_mode_text(const tSECURITY_MODE& security_mode) {
+  switch (security_mode) {
+    case BTM_SEC_MODE_SERVICE:
+      return std::string("service");
+    case BTM_SEC_MODE_SP:
+      return std::string("simple pairing");
+    case BTM_SEC_MODE_SC:
+      return std::string("secure connections only");
+    default:
+      return std::string("UNKNOWN[%hhu]", security_mode);
+  }
+}
+
 enum : uint16_t {
   /* Nothing required */
   BTM_SEC_NONE = 0x0000,