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 CHROMEOS_DBUS_SHILL_DEVICE_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_SHILL_DEVICE_CLIENT_H_ |
6 #define CHROMEOS_DBUS_SHILL_DEVICE_CLIENT_H_ | 6 #define CHROMEOS_DBUS_SHILL_DEVICE_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 19 matching lines...) Expand all Loading... | |
30 namespace chromeos { | 30 namespace chromeos { |
31 | 31 |
32 // ShillDeviceClient is used to communicate with the Shill Device service. | 32 // ShillDeviceClient is used to communicate with the Shill Device service. |
33 // All methods should be called from the origin thread which initializes the | 33 // All methods should be called from the origin thread which initializes the |
34 // DBusThreadManager instance. | 34 // DBusThreadManager instance. |
35 class CHROMEOS_EXPORT ShillDeviceClient { | 35 class CHROMEOS_EXPORT ShillDeviceClient { |
36 public: | 36 public: |
37 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler; | 37 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler; |
38 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback; | 38 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback; |
39 typedef ShillClientHelper::ErrorCallback ErrorCallback; | 39 typedef ShillClientHelper::ErrorCallback ErrorCallback; |
40 typedef ShillClientHelper::PropertyChangedObserver PropertyChangedObserver; | |
40 | 41 |
41 virtual ~ShillDeviceClient(); | 42 virtual ~ShillDeviceClient(); |
42 | 43 |
43 // Factory function, creates a new instance which is owned by the caller. | 44 // Factory function, creates a new instance which is owned by the caller. |
44 // For normal usage, access the singleton via DBusThreadManager::Get(). | 45 // For normal usage, access the singleton via DBusThreadManager::Get(). |
45 static ShillDeviceClient* Create(DBusClientImplementationType type, | 46 static ShillDeviceClient* Create(DBusClientImplementationType type, |
46 dbus::Bus* bus); | 47 dbus::Bus* bus); |
47 | 48 |
48 // Sets PropertyChanged signal handler. | 49 virtual void AddPropertyChangedObserver( |
hashimoto
2012/09/21 11:52:01
Please add method comments.
Greg Spencer (Chromium)
2012/09/21 22:03:47
Done.
| |
49 virtual void SetPropertyChangedHandler( | |
50 const dbus::ObjectPath& device_path, | 50 const dbus::ObjectPath& device_path, |
51 const PropertyChangedHandler& handler) = 0; | 51 PropertyChangedObserver* observer) = 0; |
52 | 52 |
53 // Resets PropertyChanged signal handler. | 53 virtual void RemovePropertyChangedObserver( |
54 virtual void ResetPropertyChangedHandler( | 54 const dbus::ObjectPath& device_path, |
55 const dbus::ObjectPath& device_path) = 0; | 55 PropertyChangedObserver* observer) = 0; |
56 | 56 |
57 // Calls GetProperties method. | 57 // Calls GetProperties method. |
58 // |callback| is called after the method call finishes. | 58 // |callback| is called after the method call finishes. |
59 virtual void GetProperties(const dbus::ObjectPath& device_path, | 59 virtual void GetProperties(const dbus::ObjectPath& device_path, |
60 const DictionaryValueCallback& callback) = 0; | 60 const DictionaryValueCallback& callback) = 0; |
61 | 61 |
62 // DEPRECATED DO NOT USE: Calls GetProperties method and blocks until the | 62 // DEPRECATED DO NOT USE: Calls GetProperties method and blocks until the |
63 // method call finishes. The caller is responsible to delete the result. | 63 // method call finishes. The caller is responsible to delete the result. |
64 // Thie method returns NULL when method call fails. | 64 // Thie method returns NULL when method call fails. |
65 // | 65 // |
66 // TODO(hashimoto): Refactor CrosGetDeviceNetworkList and remove this method. | 66 // TODO(hashimoto): Refactor CrosGetDeviceNetworkList and remove this method. |
67 // crosbug.com/29902 | 67 // crosbug.com/29902 |
68 virtual base::DictionaryValue* CallGetPropertiesAndBlock( | 68 virtual base::DictionaryValue* CallGetPropertiesAndBlock( |
69 const dbus::ObjectPath& device_path) = 0; | 69 const dbus::ObjectPath& device_path) = 0; |
70 | 70 |
71 // Calls ProposeScan method. | 71 // Calls ProposeScan method. |
72 // |callback| is called after the method call finishes. | 72 // |callback| is called after the method call finishes. |
73 virtual void ProposeScan(const dbus::ObjectPath& device_path, | 73 virtual void ProposeScan(const dbus::ObjectPath& device_path, |
74 const VoidDBusMethodCallback& callback) = 0; | 74 const VoidDBusMethodCallback& callback) = 0; |
75 | 75 |
76 // Calls SetProperty method. | 76 // Calls SetProperty method. |
77 // |callback| is called after the method call finishes. | 77 // |callback| is called after the method call finishes. |
78 virtual void SetProperty(const dbus::ObjectPath& device_path, | 78 virtual void SetProperty(const dbus::ObjectPath& device_path, |
79 const std::string& name, | 79 const std::string& name, |
80 const base::Value& value, | 80 const base::Value& value, |
81 const VoidDBusMethodCallback& callback) = 0; | 81 const base::Closure& callback, |
82 const ErrorCallback& error_callback) = 0; | |
82 | 83 |
83 // Calls ClearProperty method. | 84 // Calls ClearProperty method. |
84 // |callback| is called after the method call finishes. | 85 // |callback| is called after the method call finishes. |
85 virtual void ClearProperty(const dbus::ObjectPath& device_path, | 86 virtual void ClearProperty(const dbus::ObjectPath& device_path, |
86 const std::string& name, | 87 const std::string& name, |
87 const VoidDBusMethodCallback& callback) = 0; | 88 const VoidDBusMethodCallback& callback) = 0; |
88 | 89 |
89 // Calls AddIPConfig method. | 90 // Calls AddIPConfig method. |
90 // |callback| is called after the method call finishes. | 91 // |callback| is called after the method call finishes. |
91 virtual void AddIPConfig(const dbus::ObjectPath& device_path, | 92 virtual void AddIPConfig(const dbus::ObjectPath& device_path, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 // Create() should be used instead. | 145 // Create() should be used instead. |
145 ShillDeviceClient(); | 146 ShillDeviceClient(); |
146 | 147 |
147 private: | 148 private: |
148 DISALLOW_COPY_AND_ASSIGN(ShillDeviceClient); | 149 DISALLOW_COPY_AND_ASSIGN(ShillDeviceClient); |
149 }; | 150 }; |
150 | 151 |
151 } // namespace chromeos | 152 } // namespace chromeos |
152 | 153 |
153 #endif // CHROMEOS_DBUS_SHILL_DEVICE_CLIENT_H_ | 154 #endif // CHROMEOS_DBUS_SHILL_DEVICE_CLIENT_H_ |
OLD | NEW |