Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: components/arc/bluetooth/arc_bluetooth_bridge.h

Issue 2319213005: arc/bluetooth: Save BluetoothGattConnection objects (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/arc/bluetooth/arc_bluetooth_bridge.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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. We need to hang on to these as long as the connection is
390 // active since their destructors will drop the connections otherwise.
391 std::unordered_map<std::string,
392 std::unique_ptr<device::BluetoothGattConnection>>
393 gatt_connections_;
388 // Timer to turn adapter discoverable off. 394 // Timer to turn adapter discoverable off.
389 base::OneShotTimer discoverable_off_timer_; 395 base::OneShotTimer discoverable_off_timer_;
390 396
391 base::ThreadChecker thread_checker_; 397 base::ThreadChecker thread_checker_;
392 398
393 // WeakPtrFactory to use for callbacks. 399 // WeakPtrFactory to use for callbacks.
394 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_; 400 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_;
395 401
396 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge); 402 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge);
397 }; 403 };
398 404
399 } // namespace arc 405 } // namespace arc
400 406
401 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ 407 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_
OLDNEW
« no previous file with comments | « no previous file | components/arc/bluetooth/arc_bluetooth_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698