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_common.h" |
24 #include "device/bluetooth/bluetooth_device.h" | 24 #include "device/bluetooth/bluetooth_device.h" |
25 #include "device/bluetooth/bluetooth_gatt_connection.h" | 25 #include "device/bluetooth/bluetooth_gatt_connection.h" |
26 #include "device/bluetooth/bluetooth_gatt_notify_session.h" | 26 #include "device/bluetooth/bluetooth_gatt_notify_session.h" |
27 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 27 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
28 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" | 28 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" |
29 #include "device/bluetooth/bluetooth_remote_gatt_service.h" | 29 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
30 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h" | |
30 | 31 |
31 using device::BluetoothAdapter; | 32 using device::BluetoothAdapter; |
32 using device::BluetoothAdapterFactory; | 33 using device::BluetoothAdapterFactory; |
33 using device::BluetoothAdvertisement; | 34 using device::BluetoothAdvertisement; |
34 using device::BluetoothDevice; | 35 using device::BluetoothDevice; |
35 using device::BluetoothDiscoveryFilter; | 36 using device::BluetoothDiscoveryFilter; |
36 using device::BluetoothDiscoverySession; | 37 using device::BluetoothDiscoverySession; |
37 using device::BluetoothGattConnection; | 38 using device::BluetoothGattConnection; |
38 using device::BluetoothGattNotifySession; | 39 using device::BluetoothGattNotifySession; |
39 using device::BluetoothGattCharacteristic; | 40 using device::BluetoothGattCharacteristic; |
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1178 mojom::BluetoothAddress::From(device->GetAddress()); | 1179 mojom::BluetoothAddress::From(device->GetAddress()); |
1179 bonded_devices.push_back(std::move(addr)); | 1180 bonded_devices.push_back(std::move(addr)); |
1180 } | 1181 } |
1181 | 1182 |
1182 btp->set_bonded_devices(std::move(bonded_devices)); | 1183 btp->set_bonded_devices(std::move(bonded_devices)); |
1183 properties.push_back(std::move(btp)); | 1184 properties.push_back(std::move(btp)); |
1184 } | 1185 } |
1185 if (type == mojom::BluetoothPropertyType::ALL || | 1186 if (type == mojom::BluetoothPropertyType::ALL || |
1186 type == mojom::BluetoothPropertyType::ADAPTER_DISCOVERY_TIMEOUT) { | 1187 type == mojom::BluetoothPropertyType::ADAPTER_DISCOVERY_TIMEOUT) { |
1187 mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New(); | 1188 mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New(); |
1188 btp->set_discovery_timeout(120); | 1189 btp->set_discovery_timeout(static_cast<bluez::BluetoothAdapterBlueZ*>( |
Ken Rockot(use gerrit already)
2016/06/27 17:10:49
drive-by comment: could you just store bluetooth_a
| |
1190 bluetooth_adapter_.get())->GetDiscoverableTimeout()); | |
1189 properties.push_back(std::move(btp)); | 1191 properties.push_back(std::move(btp)); |
1190 } | 1192 } |
1191 | 1193 |
1192 return properties; | 1194 return properties; |
1193 } | 1195 } |
1194 | 1196 |
1195 // Android support 5 types of Advertising Data. | 1197 // Android support 5 types of Advertising Data. |
1196 // However Chrome didn't expose AdvertiseFlag and ManufacturerData. | 1198 // However Chrome didn't expose AdvertiseFlag and ManufacturerData. |
1197 // So we will only expose local_name, service_uuids and service_data. | 1199 // So we will only expose local_name, service_uuids and service_data. |
1198 // TODO(crbug.com/618442) Make Chrome expose missing data. | 1200 // TODO(crbug.com/618442) Make Chrome expose missing data. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1311 // to | 1313 // to |
1312 // make sure the bond state machine on Android is ready to take the | 1314 // 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 | 1315 // pair-done event. Otherwise the pair-done event will be dropped as an |
1314 // invalid change of paired status. | 1316 // invalid change of paired status. |
1315 OnPairing(addr->Clone()); | 1317 OnPairing(addr->Clone()); |
1316 OnPairedDone(std::move(addr)); | 1318 OnPairedDone(std::move(addr)); |
1317 } | 1319 } |
1318 } | 1320 } |
1319 | 1321 |
1320 } // namespace arc | 1322 } // namespace arc |
OLD | NEW |