| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "dbus/object_path.h" | |
| 15 | 14 |
| 16 namespace dbus { | 15 namespace dbus { |
| 17 class Bus; | 16 class Bus; |
| 18 } // namespace dbus | 17 } // namespace dbus |
| 19 | 18 |
| 20 namespace chromeos { | 19 namespace chromeos { |
| 21 | 20 |
| 22 class BluetoothManagerClient; | 21 class BluetoothManagerClient; |
| 23 | 22 |
| 24 // BluetoothAdapterClient is used to communicate with a bluetooth Adapter | 23 // BluetoothAdapterClient is used to communicate with a bluetooth Adapter |
| 25 // interface. | 24 // interface. |
| 26 class BluetoothAdapterClient { | 25 class BluetoothAdapterClient { |
| 27 public: | 26 public: |
| 28 // Interface for observing changes from a local bluetooth adapter. | 27 // Interface for observing changes from a local bluetooth adapter. |
| 29 class Observer { | 28 class Observer { |
| 30 public: | 29 public: |
| 31 virtual ~Observer() {} | 30 virtual ~Observer() {} |
| 32 | 31 |
| 33 // Called when a new known device has been created. | 32 // Called when a new known device has been created. |
| 34 virtual void DeviceCreated(const dbus::ObjectPath& object_path, | 33 virtual void DeviceCreated(const std::string& object_path, |
| 35 const dbus::ObjectPath& device_path) {} | 34 const std::string& device_path) {} |
| 36 | 35 |
| 37 // Called when a previously known device is removed. | 36 // Called when a previously known device is removed. |
| 38 virtual void DeviceRemoved(const dbus::ObjectPath& object_path, | 37 virtual void DeviceRemoved(const std::string& object_path, |
| 39 const dbus::ObjectPath& device_path) {} | 38 const std::string& device_path) {} |
| 40 | 39 |
| 41 // Called when the adapter's Discovering property changes. | 40 // Called when the adapter's Discovering property changes. |
| 42 virtual void DiscoveringPropertyChanged(const dbus::ObjectPath& object_path, | 41 virtual void DiscoveringPropertyChanged(const std::string& object_path, |
| 43 bool discovering) {} | 42 bool discovering) {} |
| 44 | 43 |
| 45 // Called when a new remote device has been discovered. | 44 // Called when a new remote device has been discovered. |
| 46 // |device_properties| should be copied if needed. | 45 // |device_properties| should be copied if needed. |
| 47 virtual void DeviceFound(const dbus::ObjectPath& object_path, | 46 virtual void DeviceFound(const std::string& object_path, |
| 48 const std::string& address, | 47 const std::string& address, |
| 49 const DictionaryValue& device_properties) {} | 48 const DictionaryValue& device_properties) {} |
| 50 | 49 |
| 51 // Called when a previously discovered device is no longer visible. | 50 // Called when a previously discovered device is no longer visible. |
| 52 virtual void DeviceDisappeared(const dbus::ObjectPath& object_path, | 51 virtual void DeviceDisappeared(const std::string& object_path, |
| 53 const std::string& address) {} | 52 const std::string& address) {} |
| 54 }; | 53 }; |
| 55 | 54 |
| 56 virtual ~BluetoothAdapterClient(); | 55 virtual ~BluetoothAdapterClient(); |
| 57 | 56 |
| 58 // Adds and removes observers for events on the adapter with object path | 57 // Adds and removes observers for events on the adapter with object path |
| 59 // |object_path|. | 58 // |object_path|. |
| 60 virtual void AddObserver(Observer* observer) = 0; | 59 virtual void AddObserver(Observer* observer) = 0; |
| 61 virtual void RemoveObserver(Observer* observer) = 0; | 60 virtual void RemoveObserver(Observer* observer) = 0; |
| 62 | 61 |
| 63 // Starts a device discovery on the adapter with object path |object_path|. | 62 // Starts a device discovery on the adapter with object path |object_path|. |
| 64 virtual void StartDiscovery(const dbus::ObjectPath& object_path) = 0; | 63 virtual void StartDiscovery(const std::string& object_path) = 0; |
| 65 | 64 |
| 66 // Cancels any previous device discovery on the adapter with object path | 65 // Cancels any previous device discovery on the adapter with object path |
| 67 // |object_path|. | 66 // |object_path|. |
| 68 virtual void StopDiscovery(const dbus::ObjectPath& object_path) = 0; | 67 virtual void StopDiscovery(const std::string& object_path) = 0; |
| 69 | 68 |
| 70 // Creates the instance. | 69 // Creates the instance. |
| 71 static BluetoothAdapterClient* Create(dbus::Bus* bus, | 70 static BluetoothAdapterClient* Create(dbus::Bus* bus, |
| 72 BluetoothManagerClient* manager_client); | 71 BluetoothManagerClient* manager_client); |
| 73 | 72 |
| 74 protected: | 73 protected: |
| 75 BluetoothAdapterClient(); | 74 BluetoothAdapterClient(); |
| 76 | 75 |
| 77 private: | 76 private: |
| 78 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterClient); | 77 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterClient); |
| 79 }; | 78 }; |
| 80 | 79 |
| 81 } // namespace chromeos | 80 } // namespace chromeos |
| 82 | 81 |
| 83 #endif // CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ | 82 #endif // CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ |
| OLD | NEW |