OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 |
| 12 namespace chromeos { |
| 13 |
| 14 class BluetoothDevice; |
| 15 |
| 16 class BluetoothAdapter { |
| 17 public: |
| 18 // Interface for observing changes from bluetooth adapters. |
| 19 class Observer { |
| 20 public: |
| 21 // The discovery process has started on adapter |adapter_id|. |
| 22 virtual void DiscoveryStarted(const std::string& adapter_id) = 0; |
| 23 |
| 24 // The discovery process has ended on adapter |adapter_id|. |
| 25 virtual void DiscoveryEnded(const std::string& adapter_id) = 0; |
| 26 |
| 27 // A device has been discovered on adapter |adapter_id|. |
| 28 // The observer should not cache the |device| pointer. |
| 29 virtual void DeviceFound(const std::string& adapter_id, |
| 30 BluetoothDevice* device) = 0; |
| 31 |
| 32 virtual ~Observer() {} |
| 33 }; |
| 34 |
| 35 virtual ~BluetoothAdapter(); |
| 36 |
| 37 // Adds and removes the observer. |
| 38 virtual void AddObserver(Observer* observer) = 0; |
| 39 virtual void RemoveObserver(Observer* observer) = 0; |
| 40 |
| 41 // Returns the unique identifier for this adapter. |
| 42 virtual const std::string& id() const = 0; |
| 43 |
| 44 // Starts a device discovery on this adapter. |
| 45 // Caller should call AddObserver() first since results will be received via |
| 46 // the Observer interface. |
| 47 virtual void StartDiscovery() = 0; |
| 48 |
| 49 // Cancels any previous device discovery on this adapter. |
| 50 virtual void StopDiscovery() = 0; |
| 51 |
| 52 // Creates an adapter with id |id|. |
| 53 static BluetoothAdapter* Create(const std::string& id); |
| 54 |
| 55 protected: |
| 56 BluetoothAdapter(); |
| 57 |
| 58 private: |
| 59 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapter); |
| 60 }; |
| 61 |
| 62 } // namespace chromeos |
| 63 |
| 64 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
OLD | NEW |