| Index: components/proximity_auth/bluetooth_low_energy_setup_connection_finder.cc
|
| diff --git a/components/proximity_auth/bluetooth_low_energy_setup_connection_finder.cc b/components/proximity_auth/bluetooth_low_energy_setup_connection_finder.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..96617c5a077cc96f20f32e930f41a29724a8d74e
|
| --- /dev/null
|
| +++ b/components/proximity_auth/bluetooth_low_energy_setup_connection_finder.cc
|
| @@ -0,0 +1,44 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "components/proximity_auth/bluetooth_low_energy_setup_connection_finder.h"
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/memory/ptr_util.h"
|
| +#include "components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.h"
|
| +#include "components/cryptauth/bluetooth_throttler.h"
|
| +#include "components/cryptauth/connection.h"
|
| +#include "components/proximity_auth/logging/logging.h"
|
| +#include "device/bluetooth/bluetooth_device.h"
|
| +#include "device/bluetooth/bluetooth_uuid.h"
|
| +
|
| +using device::BluetoothDevice;
|
| +
|
| +namespace proximity_auth {
|
| +
|
| +BluetoothLowEnergySetupConnectionFinder::
|
| + BluetoothLowEnergySetupConnectionFinder(
|
| + const std::string& remote_service_uuid,
|
| + cryptauth::BluetoothThrottler* bluetooth_throttler)
|
| + : BluetoothLowEnergyConnectionFinder(
|
| + cryptauth::RemoteDevice(),
|
| + remote_service_uuid,
|
| + std::vector<cryptauth::BeaconSeed>(),
|
| + base::MakeUnique<cryptauth::BackgroundEidGenerator>(),
|
| + bluetooth_throttler),
|
| + remote_service_uuid_(device::BluetoothUUID(remote_service_uuid)) {}
|
| +
|
| +bool BluetoothLowEnergySetupConnectionFinder::IsRightDevice(
|
| + BluetoothDevice* device) {
|
| + if (!device)
|
| + return false;
|
| +
|
| + BluetoothDevice::UUIDSet uuids = device->GetUUIDs();
|
| + PA_LOG(INFO) << "Device " << device->GetAddress() << " has " << uuids.size()
|
| + << " services.";
|
| + return base::ContainsKey(uuids, remote_service_uuid_);
|
| +}
|
| +
|
| +} // namespace proximity_auth
|
|
|