OSDN Git Service

enum-ify _CONNECTABLE both classic and ble
authorChris Manton <cmanton@google.com>
Sun, 20 Sep 2020 05:50:58 +0000 (22:50 -0700)
committerChris Manton <cmanton@google.com>
Fri, 2 Oct 2020 19:47:58 +0000 (19:47 +0000)
Towards readable code

Bug: 163134718
Tag: #refactor
Test: act.py -tc BleCocTest
Change-Id: If152037d43646197b456dfe6174bb897f4911c3a

stack/btm/neighbor_inquiry.h

index fe89ad2..e21dab6 100644 (file)
@@ -39,14 +39,16 @@ enum : uint16_t {
 };
 
 /* Connectable modes */
-#define BTM_NON_CONNECTABLE 0
-#define BTM_CONNECTABLE 1
-#define BTM_CONNECTABLE_MASK (BTM_NON_CONNECTABLE | BTM_CONNECTABLE)
-/* high byte for BLE Connectable modes */
-#define BTM_BLE_NON_CONNECTABLE 0x0000
-#define BTM_BLE_CONNECTABLE 0x0100
-#define BTM_BLE_MAX_CONNECTABLE BTM_BLE_CONNECTABLE
-#define BTM_BLE_CONNECTABLE_MASK (BTM_BLE_NON_CONNECTABLE | BTM_BLE_CONNECTABLE)
+enum : uint16_t {
+  BTM_NON_CONNECTABLE = 0,
+  BTM_CONNECTABLE = (1 << 0),
+  BTM_CONNECTABLE_MASK = (BTM_NON_CONNECTABLE | BTM_CONNECTABLE),
+  /* high byte for BLE Connectable modes */
+  BTM_BLE_NON_CONNECTABLE = BTM_NON_CONNECTABLE,
+  BTM_BLE_CONNECTABLE = 0x0100,
+  BTM_BLE_MAX_CONNECTABLE = BTM_BLE_CONNECTABLE,
+  BTM_BLE_CONNECTABLE_MASK = (BTM_BLE_NON_CONNECTABLE | BTM_BLE_CONNECTABLE),
+};
 
 /* Inquiry modes
  * Note: These modes are associated with the inquiry active values (BTM_*ACTIVE)