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 #ifndef CHROMEOS_COMPONENTS_TETHER_BLE_CONNECTION_MANAGER_H_ | 5 #ifndef CHROMEOS_COMPONENTS_TETHER_BLE_CONNECTION_MANAGER_H_ |
6 #define CHROMEOS_COMPONENTS_TETHER_BLE_CONNECTION_MANAGER_H_ | 6 #define CHROMEOS_COMPONENTS_TETHER_BLE_CONNECTION_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
16 #include "chromeos/components/tether/ble_advertisement_device_queue.h" | 16 #include "chromeos/components/tether/ble_advertisement_device_queue.h" |
17 #include "chromeos/components/tether/ble_advertiser.h" | 17 #include "chromeos/components/tether/ble_advertiser.h" |
18 #include "chromeos/components/tether/ble_scanner.h" | 18 #include "chromeos/components/tether/ble_scanner.h" |
19 #include "chromeos/components/tether/proto/tether.pb.h" | 19 #include "chromeos/components/tether/proto/tether.pb.h" |
20 #include "components/cryptauth/remote_device.h" | 20 #include "components/cryptauth/remote_device.h" |
21 #include "components/cryptauth/secure_channel.h" | 21 #include "components/cryptauth/secure_channel.h" |
22 | 22 |
23 namespace cryptauth { | 23 namespace cryptauth { |
24 class BluetoothThrottler; | 24 class BluetoothThrottler; |
25 class CryptAuthService; | 25 class CryptAuthService; |
| 26 class LocalDeviceDataProvider; |
26 } // namespace cryptauth | 27 } // namespace cryptauth |
27 | 28 |
28 namespace chromeos { | 29 namespace chromeos { |
29 | 30 |
30 namespace tether { | 31 namespace tether { |
31 | 32 |
32 class TimerFactory; | 33 class TimerFactory; |
33 | 34 |
34 // Manages connections to remote devices. When a device is registered, | 35 // Manages connections to remote devices. When a device is registered, |
35 // BleConnectionManager intiates a connection to that device. If the connection | 36 // BleConnectionManager intiates a connection to that device. If the connection |
(...skipping 28 matching lines...) Expand all Loading... |
64 const cryptauth::SecureChannel::Status& old_status, | 65 const cryptauth::SecureChannel::Status& old_status, |
65 const cryptauth::SecureChannel::Status& new_status) = 0; | 66 const cryptauth::SecureChannel::Status& new_status) = 0; |
66 | 67 |
67 virtual void OnMessageReceived(const cryptauth::RemoteDevice& remote_device, | 68 virtual void OnMessageReceived(const cryptauth::RemoteDevice& remote_device, |
68 const std::string& payload) = 0; | 69 const std::string& payload) = 0; |
69 }; | 70 }; |
70 | 71 |
71 BleConnectionManager( | 72 BleConnectionManager( |
72 cryptauth::CryptAuthService* cryptauth_service, | 73 cryptauth::CryptAuthService* cryptauth_service, |
73 scoped_refptr<device::BluetoothAdapter> adapter, | 74 scoped_refptr<device::BluetoothAdapter> adapter, |
74 const LocalDeviceDataProvider* local_device_data_provider, | 75 const cryptauth::LocalDeviceDataProvider* local_device_data_provider, |
75 const cryptauth::RemoteBeaconSeedFetcher* remote_beacon_seed_fetcher, | 76 const cryptauth::RemoteBeaconSeedFetcher* remote_beacon_seed_fetcher, |
76 cryptauth::BluetoothThrottler* bluetooth_throttler); | 77 cryptauth::BluetoothThrottler* bluetooth_throttler); |
77 virtual ~BleConnectionManager(); | 78 virtual ~BleConnectionManager(); |
78 | 79 |
79 // Registers |remote_device| for |connection_reason|. Once registered, this | 80 // Registers |remote_device| for |connection_reason|. Once registered, this |
80 // instance will continue to attempt to connect and authenticate to that | 81 // instance will continue to attempt to connect and authenticate to that |
81 // device until the device is unregistered. | 82 // device until the device is unregistered. |
82 virtual void RegisterRemoteDevice( | 83 virtual void RegisterRemoteDevice( |
83 const cryptauth::RemoteDevice& remote_device, | 84 const cryptauth::RemoteDevice& remote_device, |
84 const MessageType& connection_reason); | 85 const MessageType& connection_reason); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 base::WeakPtrFactory<BleConnectionManager> weak_ptr_factory_; | 217 base::WeakPtrFactory<BleConnectionManager> weak_ptr_factory_; |
217 | 218 |
218 DISALLOW_COPY_AND_ASSIGN(BleConnectionManager); | 219 DISALLOW_COPY_AND_ASSIGN(BleConnectionManager); |
219 }; | 220 }; |
220 | 221 |
221 } // namespace tether | 222 } // namespace tether |
222 | 223 |
223 } // namespace chromeos | 224 } // namespace chromeos |
224 | 225 |
225 #endif // CHROMEOS_COMPONENTS_TETHER_BLE_CONNECTION_MANAGER_H_ | 226 #endif // CHROMEOS_COMPONENTS_TETHER_BLE_CONNECTION_MANAGER_H_ |
OLD | NEW |