Make castv2 performance test work.
[chromium-blink-merge.git] / device / bluetooth / bluetooth_discovery_manager_mac.h
blobf6a003c7bd35279b65ac39bc721e7731a3ce6b80
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.
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DISCOVERY_MANAGER_MAC_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DISCOVERY_MANAGER_MAC_H_
8 #include "base/macros.h"
10 @class IOBluetoothDevice;
12 namespace device {
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 BluetoothDiscoveryManagerMac {
18 public:
19 // Interface for being notified of events during a device discovery session.
20 class Observer {
21 public:
22 // Called when |this| manager has found a device through classic device
23 // inquiry in the form of an IOBluetoothDevice.
24 virtual void DeviceFound(IOBluetoothDevice* device) = 0;
26 // Called when device discovery is no longer running, due to either a call
27 // to BluetoothDiscoveryManagerMac::StopDiscovery or an unexpected reason,
28 // such as when a user disables the controller, in which case the value of
29 // |unexpected| will be true.
30 virtual void DiscoveryStopped(bool unexpected) = 0;
32 protected:
33 virtual ~Observer() {}
36 virtual ~BluetoothDiscoveryManagerMac();
38 // Returns true, if discovery is currently being performed.
39 virtual bool IsDiscovering() const = 0;
41 // Initiates a discovery session. Returns true on success or if discovery
42 // is already running. Returns false on failure.
43 virtual bool StartDiscovery() = 0;
45 // Stops a discovery session. Returns true on success or if discovery is
46 // already not running. Returns false on failure.
47 virtual bool StopDiscovery() = 0;
49 // Creates a discovery manager for Bluetooth Classic device discovery with
50 // observer |observer|. Note that the life-time of |observer| should not
51 // end before that of the returned BluetoothDiscoveryManager, as that may
52 // lead to use after free errors.
53 static BluetoothDiscoveryManagerMac* CreateClassic(Observer* observer);
55 protected:
56 explicit BluetoothDiscoveryManagerMac(Observer* observer);
58 // Observer interested in notifications from us.
59 Observer* observer_;
61 private:
62 DISALLOW_COPY_AND_ASSIGN(BluetoothDiscoveryManagerMac);
65 } // namespace device
67 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DISCOVERY_MANAGER_MAC_H_