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

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

Issue 2320293002: 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 void OnPairedError( 283 void OnPairedError(
284 mojom::BluetoothAddressPtr addr, 284 mojom::BluetoothAddressPtr addr,
285 device::BluetoothDevice::ConnectErrorCode error_code) const; 285 device::BluetoothDevice::ConnectErrorCode error_code) const;
286 void OnForgetDone(mojom::BluetoothAddressPtr addr) const; 286 void OnForgetDone(mojom::BluetoothAddressPtr addr) const;
287 void OnForgetError(mojom::BluetoothAddressPtr addr) const; 287 void OnForgetError(mojom::BluetoothAddressPtr addr) const;
288 288
289 void OnGattConnectStateChanged(mojom::BluetoothAddressPtr addr, 289 void OnGattConnectStateChanged(mojom::BluetoothAddressPtr addr,
290 bool connected) const; 290 bool connected) const;
291 void OnGattConnected( 291 void OnGattConnected(
292 mojom::BluetoothAddressPtr addr, 292 mojom::BluetoothAddressPtr addr,
293 std::unique_ptr<device::BluetoothGattConnection> connection) const; 293 std::unique_ptr<device::BluetoothGattConnection> connection);
294 void OnGattConnectError( 294 void OnGattConnectError(
295 mojom::BluetoothAddressPtr addr, 295 mojom::BluetoothAddressPtr addr,
296 device::BluetoothDevice::ConnectErrorCode error_code) const; 296 device::BluetoothDevice::ConnectErrorCode error_code) const;
297 void OnGattDisconnected(mojom::BluetoothAddressPtr addr) const; 297 void OnGattDisconnected(mojom::BluetoothAddressPtr addr);
298 298
299 void OnStartLEListenDone(const StartLEListenCallback& callback, 299 void OnStartLEListenDone(const StartLEListenCallback& callback,
300 scoped_refptr<device::BluetoothAdvertisement> adv); 300 scoped_refptr<device::BluetoothAdvertisement> adv);
301 void OnStartLEListenError( 301 void OnStartLEListenError(
302 const StartLEListenCallback& callback, 302 const StartLEListenCallback& callback,
303 device::BluetoothAdvertisement::ErrorCode error_code); 303 device::BluetoothAdvertisement::ErrorCode error_code);
304 304
305 void OnStopLEListenDone(const StopLEListenCallback& callback); 305 void OnStopLEListenDone(const StopLEListenCallback& callback);
306 void OnStopLEListenError( 306 void OnStopLEListenError(
307 const StopLEListenCallback& callback, 307 const StopLEListenCallback& callback,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 // Map from Android int handle to Chrome (BlueZ) string identifier. 377 // Map from Android int handle to Chrome (BlueZ) string identifier.
378 std::unordered_map<int32_t, std::string> gatt_identifier_; 378 std::unordered_map<int32_t, std::string> gatt_identifier_;
379 // Map from Chrome (BlueZ) string identifier to android int handle. 379 // Map from Chrome (BlueZ) string identifier to android int handle.
380 std::unordered_map<std::string, int32_t> gatt_handle_; 380 std::unordered_map<std::string, int32_t> gatt_handle_;
381 // Store last GattCharacteristic added to each GattService for GattServer. 381 // Store last GattCharacteristic added to each GattService for GattServer.
382 std::unordered_map<int32_t, int32_t> last_characteristic_; 382 std::unordered_map<int32_t, int32_t> last_characteristic_;
383 // Monotonically increasing value to use as handle to give to Android side. 383 // Monotonically increasing value to use as handle to give to Android side.
384 int32_t gatt_server_attribute_next_handle_ = 0; 384 int32_t gatt_server_attribute_next_handle_ = 0;
385 // Keeps track of all devices which initiated a GATT connection to us. 385 // Keeps track of all devices which initiated a GATT connection to us.
386 std::unordered_set<std::string> gatt_connection_cache_; 386 std::unordered_set<std::string> gatt_connection_cache_;
387 // Map of device address to GATT connection objects for connections we
388 // have made. We need to hang on to these as long as the connection is
389 // active since their destructors will drop the connections otherwise.
390 std::unordered_map<std::string,
391 std::unique_ptr<device::BluetoothGattConnection>>
392 gatt_connections_;
387 // Timer to turn adapter discoverable off. 393 // Timer to turn adapter discoverable off.
388 base::OneShotTimer discoverable_off_timer_; 394 base::OneShotTimer discoverable_off_timer_;
389 395
390 base::ThreadChecker thread_checker_; 396 base::ThreadChecker thread_checker_;
391 397
392 // WeakPtrFactory to use for callbacks. 398 // WeakPtrFactory to use for callbacks.
393 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_; 399 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_;
394 400
395 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge); 401 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge);
396 }; 402 };
397 403
398 } // namespace arc 404 } // namespace arc
399 405
400 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ 406 #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