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_SERVICE_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_ |
6 #define CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_ | 6 #define CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
31 | 31 |
32 // ShillServiceClient is used to communicate with the Shill Service | 32 // ShillServiceClient is used to communicate with the Shill Service |
33 // service. | 33 // service. |
34 // All methods should be called from the origin thread which initializes the | 34 // All methods should be called from the origin thread which initializes the |
35 // DBusThreadManager instance. | 35 // DBusThreadManager instance. |
36 class CHROMEOS_EXPORT ShillServiceClient { | 36 class CHROMEOS_EXPORT ShillServiceClient { |
37 public: | 37 public: |
38 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler; | 38 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler; |
39 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback; | 39 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback; |
40 typedef ShillClientHelper::ErrorCallback ErrorCallback; | 40 typedef ShillClientHelper::ErrorCallback ErrorCallback; |
41 typedef ShillClientHelper::PropertyChangedObserver PropertyChangedObserver; | |
41 | 42 |
42 virtual ~ShillServiceClient(); | 43 virtual ~ShillServiceClient(); |
43 | 44 |
44 // Factory function, creates a new instance which is owned by the caller. | 45 // Factory function, creates a new instance which is owned by the caller. |
45 // For normal usage, access the singleton via DBusThreadManager::Get(). | 46 // For normal usage, access the singleton via DBusThreadManager::Get(). |
46 static ShillServiceClient* Create(DBusClientImplementationType type, | 47 static ShillServiceClient* Create(DBusClientImplementationType type, |
47 dbus::Bus* bus); | 48 dbus::Bus* bus); |
48 | 49 |
49 // Sets PropertyChanged signal handler. | 50 virtual void AddPropertyChangedObserver( |
hashimoto
2012/09/21 11:52:01
Please add method comments.
Greg Spencer (Chromium)
2012/09/21 22:03:47
Done.
| |
50 virtual void SetPropertyChangedHandler( | |
51 const dbus::ObjectPath& service_path, | 51 const dbus::ObjectPath& service_path, |
52 const PropertyChangedHandler& handler) = 0; | 52 PropertyChangedObserver* observer) = 0; |
53 | 53 |
54 // Resets PropertyChanged signal handler. | 54 virtual void RemovePropertyChangedObserver( |
55 virtual void ResetPropertyChangedHandler( | 55 const dbus::ObjectPath& service_path, |
56 const dbus::ObjectPath& service_path) = 0; | 56 PropertyChangedObserver* observer) = 0; |
57 | 57 |
58 // Calls GetProperties method. | 58 // Calls GetProperties method. |
59 // |callback| is called after the method call succeeds. | 59 // |callback| is called after the method call succeeds. |
60 virtual void GetProperties(const dbus::ObjectPath& service_path, | 60 virtual void GetProperties(const dbus::ObjectPath& service_path, |
61 const DictionaryValueCallback& callback) = 0; | 61 const DictionaryValueCallback& callback) = 0; |
62 | 62 |
63 // Calls SetProperty method. | 63 // Calls SetProperty method. |
64 // |callback| is called after the method call succeeds. | 64 // |callback| is called after the method call succeeds. |
65 virtual void SetProperty(const dbus::ObjectPath& service_path, | 65 virtual void SetProperty(const dbus::ObjectPath& service_path, |
66 const std::string& name, | 66 const std::string& name, |
67 const base::Value& value, | 67 const base::Value& value, |
68 const VoidDBusMethodCallback& callback) = 0; | 68 const base::Closure& callback, |
69 const ErrorCallback& error_callback) = 0; | |
69 | 70 |
70 // Calls ClearProperty method. | 71 // Calls ClearProperty method. |
71 // |callback| is called after the method call succeeds. | 72 // |callback| is called after the method call succeeds. |
72 virtual void ClearProperty(const dbus::ObjectPath& service_path, | 73 virtual void ClearProperty(const dbus::ObjectPath& service_path, |
73 const std::string& name, | 74 const std::string& name, |
74 const VoidDBusMethodCallback& callback) = 0; | 75 const base::Closure& callback, |
76 const ErrorCallback& error_callback) = 0; | |
75 | 77 |
76 // Calls Connect method. | 78 // Calls Connect method. |
77 // |callback| is called after the method call succeeds. | 79 // |callback| is called after the method call succeeds. |
78 virtual void Connect(const dbus::ObjectPath& service_path, | 80 virtual void Connect(const dbus::ObjectPath& service_path, |
79 const base::Closure& callback, | 81 const base::Closure& callback, |
80 const ErrorCallback& error_callback) = 0; | 82 const ErrorCallback& error_callback) = 0; |
81 | 83 |
82 // Calls Disconnect method. | 84 // Calls Disconnect method. |
83 // |callback| is called after the method call succeeds. | 85 // |callback| is called after the method call succeeds. |
84 virtual void Disconnect(const dbus::ObjectPath& service_path, | 86 virtual void Disconnect(const dbus::ObjectPath& service_path, |
85 const VoidDBusMethodCallback& callback) = 0; | 87 const base::Closure& callback, |
88 const ErrorCallback& error_callback) = 0; | |
86 | 89 |
87 // Calls Remove method. | 90 // Calls Remove method. |
88 // |callback| is called after the method call succeeds. | 91 // |callback| is called after the method call succeeds. |
89 virtual void Remove(const dbus::ObjectPath& service_path, | 92 virtual void Remove(const dbus::ObjectPath& service_path, |
90 const VoidDBusMethodCallback& callback) = 0; | 93 const base::Closure& callback, |
94 const ErrorCallback& error_callback) = 0; | |
91 | 95 |
92 // Calls ActivateCellularModem method. | 96 // Calls ActivateCellularModem method. |
93 // |callback| is called after the method call succeeds. | 97 // |callback| is called after the method call succeeds. |
94 virtual void ActivateCellularModem( | 98 virtual void ActivateCellularModem( |
95 const dbus::ObjectPath& service_path, | 99 const dbus::ObjectPath& service_path, |
96 const std::string& carrier, | 100 const std::string& carrier, |
97 const VoidDBusMethodCallback& callback) = 0; | 101 const base::Closure& callback, |
102 const ErrorCallback& error_callback) = 0; | |
98 | 103 |
99 // DEPRECATED DO NOT USE: Calls ActivateCellularModem method and blocks until | 104 // DEPRECATED DO NOT USE: Calls ActivateCellularModem method and blocks until |
100 // the method call finishes. | 105 // the method call finishes. |
101 // | 106 // |
102 // TODO(hashimoto): Refactor CrosActivateCellularModem and remove this method. | 107 // TODO(hashimoto): Refactor CrosActivateCellularModem and remove this method. |
103 // crosbug.com/29902 | 108 // crosbug.com/29902 |
104 virtual bool CallActivateCellularModemAndBlock( | 109 virtual bool CallActivateCellularModemAndBlock( |
105 const dbus::ObjectPath& service_path, | 110 const dbus::ObjectPath& service_path, |
106 const std::string& carrier) = 0; | 111 const std::string& carrier) = 0; |
107 | 112 |
108 protected: | 113 protected: |
109 // Create() should be used instead. | 114 // Create() should be used instead. |
110 ShillServiceClient(); | 115 ShillServiceClient(); |
111 | 116 |
112 private: | 117 private: |
113 DISALLOW_COPY_AND_ASSIGN(ShillServiceClient); | 118 DISALLOW_COPY_AND_ASSIGN(ShillServiceClient); |
114 }; | 119 }; |
115 | 120 |
116 } // namespace chromeos | 121 } // namespace chromeos |
117 | 122 |
118 #endif // CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_ | 123 #endif // CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_ |
OLD | NEW |