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_ADAPTER_CLIENT_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "base/callback.h" |
| 12 #include "base/observer_list.h" |
| 13 #include "base/values.h" |
| 14 |
| 15 namespace dbus { |
| 16 class Bus; |
| 17 } // namespace dbus |
| 18 |
| 19 namespace chromeos { |
| 20 |
| 21 // BluetoothAdapterClient is used to communicate with a bluetooth Adapter |
| 22 // interface. |
| 23 class BluetoothAdapterClient { |
| 24 public: |
| 25 // Interface for observing changes from a local bluetooth adapter. |
| 26 class Observer { |
| 27 public: |
| 28 virtual ~Observer() {} |
| 29 |
| 30 // Called when the adapter's Discovering property changes. |
| 31 virtual void DiscoveringPropertyChanged(const std::string& object_path, |
| 32 bool discovering) {} |
| 33 |
| 34 // Called when a new remote device has been discovered. |
| 35 // |device_properties| should be copied if needed. |
| 36 virtual void DeviceFound(const std::string& object_path, |
| 37 const std::string& address, |
| 38 const DictionaryValue& device_properties) {} |
| 39 |
| 40 // Called when a previously discovered device is no longer visible. |
| 41 virtual void DeviceDisappeared(const std::string& object_path, |
| 42 const std::string& address) {} |
| 43 }; |
| 44 |
| 45 virtual ~BluetoothAdapterClient(); |
| 46 |
| 47 // Adds and removes observers for events on the adapter with object path |
| 48 // |object_path|. |
| 49 virtual void AddObserver(Observer* observer, |
| 50 const std::string& object_path) = 0; |
| 51 virtual void RemoveObserver(Observer* observer, |
| 52 const std::string& object_path) = 0; |
| 53 |
| 54 // Starts a device discovery on the adapter with object path |object_path|. |
| 55 virtual void StartDiscovery(const std::string& object_path) = 0; |
| 56 |
| 57 // Cancels any previous device discovery on the adapter with object path |
| 58 // |object_path|. |
| 59 virtual void StopDiscovery(const std::string& object_path) = 0; |
| 60 |
| 61 // Creates the instance. |
| 62 static BluetoothAdapterClient* Create(dbus::Bus* bus); |
| 63 |
| 64 protected: |
| 65 BluetoothAdapterClient(); |
| 66 |
| 67 private: |
| 68 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterClient); |
| 69 }; |
| 70 |
| 71 } // namespace chromeos |
| 72 |
| 73 #endif // CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ |
OLD | NEW |