OSDN Git Service

enum-ify tBTM_BLE_RL_STATE
authorChris Manton <cmanton@google.com>
Thu, 17 Sep 2020 21:28:57 +0000 (14:28 -0700)
committerChris Manton <cmanton@google.com>
Sat, 19 Sep 2020 19:43:03 +0000 (12:43 -0700)
Towards readable code

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

stack/btm/btm_ble_int_types.h

index a57ca18..86fa484 100644 (file)
@@ -160,10 +160,12 @@ constexpr uint8_t BTM_BLE_WL_IDLE = 0;
 constexpr uint8_t BTM_BLE_WL_INIT = 1;
 
 /* resolving list using state as a bit mask */
-#define BTM_BLE_RL_IDLE 0
-#define BTM_BLE_RL_INIT 1
-#define BTM_BLE_RL_SCAN 2
-#define BTM_BLE_RL_ADV 4
+enum : uint8_t {
+  BTM_BLE_RL_IDLE = 0,
+  BTM_BLE_RL_INIT = (1 << 0),
+  BTM_BLE_RL_SCAN = (1 << 1),
+  BTM_BLE_RL_ADV = (1 << 2),
+};
 typedef uint8_t tBTM_BLE_RL_STATE;
 
 typedef struct { void* p_param; } tBTM_BLE_CONN_REQ;