Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(858)

Side by Side Diff: components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc

Issue 2063353002: device/bluetooth: split out transport enum (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing new use in components/arc/bluetooth Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ble/bluetooth_low_energy_connection_finder.h " 5 #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h "
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
18 #include "components/proximity_auth/ble/bluetooth_low_energy_connection.h" 18 #include "components/proximity_auth/ble/bluetooth_low_energy_connection.h"
19 #include "components/proximity_auth/ble/bluetooth_low_energy_device_whitelist.h" 19 #include "components/proximity_auth/ble/bluetooth_low_energy_device_whitelist.h"
20 #include "components/proximity_auth/logging/logging.h" 20 #include "components/proximity_auth/logging/logging.h"
21 #include "device/bluetooth/bluetooth_adapter_factory.h" 21 #include "device/bluetooth/bluetooth_adapter_factory.h"
22 #include "device/bluetooth/bluetooth_common.h"
22 #include "device/bluetooth/bluetooth_device.h" 23 #include "device/bluetooth/bluetooth_device.h"
23 #include "device/bluetooth/bluetooth_discovery_session.h" 24 #include "device/bluetooth/bluetooth_discovery_session.h"
24 #include "device/bluetooth/bluetooth_uuid.h" 25 #include "device/bluetooth/bluetooth_uuid.h"
25 26
26 using device::BluetoothAdapter; 27 using device::BluetoothAdapter;
27 using device::BluetoothDevice; 28 using device::BluetoothDevice;
28 using device::BluetoothGattConnection; 29 using device::BluetoothGattConnection;
29 using device::BluetoothDiscoveryFilter; 30 using device::BluetoothDiscoveryFilter;
30 31
31 namespace proximity_auth { 32 namespace proximity_auth {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 221 }
221 222
222 void BluetoothLowEnergyConnectionFinder::StartDiscoverySession() { 223 void BluetoothLowEnergyConnectionFinder::StartDiscoverySession() {
223 DCHECK(adapter_); 224 DCHECK(adapter_);
224 if (discovery_session_ && discovery_session_->IsActive()) { 225 if (discovery_session_ && discovery_session_->IsActive()) {
225 PA_LOG(INFO) << "Discovery session already active"; 226 PA_LOG(INFO) << "Discovery session already active";
226 return; 227 return;
227 } 228 }
228 229
229 // Discover only low energy (LE) devices with strong enough signal. 230 // Discover only low energy (LE) devices with strong enough signal.
230 std::unique_ptr<BluetoothDiscoveryFilter> filter(new BluetoothDiscoveryFilter( 231 std::unique_ptr<BluetoothDiscoveryFilter> filter(
231 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE)); 232 new BluetoothDiscoveryFilter(device::BLUETOOTH_TRANSPORT_LE));
232 filter->SetRSSI(kMinDiscoveryRSSI); 233 filter->SetRSSI(kMinDiscoveryRSSI);
233 234
234 adapter_->StartDiscoverySessionWithFilter( 235 adapter_->StartDiscoverySessionWithFilter(
235 std::move(filter), 236 std::move(filter),
236 base::Bind(&BluetoothLowEnergyConnectionFinder::OnDiscoverySessionStarted, 237 base::Bind(&BluetoothLowEnergyConnectionFinder::OnDiscoverySessionStarted,
237 weak_ptr_factory_.GetWeakPtr()), 238 weak_ptr_factory_.GetWeakPtr()),
238 base::Bind( 239 base::Bind(
239 &BluetoothLowEnergyConnectionFinder::OnStartDiscoverySessionError, 240 &BluetoothLowEnergyConnectionFinder::OnStartDiscoverySessionError,
240 weak_ptr_factory_.GetWeakPtr())); 241 weak_ptr_factory_.GetWeakPtr()));
241 } 242 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 return device; 311 return device;
311 } 312 }
312 return nullptr; 313 return nullptr;
313 } 314 }
314 315
315 void BluetoothLowEnergyConnectionFinder::InvokeCallbackAsync() { 316 void BluetoothLowEnergyConnectionFinder::InvokeCallbackAsync() {
316 connection_callback_.Run(std::move(connection_)); 317 connection_callback_.Run(std::move(connection_));
317 } 318 }
318 319
319 } // namespace proximity_auth 320 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/arc/bluetooth/arc_bluetooth_bridge.cc ('k') | content/browser/bluetooth/bluetooth_device_chooser_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698