OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/arc/bluetooth/arc_bluetooth_bridge.h" | 5 #include "components/arc/bluetooth/arc_bluetooth_bridge.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <iomanip> | 10 #include <iomanip> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/posix/eintr_wrapper.h" | 15 #include "base/posix/eintr_wrapper.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "components/arc/arc_bridge_service.h" | 20 #include "components/arc/arc_bridge_service.h" |
21 #include "components/arc/bluetooth/bluetooth_type_converters.h" | 21 #include "components/arc/bluetooth/bluetooth_type_converters.h" |
22 #include "device/bluetooth/bluetooth_adapter_factory.h" | 22 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 23 #include "device/bluetooth/bluetooth_common.h" |
23 #include "device/bluetooth/bluetooth_device.h" | 24 #include "device/bluetooth/bluetooth_device.h" |
24 #include "device/bluetooth/bluetooth_gatt_connection.h" | 25 #include "device/bluetooth/bluetooth_gatt_connection.h" |
25 #include "device/bluetooth/bluetooth_gatt_notify_session.h" | 26 #include "device/bluetooth/bluetooth_gatt_notify_session.h" |
26 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 27 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
27 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" | 28 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" |
28 #include "device/bluetooth/bluetooth_remote_gatt_service.h" | 29 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
29 | 30 |
30 using device::BluetoothAdapter; | 31 using device::BluetoothAdapter; |
31 using device::BluetoothAdapterFactory; | 32 using device::BluetoothAdapterFactory; |
32 using device::BluetoothAdvertisement; | 33 using device::BluetoothAdvertisement; |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 } | 512 } |
512 | 513 |
513 void ArcBluetoothBridge::StartLEScan() { | 514 void ArcBluetoothBridge::StartLEScan() { |
514 DCHECK(bluetooth_adapter_); | 515 DCHECK(bluetooth_adapter_); |
515 if (discovery_session_) { | 516 if (discovery_session_) { |
516 LOG(WARNING) << "Discovery session already running; leaving alone"; | 517 LOG(WARNING) << "Discovery session already running; leaving alone"; |
517 SendCachedDevicesFound(); | 518 SendCachedDevicesFound(); |
518 return; | 519 return; |
519 } | 520 } |
520 bluetooth_adapter_->StartDiscoverySessionWithFilter( | 521 bluetooth_adapter_->StartDiscoverySessionWithFilter( |
521 base::WrapUnique(new BluetoothDiscoveryFilter( | 522 base::WrapUnique( |
522 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE)), | 523 new BluetoothDiscoveryFilter(device::BLUETOOTH_TRANSPORT_LE)), |
523 base::Bind(&ArcBluetoothBridge::OnDiscoveryStarted, | 524 base::Bind(&ArcBluetoothBridge::OnDiscoveryStarted, |
524 weak_factory_.GetWeakPtr()), | 525 weak_factory_.GetWeakPtr()), |
525 base::Bind(&ArcBluetoothBridge::OnDiscoveryError, | 526 base::Bind(&ArcBluetoothBridge::OnDiscoveryError, |
526 weak_factory_.GetWeakPtr())); | 527 weak_factory_.GetWeakPtr())); |
527 } | 528 } |
528 | 529 |
529 void ArcBluetoothBridge::StopLEScan() { | 530 void ArcBluetoothBridge::StopLEScan() { |
530 CancelDiscovery(); | 531 CancelDiscovery(); |
531 } | 532 } |
532 | 533 |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 // to | 1312 // to |
1312 // make sure the bond state machine on Android is ready to take the | 1313 // make sure the bond state machine on Android is ready to take the |
1313 // pair-done event. Otherwise the pair-done event will be dropped as an | 1314 // pair-done event. Otherwise the pair-done event will be dropped as an |
1314 // invalid change of paired status. | 1315 // invalid change of paired status. |
1315 OnPairing(addr->Clone()); | 1316 OnPairing(addr->Clone()); |
1316 OnPairedDone(std::move(addr)); | 1317 OnPairedDone(std::move(addr)); |
1317 } | 1318 } |
1318 } | 1319 } |
1319 | 1320 |
1320 } // namespace arc | 1321 } // namespace arc |
OLD | NEW |