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_DBUS_BLUETOOTH_MANAGER_CLIENT_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_MANAGER_CLIENT_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "base/callback.h" |
| 12 #include "base/observer_list.h" |
| 13 |
| 14 namespace dbus { |
| 15 class Bus; |
| 16 } // namespace dbus |
| 17 |
| 18 namespace chromeos { |
| 19 |
| 20 // BluetoothManagerClient is used to communicate with the bluetooth |
| 21 // daemon's Manager interface. |
| 22 class BluetoothManagerClient { |
| 23 public: |
| 24 // Interface for observing changes from the bluetooth manager. |
| 25 class Observer { |
| 26 public: |
| 27 virtual ~Observer() {} |
| 28 |
| 29 // Called when a local bluetooth adapter is removed. |
| 30 // |adapter| is the dbus object path of the adapter. |
| 31 virtual void AdapterRemoved(const std::string& adapter) {} |
| 32 |
| 33 // Called when the default local bluetooth adapter changes. |
| 34 // |adapter| is the dbus object path of the new default adapter. |
| 35 // Not called if all adapters are removed. |
| 36 virtual void DefaultAdapterChanged(const std::string& adapter) {} |
| 37 }; |
| 38 |
| 39 virtual ~BluetoothManagerClient(); |
| 40 |
| 41 // Adds and removes the observer. |
| 42 virtual void AddObserver(Observer* observer) = 0; |
| 43 virtual void RemoveObserver(Observer* observer) = 0; |
| 44 |
| 45 // The DefaultAdapterCallback receives two arguments: |
| 46 // std::string adapter - the unique identifier of the default adapter |
| 47 // bool success - whether or not the request succeeded |
| 48 typedef base::Callback<void(std::string, bool)> DefaultAdapterCallback; |
| 49 |
| 50 // Retrieves the dbus object path for the default adapter. |
| 51 // The default adapter is the preferred local bluetooth interface when a |
| 52 // client does not specify a particular interface. |
| 53 virtual void DefaultAdapter(const DefaultAdapterCallback& callback) = 0; |
| 54 |
| 55 // Creates the instance. |
| 56 static BluetoothManagerClient* Create(dbus::Bus* bus); |
| 57 |
| 58 protected: |
| 59 BluetoothManagerClient(); |
| 60 |
| 61 private: |
| 62 DISALLOW_COPY_AND_ASSIGN(BluetoothManagerClient); |
| 63 }; |
| 64 |
| 65 } // namespace chromeos |
| 66 |
| 67 #endif // CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_MANAGER_CLIENT_H_ |
OLD | NEW |