OLD | NEW |
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 #ifndef COMPONENTS_CRYPTAUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_CLIENT_CONNECTION_H_ | 5 #ifndef COMPONENTS_CRYPTAUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_CLIENT_CONNECTION_H_ |
6 #define COMPONENTS_CRYPTAUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_CLIENT_CONNECTION_H_ | 6 #define COMPONENTS_CRYPTAUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_CLIENT_CONNECTION_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // receive connection response | | 48 // receive connection response | |
49 // opt: send data | opt: send data | 49 // opt: send data | opt: send data |
50 // receive data | receive data | 50 // receive data | receive data |
51 // opt: close connection | opt: close connection | 51 // opt: close connection | opt: close connection |
52 class BluetoothLowEnergyWeaveClientConnection | 52 class BluetoothLowEnergyWeaveClientConnection |
53 : public Connection, | 53 : public Connection, |
54 public device::BluetoothAdapter::Observer { | 54 public device::BluetoothAdapter::Observer { |
55 public: | 55 public: |
56 class Factory { | 56 class Factory { |
57 public: | 57 public: |
58 static std::unique_ptr<BluetoothLowEnergyWeaveClientConnection> | 58 static std::unique_ptr<Connection> NewInstance( |
59 NewInstance( | |
60 const RemoteDevice& remote_device, | 59 const RemoteDevice& remote_device, |
61 const std::string& device_address, | 60 const std::string& device_address, |
62 scoped_refptr<device::BluetoothAdapter> adapter, | 61 scoped_refptr<device::BluetoothAdapter> adapter, |
63 const device::BluetoothUUID remote_service_uuid, | 62 const device::BluetoothUUID remote_service_uuid, |
64 BluetoothThrottler* bluetooth_throttler); | 63 BluetoothThrottler* bluetooth_throttler); |
65 | 64 |
66 // Exposed for testing. | 65 // Exposed for testing. |
67 static void SetInstanceForTesting(std::shared_ptr<Factory> factory); | 66 static void SetInstanceForTesting(std::shared_ptr<Factory> factory); |
68 | 67 |
69 protected: | 68 protected: |
70 // Exposed for testing. | 69 // Exposed for testing. |
71 virtual std::unique_ptr<BluetoothLowEnergyWeaveClientConnection> | 70 virtual std::unique_ptr<Connection> BuildInstance( |
72 BuildInstance( | |
73 const RemoteDevice& remote_device, | 71 const RemoteDevice& remote_device, |
74 const std::string& device_address, | 72 const std::string& device_address, |
75 scoped_refptr<device::BluetoothAdapter> adapter, | 73 scoped_refptr<device::BluetoothAdapter> adapter, |
76 const device::BluetoothUUID remote_service_uuid, | 74 const device::BluetoothUUID remote_service_uuid, |
77 BluetoothThrottler* bluetooth_throttler); | 75 BluetoothThrottler* bluetooth_throttler); |
78 | 76 |
79 private: | 77 private: |
80 static std::shared_ptr<Factory> factory_instance_; | 78 static std::shared_ptr<Factory> factory_instance_; |
81 }; | 79 }; |
82 | 80 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 weak_ptr_factory_; | 316 weak_ptr_factory_; |
319 | 317 |
320 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyWeaveClientConnection); | 318 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyWeaveClientConnection); |
321 }; | 319 }; |
322 | 320 |
323 } // namespace weave | 321 } // namespace weave |
324 | 322 |
325 } // namespace cryptauth | 323 } // namespace cryptauth |
326 | 324 |
327 #endif // COMPONENTS_CRYPTAUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_CLIENT_CONNECTION
_H_ | 325 #endif // COMPONENTS_CRYPTAUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_CLIENT_CONNECTION
_H_ |
OLD | NEW |