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 #ifndef COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ | 5 #ifndef COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ |
6 #define COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ | 6 #define COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
284 void OnPairedError( | 284 void OnPairedError( |
285 mojom::BluetoothAddressPtr addr, | 285 mojom::BluetoothAddressPtr addr, |
286 device::BluetoothDevice::ConnectErrorCode error_code) const; | 286 device::BluetoothDevice::ConnectErrorCode error_code) const; |
287 void OnForgetDone(mojom::BluetoothAddressPtr addr) const; | 287 void OnForgetDone(mojom::BluetoothAddressPtr addr) const; |
288 void OnForgetError(mojom::BluetoothAddressPtr addr) const; | 288 void OnForgetError(mojom::BluetoothAddressPtr addr) const; |
289 | 289 |
290 void OnGattConnectStateChanged(mojom::BluetoothAddressPtr addr, | 290 void OnGattConnectStateChanged(mojom::BluetoothAddressPtr addr, |
291 bool connected) const; | 291 bool connected) const; |
292 void OnGattConnected( | 292 void OnGattConnected( |
293 mojom::BluetoothAddressPtr addr, | 293 mojom::BluetoothAddressPtr addr, |
294 std::unique_ptr<device::BluetoothGattConnection> connection) const; | 294 std::unique_ptr<device::BluetoothGattConnection> connection); |
295 void OnGattConnectError( | 295 void OnGattConnectError( |
296 mojom::BluetoothAddressPtr addr, | 296 mojom::BluetoothAddressPtr addr, |
297 device::BluetoothDevice::ConnectErrorCode error_code) const; | 297 device::BluetoothDevice::ConnectErrorCode error_code) const; |
298 void OnGattDisconnected(mojom::BluetoothAddressPtr addr) const; | 298 void OnGattDisconnected(mojom::BluetoothAddressPtr addr); |
299 | 299 |
300 void OnStartLEListenDone(const StartLEListenCallback& callback, | 300 void OnStartLEListenDone(const StartLEListenCallback& callback, |
301 scoped_refptr<device::BluetoothAdvertisement> adv); | 301 scoped_refptr<device::BluetoothAdvertisement> adv); |
302 void OnStartLEListenError( | 302 void OnStartLEListenError( |
303 const StartLEListenCallback& callback, | 303 const StartLEListenCallback& callback, |
304 device::BluetoothAdvertisement::ErrorCode error_code); | 304 device::BluetoothAdvertisement::ErrorCode error_code); |
305 | 305 |
306 void OnStopLEListenDone(const StopLEListenCallback& callback); | 306 void OnStopLEListenDone(const StopLEListenCallback& callback); |
307 void OnStopLEListenError( | 307 void OnStopLEListenError( |
308 const StopLEListenCallback& callback, | 308 const StopLEListenCallback& callback, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
378 // Map from Android int handle to Chrome (BlueZ) string identifier. | 378 // Map from Android int handle to Chrome (BlueZ) string identifier. |
379 std::unordered_map<int32_t, std::string> gatt_identifier_; | 379 std::unordered_map<int32_t, std::string> gatt_identifier_; |
380 // Map from Chrome (BlueZ) string identifier to android int handle. | 380 // Map from Chrome (BlueZ) string identifier to android int handle. |
381 std::unordered_map<std::string, int32_t> gatt_handle_; | 381 std::unordered_map<std::string, int32_t> gatt_handle_; |
382 // Store last GattCharacteristic added to each GattService for GattServer. | 382 // Store last GattCharacteristic added to each GattService for GattServer. |
383 std::unordered_map<int32_t, int32_t> last_characteristic_; | 383 std::unordered_map<int32_t, int32_t> last_characteristic_; |
384 // Monotonically increasing value to use as handle to give to Android side. | 384 // Monotonically increasing value to use as handle to give to Android side. |
385 int32_t gatt_server_attribute_next_handle_ = 0; | 385 int32_t gatt_server_attribute_next_handle_ = 0; |
386 // Keeps track of all devices which initiated a GATT connection to us. | 386 // Keeps track of all devices which initiated a GATT connection to us. |
387 std::unordered_set<std::string> gatt_connection_cache_; | 387 std::unordered_set<std::string> gatt_connection_cache_; |
388 // Map of device address to GATT connection objects for connections we | |
389 // have made. | |
390 std::unordered_map<std::string, | |
391 std::unique_ptr<device::BluetoothGattConnection>> | |
392 gatt_connections_; | |
Luis Héctor Chávez
2016/09/07 19:54:15
nit: Add a comment that we are holding these just
| |
388 // Timer to turn adapter discoverable off. | 393 // Timer to turn adapter discoverable off. |
389 base::OneShotTimer discoverable_off_timer_; | 394 base::OneShotTimer discoverable_off_timer_; |
390 | 395 |
391 base::ThreadChecker thread_checker_; | 396 base::ThreadChecker thread_checker_; |
392 | 397 |
393 // WeakPtrFactory to use for callbacks. | 398 // WeakPtrFactory to use for callbacks. |
394 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_; | 399 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_; |
395 | 400 |
396 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge); | 401 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge); |
397 }; | 402 }; |
398 | 403 |
399 } // namespace arc | 404 } // namespace arc |
400 | 405 |
401 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ | 406 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ |
OLD | NEW |