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