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

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

Issue 319183010: device/bluetooth: Clean up classic discovery in BluetoothAdapterMac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved discovery manager to its own file. Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_MAC_DISCOVERY_MANAGER_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_MAC_DISCOVERY_MANAGER_H_
7
8 #include "base/observer_list.h"
9
10 @class IOBluetoothDevice;
11
12 namespace device {
13
14 // Class used by BluetoothAdapterMac to manage classic and LE device discovery.
15 // For Bluetooth Classic, this class is responsible for keeping device inquiry
16 // running if device discovery is initiated.
17 class BluetoothMacDiscoveryManager {
18 public:
19 // Interface for being notified of events during a device discovery session.
20 class Observer {
21 public:
22 // Called when |manager| has found a device through classic device inquiry
23 // in the form of a IOBluetoothDevice.
24 virtual void DeviceFound(BluetoothMacDiscoveryManager* manager,
25 IOBluetoothDevice* device) {}
26
27 // Called when device discovery is no longer running, due to either a call
28 // too BluetoothMacDiscoveryManager::StopDiscovery or an unexpected reason,
Ilya Sherman 2014/06/10 01:10:59 nit: "too" -> "to"
armansito 2014/06/10 21:56:50 Done.
29 // such as when a user disables the controller, in which case the value of
30 // |unexpected| will be true.
31 virtual void DiscoveryStopped(BluetoothMacDiscoveryManager* manager,
32 bool unexpected) {}
33 };
34
35 virtual ~BluetoothMacDiscoveryManager();
36
37 // Returns true, if discovery is currently being performed.
38 virtual bool IsDiscovering() const = 0;
39
40 // Initiates a discovery session. Returns true on success, or if discovery
41 // is already running.
Ilya Sherman 2014/06/10 01:10:59 nit: It visually looks like this comment applies t
armansito 2014/06/10 21:56:50 Done.
42 virtual bool StartDiscovery() = 0;
43 virtual bool StopDiscovery() = 0;
44
45 // Add and remove observers.
46 void AddObserver(Observer* observer);
47 void RemoveObserver(Observer* observer);
48
49 // Creates a discovery manager for Bluetooth Classic device discovery.
50 static BluetoothMacDiscoveryManager* CreateClassic();
51
52 protected:
53 BluetoothMacDiscoveryManager();
54
55 // List of observers interested in notifications from us.
56 ObserverList<Observer> observers_;
Ilya Sherman 2014/06/10 01:10:59 Do we really need a list of observers, or can we j
armansito 2014/06/10 21:56:50 We can have a single observer, certainly. This jus
Ilya Sherman 2014/06/10 23:23:01 I won't insist, but IMO it's better to avoid being
armansito 2014/06/13 02:14:53 Done.
57
58 private:
59 DISALLOW_COPY_AND_ASSIGN(BluetoothMacDiscoveryManager);
60 };
61
62 } // namespace device
63
64 #endif // DEVICE_BLUETOOTH_BLUETOOTH_MAC_DISCOVERY_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698