Index: device/bluetooth/bluetooth_discovery_manager_mac.h |
diff --git a/device/bluetooth/bluetooth_discovery_manager_mac.h b/device/bluetooth/bluetooth_discovery_manager_mac.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..84bc08efe4f394b5e7f1e29669994247465ad79d |
--- /dev/null |
+++ b/device/bluetooth/bluetooth_discovery_manager_mac.h |
@@ -0,0 +1,67 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_DISCOVERY_MANAGER_MAC_H_ |
+#define DEVICE_BLUETOOTH_BLUETOOTH_DISCOVERY_MANAGER_MAC_H_ |
+ |
+#include "base/observer_list.h" |
+ |
+@class IOBluetoothDevice; |
+ |
+namespace device { |
+ |
+// Class used by BluetoothAdapterMac to manage classic and LE device discovery. |
+// For Bluetooth Classic, this class is responsible for keeping device inquiry |
+// running if device discovery is initiated. |
+class BluetoothDiscoveryManagerMac { |
+ public: |
+ // Interface for being notified of events during a device discovery session. |
+ class Observer { |
+ public: |
+ // Called when |manager| has found a device through classic device inquiry |
+ // in the form of a IOBluetoothDevice. |
+ virtual void DeviceFound(BluetoothDiscoveryManagerMac* manager, |
+ IOBluetoothDevice* device) {} |
+ |
+ // Called when device discovery is no longer running, due to either a call |
+ // to BluetoothDiscoveryManagerMac::StopDiscovery or an unexpected reason, |
+ // such as when a user disables the controller, in which case the value of |
+ // |unexpected| will be true. |
+ virtual void DiscoveryStopped(BluetoothDiscoveryManagerMac* manager, |
+ bool unexpected) {} |
+ }; |
+ |
+ virtual ~BluetoothDiscoveryManagerMac(); |
+ |
+ // Returns true, if discovery is currently being performed. |
+ virtual bool IsDiscovering() const = 0; |
+ |
+ // Initiates a discovery session. Returns true on success or if discovery |
+ // is already running. Returns false on failure. |
+ virtual bool StartDiscovery() = 0; |
+ |
+ // Stops a discovery session. Returns true on success or if discovery is |
+ // already not running. Returns false on failure. |
+ virtual bool StopDiscovery() = 0; |
+ |
+ // Add and remove observers. |
+ void AddObserver(Observer* observer); |
+ void RemoveObserver(Observer* observer); |
+ |
+ // Creates a discovery manager for Bluetooth Classic device discovery. |
+ static BluetoothDiscoveryManagerMac* CreateClassic(); |
+ |
+ protected: |
+ BluetoothDiscoveryManagerMac(); |
+ |
+ // List of observers interested in notifications from us. |
+ ObserverList<Observer> observers_; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(BluetoothDiscoveryManagerMac); |
+}; |
+ |
+} // namespace device |
+ |
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_DISCOVERY_MANAGER_MAC_H_ |