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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 // ShillDeviceClient is used to communicate with the Shill Device service. | 34 // ShillDeviceClient is used to communicate with the Shill Device service. |
35 // All methods should be called from the origin thread which initializes the | 35 // All methods should be called from the origin thread which initializes the |
36 // DBusThreadManager instance. | 36 // DBusThreadManager instance. |
37 class CHROMEOS_EXPORT ShillDeviceClient { | 37 class CHROMEOS_EXPORT ShillDeviceClient { |
38 public: | 38 public: |
39 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler; | 39 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler; |
40 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback; | 40 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback; |
41 typedef ShillClientHelper::ErrorCallback ErrorCallback; | 41 typedef ShillClientHelper::ErrorCallback ErrorCallback; |
42 | 42 |
| 43 // Interface for setting up devices for testing. |
| 44 // Accessed through GetTestInterface(), only implemented in the Stub Impl. |
| 45 class TestInterface { |
| 46 public: |
| 47 virtual void AddDevice(const std::string& device_path, |
| 48 const std::string& type, |
| 49 const std::string& object_path, |
| 50 const std::string& connection_path) = 0; |
| 51 virtual void RemoveDevice(const std::string& device_path) = 0; |
| 52 virtual void ClearDevices() = 0; |
| 53 |
| 54 protected: |
| 55 ~TestInterface() {} |
| 56 }; |
| 57 |
43 virtual ~ShillDeviceClient(); | 58 virtual ~ShillDeviceClient(); |
44 | 59 |
45 // Factory function, creates a new instance which is owned by the caller. | 60 // Factory function, creates a new instance which is owned by the caller. |
46 // For normal usage, access the singleton via DBusThreadManager::Get(). | 61 // For normal usage, access the singleton via DBusThreadManager::Get(). |
47 static ShillDeviceClient* Create(DBusClientImplementationType type, | 62 static ShillDeviceClient* Create(DBusClientImplementationType type, |
48 dbus::Bus* bus); | 63 dbus::Bus* bus); |
49 | 64 |
50 // Adds a property changed |observer| for the device at |device_path|. | 65 // Adds a property changed |observer| for the device at |device_path|. |
51 virtual void AddPropertyChangedObserver( | 66 virtual void AddPropertyChangedObserver( |
52 const dbus::ObjectPath& device_path, | 67 const dbus::ObjectPath& device_path, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 const base::Closure& callback, | 159 const base::Closure& callback, |
145 const ErrorCallback& error_callback) = 0; | 160 const ErrorCallback& error_callback) = 0; |
146 | 161 |
147 // Calls the SetCarrier method. | 162 // Calls the SetCarrier method. |
148 // |callback| is called after the method call finishes. | 163 // |callback| is called after the method call finishes. |
149 virtual void SetCarrier(const dbus::ObjectPath& device_path, | 164 virtual void SetCarrier(const dbus::ObjectPath& device_path, |
150 const std::string& carrier, | 165 const std::string& carrier, |
151 const base::Closure& callback, | 166 const base::Closure& callback, |
152 const ErrorCallback& error_callback) = 0; | 167 const ErrorCallback& error_callback) = 0; |
153 | 168 |
| 169 // Returns an interface for testing (stub only), or returns NULL. |
| 170 virtual TestInterface* GetTestInterface() = 0; |
| 171 |
154 protected: | 172 protected: |
155 // Create() should be used instead. | 173 // Create() should be used instead. |
156 ShillDeviceClient(); | 174 ShillDeviceClient(); |
157 | 175 |
158 private: | 176 private: |
159 DISALLOW_COPY_AND_ASSIGN(ShillDeviceClient); | 177 DISALLOW_COPY_AND_ASSIGN(ShillDeviceClient); |
160 }; | 178 }; |
161 | 179 |
162 } // namespace chromeos | 180 } // namespace chromeos |
163 | 181 |
164 #endif // CHROMEOS_DBUS_SHILL_DEVICE_CLIENT_H_ | 182 #endif // CHROMEOS_DBUS_SHILL_DEVICE_CLIENT_H_ |
OLD | NEW |