Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <unordered_map> | |
| 14 #include <utility> | 15 #include <utility> |
| 15 #include <vector> | 16 #include <vector> |
| 16 | 17 |
| 17 #include "base/callback.h" | 18 #include "base/callback.h" |
| 18 #include "base/containers/scoped_ptr_hash_map.h" | 19 #include "base/containers/scoped_ptr_hash_map.h" |
| 19 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
| 20 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
| 21 #include "base/time/time.h" | 22 #include "base/time/time.h" |
| 22 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 23 #include "device/bluetooth/bluetooth_advertisement.h" | 24 #include "device/bluetooth/bluetooth_advertisement.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 // |discoverable| is true, then it will be discoverable by other Bluetooth | 311 // |discoverable| is true, then it will be discoverable by other Bluetooth |
| 311 // devices. On successfully changing the adapter's discoverability, |callback| | 312 // devices. On successfully changing the adapter's discoverability, |callback| |
| 312 // will be called. On failure, |error_callback| will be called. | 313 // will be called. On failure, |error_callback| will be called. |
| 313 virtual void SetDiscoverable(bool discoverable, | 314 virtual void SetDiscoverable(bool discoverable, |
| 314 const base::Closure& callback, | 315 const base::Closure& callback, |
| 315 const ErrorCallback& error_callback) = 0; | 316 const ErrorCallback& error_callback) = 0; |
| 316 | 317 |
| 317 // Indicates whether the adapter is currently discovering new devices. | 318 // Indicates whether the adapter is currently discovering new devices. |
| 318 virtual bool IsDiscovering() const = 0; | 319 virtual bool IsDiscovering() const = 0; |
| 319 | 320 |
| 321 // This function get all the connected peripherals into |devices_|. | |
|
scheib
2016/10/28 20:35:50
Let's fix up comments some. First, GetDevices() is
jlebel
2016/11/07 01:43:17
Done.
| |
| 322 // TODO(crbug.com/653032): Needs to be implemented for Android, ChromeOS and | |
| 323 // Windows. | |
| 324 virtual std::unordered_map<BluetoothDevice*, BluetoothDevice::UUIDSet> | |
| 325 RetrieveGattConnectedDevicesWithDiscoveryFilter( | |
| 326 const BluetoothDiscoveryFilter* discovery_filter); | |
| 327 | |
| 320 // Requests the adapter to start a new discovery session. On success, a new | 328 // Requests the adapter to start a new discovery session. On success, a new |
| 321 // instance of BluetoothDiscoverySession will be returned to the caller via | 329 // instance of BluetoothDiscoverySession will be returned to the caller via |
| 322 // |callback| and the adapter will be discovering nearby Bluetooth devices. | 330 // |callback| and the adapter will be discovering nearby Bluetooth devices. |
| 323 // The returned BluetoothDiscoverySession is owned by the caller and it's the | 331 // The returned BluetoothDiscoverySession is owned by the caller and it's the |
| 324 // owner's responsibility to properly clean it up and stop the session when | 332 // owner's responsibility to properly clean it up and stop the session when |
| 325 // device discovery is no longer needed. | 333 // device discovery is no longer needed. |
| 326 // | 334 // |
| 327 // If clients desire device discovery to run, they should always call this | 335 // If clients desire device discovery to run, they should always call this |
| 328 // method and never make it conditional on the value of IsDiscovering(), as | 336 // method and never make it conditional on the value of IsDiscovering(), as |
| 329 // another client might cause discovery to stop unexpectedly. Hence, clients | 337 // another client might cause discovery to stop unexpectedly. Hence, clients |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 615 std::set<BluetoothDiscoverySession*> discovery_sessions_; | 623 std::set<BluetoothDiscoverySession*> discovery_sessions_; |
| 616 | 624 |
| 617 // Note: This should remain the last member so it'll be destroyed and | 625 // Note: This should remain the last member so it'll be destroyed and |
| 618 // invalidate its weak pointers before any other members are destroyed. | 626 // invalidate its weak pointers before any other members are destroyed. |
| 619 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; | 627 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; |
| 620 }; | 628 }; |
| 621 | 629 |
| 622 } // namespace device | 630 } // namespace device |
| 623 | 631 |
| 624 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 632 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| OLD | NEW |