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

Side by Side Diff: device/bluetooth/bluetooth_adapter.h

Issue 2339253002: bluetooth: mac: add connected LE devices to chooser (Closed)
Patch Set: Nit for the tests Created 4 years, 1 month 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 | device/bluetooth/bluetooth_adapter.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 (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
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 // Inserts all the devices that are connected by the operating system, and not
322 // being connected by Chromium, into |devices_|. This method is useful since
323 // a discovery session cannot find devices that are already connected to the
324 // computer.
325 // TODO(crbug.com/653032): Needs to be implemented for Android, ChromeOS and
326 // Windows.
327 virtual std::unordered_map<BluetoothDevice*, BluetoothDevice::UUIDSet>
328 RetrieveGattConnectedDevicesWithDiscoveryFilter(
329 const BluetoothDiscoveryFilter& discovery_filter);
330
320 // Requests the adapter to start a new discovery session. On success, a new 331 // Requests the adapter to start a new discovery session. On success, a new
321 // instance of BluetoothDiscoverySession will be returned to the caller via 332 // instance of BluetoothDiscoverySession will be returned to the caller via
322 // |callback| and the adapter will be discovering nearby Bluetooth devices. 333 // |callback| and the adapter will be discovering nearby Bluetooth devices.
323 // The returned BluetoothDiscoverySession is owned by the caller and it's the 334 // 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 335 // owner's responsibility to properly clean it up and stop the session when
325 // device discovery is no longer needed. 336 // device discovery is no longer needed.
326 // 337 //
327 // If clients desire device discovery to run, they should always call this 338 // 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 339 // method and never make it conditional on the value of IsDiscovering(), as
329 // another client might cause discovery to stop unexpectedly. Hence, clients 340 // another client might cause discovery to stop unexpectedly. Hence, clients
(...skipping 14 matching lines...) Expand all
344 // Return all discovery filters assigned to this adapter merged together. 355 // Return all discovery filters assigned to this adapter merged together.
345 std::unique_ptr<BluetoothDiscoveryFilter> GetMergedDiscoveryFilter() const; 356 std::unique_ptr<BluetoothDiscoveryFilter> GetMergedDiscoveryFilter() const;
346 357
347 // Works like GetMergedDiscoveryFilter, but doesn't take |masked_filter| into 358 // Works like GetMergedDiscoveryFilter, but doesn't take |masked_filter| into
348 // account. |masked_filter| is compared by pointer, and must be a member of 359 // account. |masked_filter| is compared by pointer, and must be a member of
349 // active session. 360 // active session.
350 std::unique_ptr<BluetoothDiscoveryFilter> GetMergedDiscoveryFilterMasked( 361 std::unique_ptr<BluetoothDiscoveryFilter> GetMergedDiscoveryFilterMasked(
351 BluetoothDiscoveryFilter* masked_filter) const; 362 BluetoothDiscoveryFilter* masked_filter) const;
352 363
353 // Requests the list of devices from the adapter. All devices are returned, 364 // Requests the list of devices from the adapter. All devices are returned,
354 // including those currently connected and those paired. Use the returned 365 // including those currently connected, those paired and all devices returned
355 // device pointers to determine which they are. 366 // by RetrieveGattConnectedDevicesWithDiscoveryFilter() (from the previous
367 // call). Use the returned device pointers to determine which they are.
356 virtual DeviceList GetDevices(); 368 virtual DeviceList GetDevices();
357 virtual ConstDeviceList GetDevices() const; 369 virtual ConstDeviceList GetDevices() const;
358 370
359 // Returns a pointer to the device with the given address |address| or NULL if 371 // Returns a pointer to the device with the given address |address| or NULL if
360 // no such device is known. 372 // no such device is known.
361 virtual BluetoothDevice* GetDevice(const std::string& address); 373 virtual BluetoothDevice* GetDevice(const std::string& address);
362 virtual const BluetoothDevice* GetDevice(const std::string& address) const; 374 virtual const BluetoothDevice* GetDevice(const std::string& address) const;
363 375
364 // Returns a list of UUIDs for services registered on this adapter. 376 // Returns a list of UUIDs for services registered on this adapter.
365 // This may include UUIDs from standard profiles (e.g. A2DP) as well 377 // This may include UUIDs from standard profiles (e.g. A2DP) as well
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 std::set<BluetoothDiscoverySession*> discovery_sessions_; 627 std::set<BluetoothDiscoverySession*> discovery_sessions_;
616 628
617 // Note: This should remain the last member so it'll be destroyed and 629 // Note: This should remain the last member so it'll be destroyed and
618 // invalidate its weak pointers before any other members are destroyed. 630 // invalidate its weak pointers before any other members are destroyed.
619 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; 631 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_;
620 }; 632 };
621 633
622 } // namespace device 634 } // namespace device
623 635
624 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ 636 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698