OSDN Git Service

Use local constant for service/low_energy_client
authorChris Manton <cmanton@google.com>
Fri, 28 Aug 2020 21:42:50 +0000 (14:42 -0700)
committerChris Manton <cmanton@google.com>
Fri, 28 Aug 2020 23:49:05 +0000 (16:49 -0700)
PHY_LE_1M_MASK

Towards readable code

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

service/low_energy_client.cc

index 3eece2a..de26de9 100644 (file)
@@ -27,6 +27,8 @@
 using std::lock_guard;
 using std::mutex;
 
+constexpr int kPhyLe1MbMask = 1;
+
 namespace bluetooth {
 
 // LowEnergyClient implementation
@@ -59,7 +61,7 @@ bool LowEnergyClient::Connect(const std::string& address, bool is_direct) {
 
   bt_status_t status =
       hal::BluetoothGattInterface::Get()->GetClientHALInterface()->connect(
-          client_id_, bda, is_direct, BT_TRANSPORT_LE, false, PHY_LE_1M_MASK);
+          client_id_, bda, is_direct, BT_TRANSPORT_LE, false, kPhyLe1MbMask);
   if (status != BT_STATUS_SUCCESS) {
     LOG(ERROR) << "HAL call to connect failed";
     return false;