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