From 59726a54fd4c37aa9ba61bb820f0c290b48835f1 Mon Sep 17 00:00:00 2001 From: Chris Manton Date: Thu, 17 Sep 2020 16:20:40 -0700 Subject: [PATCH] Add stack/include/bt_types::DeviceTypeText Towards readable code Bug: 163134718 Tag: #refactor Test: compile & verify basic functions working Change-Id: I360800a8bc66902cefe926ca23d4158e43f726c5 --- stack/include/bt_types.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/stack/include/bt_types.h b/stack/include/bt_types.h index afc6f6e17..27b808254 100644 --- a/stack/include/bt_types.h +++ b/stack/include/bt_types.h @@ -21,6 +21,9 @@ #include #include +#ifdef __cplusplus +#include +#endif // __cplusplus #ifndef FALSE #define FALSE false @@ -802,6 +805,21 @@ struct tBLE_BD_ADDR { #define BT_DEVICE_TYPE_BLE 0x02 #define BT_DEVICE_TYPE_DUMO 0x03 typedef uint8_t tBT_DEVICE_TYPE; +#ifdef __cplusplus +inline std::string DeviceTypeText(tBT_DEVICE_TYPE type) { + switch (type) { + case BT_DEVICE_TYPE_BREDR: + return std::string("BR_EDR"); + case BT_DEVICE_TYPE_BLE: + return std::string("BLE"); + case BT_DEVICE_TYPE_DUMO: + return std::string("BR_EDR and BLE"); + default: + return std::string("Unknown"); + } +} +#endif // __cplusplus + /*****************************************************************************/ /* Define trace levels */ -- 2.11.0