| 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_PROXIMITY_AUTH_BLUETOOTH_LOW_ENERGY_CONNECTION_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_CONNECTION_H_ |
| 6 #define COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_LOW_ENERGY_CONNECTION_H | 6 #define COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_CONNECTION_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "components/proximity_auth/ble/bluetooth_low_energy_characteristics_fin
der.h" | 16 #include "components/proximity_auth/ble/bluetooth_low_energy_characteristics_fin
der.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 // 4) |request| is not dequeued if it fails | 197 // 4) |request| is not dequeued if it fails |
| 198 // (OnWriteRemoteCharacteristicError()), it remains on the queue and will be | 198 // (OnWriteRemoteCharacteristicError()), it remains on the queue and will be |
| 199 // retried. |request| will remain on the queue until it succeeds or it | 199 // retried. |request| will remain on the queue until it succeeds or it |
| 200 // triggers a Disconnect() call (after |max_number_of_tries_|). | 200 // triggers a Disconnect() call (after |max_number_of_tries_|). |
| 201 void WriteRemoteCharacteristic(WriteRequest request); | 201 void WriteRemoteCharacteristic(WriteRequest request); |
| 202 | 202 |
| 203 // Processes the next request in |write_requests_queue_|. | 203 // Processes the next request in |write_requests_queue_|. |
| 204 void ProcessNextWriteRequest(); | 204 void ProcessNextWriteRequest(); |
| 205 | 205 |
| 206 // Called when the BluetoothGattCharacteristic::RemoteCharacteristicWrite() is | 206 // Called when the BluetoothGattCharacteristic::RemoteCharacteristicWrite() is |
| 207 // sucessfully complete. | 207 // successfully complete. |
| 208 void OnRemoteCharacteristicWritten(bool run_did_send_message_callback); | 208 void OnRemoteCharacteristicWritten(bool run_did_send_message_callback); |
| 209 | 209 |
| 210 // Called when there is an error writing to the remote characteristic | 210 // Called when there is an error writing to the remote characteristic |
| 211 // |to_peripheral_char_|. | 211 // |to_peripheral_char_|. |
| 212 void OnWriteRemoteCharacteristicError( | 212 void OnWriteRemoteCharacteristicError( |
| 213 bool run_did_send_message_callback, | 213 bool run_did_send_message_callback, |
| 214 device::BluetoothGattService::GattErrorCode error); | 214 device::BluetoothGattService::GattErrorCode error); |
| 215 | 215 |
| 216 // Builds the value to be written on |to_peripheral_char_|. The value | 216 // Builds the value to be written on |to_peripheral_char_|. The value |
| 217 // corresponds to |signal| concatenated with |payload|. | 217 // corresponds to |signal| concatenated with |payload|. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 // Stores when the instace was created. | 299 // Stores when the instace was created. |
| 300 base::TimeTicks start_time_; | 300 base::TimeTicks start_time_; |
| 301 | 301 |
| 302 base::WeakPtrFactory<BluetoothLowEnergyConnection> weak_ptr_factory_; | 302 base::WeakPtrFactory<BluetoothLowEnergyConnection> weak_ptr_factory_; |
| 303 | 303 |
| 304 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyConnection); | 304 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyConnection); |
| 305 }; | 305 }; |
| 306 | 306 |
| 307 } // namespace proximity_auth | 307 } // namespace proximity_auth |
| 308 | 308 |
| 309 #endif // COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_LOW_ENERGY_CONNECTION_H | 309 #endif // COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_CONNECTION_H_ |
| OLD | NEW |