OSDN Git Service

enum-ify stack/include/::BT_DEVICE_TYPE_
authorChris Manton <cmanton@google.com>
Thu, 17 Sep 2020 21:51:17 +0000 (14:51 -0700)
committerChris Manton <cmanton@google.com>
Sat, 19 Sep 2020 19:49:45 +0000 (19:49 +0000)
Towards readable code

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I58b0524279c97c98db08d299b41d6d9bf3fe7a83

stack/include/bt_types.h

index 27b8082..c8958e2 100644 (file)
@@ -801,9 +801,11 @@ struct tBLE_BD_ADDR {
 
 /* Device Types
  */
-#define BT_DEVICE_TYPE_BREDR 0x01
-#define BT_DEVICE_TYPE_BLE 0x02
-#define BT_DEVICE_TYPE_DUMO 0x03
+enum : uint8_t {
+  BT_DEVICE_TYPE_BREDR = (1 << 0),
+  BT_DEVICE_TYPE_BLE = (1 << 1),
+  BT_DEVICE_TYPE_DUMO = BT_DEVICE_TYPE_BREDR | BT_DEVICE_TYPE_BLE,
+};
 typedef uint8_t tBT_DEVICE_TYPE;
 #ifdef __cplusplus
 inline std::string DeviceTypeText(tBT_DEVICE_TYPE type) {