OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/proximity_auth/bluetooth_low_energy_setup_connection_finder
.h" | 5 #include "components/proximity_auth/bluetooth_low_energy_setup_connection_finder
.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.
h" | 10 #include "components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.
h" |
11 #include "components/cryptauth/bluetooth_throttler.h" | 11 #include "components/cryptauth/bluetooth_throttler.h" |
12 #include "components/cryptauth/connection.h" | 12 #include "components/cryptauth/connection.h" |
13 #include "components/proximity_auth/logging/logging.h" | 13 #include "components/proximity_auth/logging/logging.h" |
14 #include "device/bluetooth/bluetooth_device.h" | 14 #include "device/bluetooth/bluetooth_device.h" |
15 #include "device/bluetooth/bluetooth_uuid.h" | 15 #include "device/bluetooth/bluetooth_uuid.h" |
16 | 16 |
17 using device::BluetoothDevice; | 17 using device::BluetoothDevice; |
18 | 18 |
19 namespace proximity_auth { | 19 namespace proximity_auth { |
20 | 20 |
21 BluetoothLowEnergySetupConnectionFinder:: | 21 BluetoothLowEnergySetupConnectionFinder:: |
22 BluetoothLowEnergySetupConnectionFinder( | 22 BluetoothLowEnergySetupConnectionFinder( |
23 const std::string& remote_service_uuid, | 23 const std::string& remote_service_uuid, |
24 cryptauth::BluetoothThrottler* bluetooth_throttler) | 24 cryptauth::BluetoothThrottler* bluetooth_throttler) |
25 : BluetoothLowEnergyConnectionFinder( | 25 : BluetoothLowEnergyConnectionFinder( |
26 cryptauth::RemoteDevice(), | 26 cryptauth::RemoteDevice(), |
27 remote_service_uuid, | 27 remote_service_uuid, |
| 28 std::vector<cryptauth::BeaconSeed>(), |
28 base::MakeUnique<cryptauth::BackgroundEidGenerator>(), | 29 base::MakeUnique<cryptauth::BackgroundEidGenerator>(), |
29 bluetooth_throttler), | 30 bluetooth_throttler), |
30 remote_service_uuid_(device::BluetoothUUID(remote_service_uuid)) {} | 31 remote_service_uuid_(device::BluetoothUUID(remote_service_uuid)) {} |
31 | 32 |
32 bool BluetoothLowEnergySetupConnectionFinder::IsRightDevice( | 33 bool BluetoothLowEnergySetupConnectionFinder::IsRightDevice( |
33 BluetoothDevice* device) { | 34 BluetoothDevice* device) { |
34 if (!device) | 35 if (!device) |
35 return false; | 36 return false; |
36 | 37 |
37 BluetoothDevice::UUIDSet uuids = device->GetUUIDs(); | 38 BluetoothDevice::UUIDSet uuids = device->GetUUIDs(); |
38 PA_LOG(INFO) << "Device " << device->GetAddress() << " has " << uuids.size() | 39 PA_LOG(INFO) << "Device " << device->GetAddress() << " has " << uuids.size() |
39 << " services."; | 40 << " services."; |
40 return base::ContainsKey(uuids, remote_service_uuid_); | 41 return base::ContainsKey(uuids, remote_service_uuid_); |
41 } | 42 } |
42 | 43 |
43 } // namespace proximity_auth | 44 } // namespace proximity_auth |
OLD | NEW |