| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROMEOS_DBUS_FLIMFLAM_DEVICE_CLIENT_H_ | |
| 6 #define CHROMEOS_DBUS_FLIMFLAM_DEVICE_CLIENT_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/callback.h" | |
| 12 #include "chromeos/chromeos_export.h" | |
| 13 #include "chromeos/dbus/dbus_client_implementation_type.h" | |
| 14 #include "chromeos/dbus/flimflam_client_helper.h" | |
| 15 | |
| 16 namespace base { | |
| 17 | |
| 18 class Value; | |
| 19 class DictionaryValue; | |
| 20 | |
| 21 } // namespace base | |
| 22 | |
| 23 namespace dbus { | |
| 24 | |
| 25 class Bus; | |
| 26 class ObjectPath; | |
| 27 | |
| 28 } // namespace dbus | |
| 29 | |
| 30 namespace chromeos { | |
| 31 | |
| 32 // FlimflamDeviceClient is used to communicate with the Flimflam Device service. | |
| 33 // All methods should be called from the origin thread which initializes the | |
| 34 // DBusThreadManager instance. | |
| 35 class CHROMEOS_EXPORT FlimflamDeviceClient { | |
| 36 public: | |
| 37 typedef FlimflamClientHelper::PropertyChangedHandler PropertyChangedHandler; | |
| 38 typedef FlimflamClientHelper::DictionaryValueCallback DictionaryValueCallback; | |
| 39 typedef FlimflamClientHelper::ErrorCallback ErrorCallback; | |
| 40 | |
| 41 virtual ~FlimflamDeviceClient(); | |
| 42 | |
| 43 // Factory function, creates a new instance which is owned by the caller. | |
| 44 // For normal usage, access the singleton via DBusThreadManager::Get(). | |
| 45 static FlimflamDeviceClient* Create(DBusClientImplementationType type, | |
| 46 dbus::Bus* bus); | |
| 47 | |
| 48 // Sets PropertyChanged signal handler. | |
| 49 virtual void SetPropertyChangedHandler( | |
| 50 const dbus::ObjectPath& device_path, | |
| 51 const PropertyChangedHandler& handler) = 0; | |
| 52 | |
| 53 // Resets PropertyChanged signal handler. | |
| 54 virtual void ResetPropertyChangedHandler( | |
| 55 const dbus::ObjectPath& device_path) = 0; | |
| 56 | |
| 57 // Calls GetProperties method. | |
| 58 // |callback| is called after the method call finishes. | |
| 59 virtual void GetProperties(const dbus::ObjectPath& device_path, | |
| 60 const DictionaryValueCallback& callback) = 0; | |
| 61 | |
| 62 // DEPRECATED DO NOT USE: Calls GetProperties method and blocks until the | |
| 63 // method call finishes. The caller is responsible to delete the result. | |
| 64 // Thie method returns NULL when method call fails. | |
| 65 // | |
| 66 // TODO(hashimoto): Refactor CrosGetDeviceNetworkList and remove this method. | |
| 67 // crosbug.com/29902 | |
| 68 virtual base::DictionaryValue* CallGetPropertiesAndBlock( | |
| 69 const dbus::ObjectPath& device_path) = 0; | |
| 70 | |
| 71 // Calls ProposeScan method. | |
| 72 // |callback| is called after the method call finishes. | |
| 73 virtual void ProposeScan(const dbus::ObjectPath& device_path, | |
| 74 const VoidDBusMethodCallback& callback) = 0; | |
| 75 | |
| 76 // Calls SetProperty method. | |
| 77 // |callback| is called after the method call finishes. | |
| 78 virtual void SetProperty(const dbus::ObjectPath& device_path, | |
| 79 const std::string& name, | |
| 80 const base::Value& value, | |
| 81 const VoidDBusMethodCallback& callback) = 0; | |
| 82 | |
| 83 // Calls ClearProperty method. | |
| 84 // |callback| is called after the method call finishes. | |
| 85 virtual void ClearProperty(const dbus::ObjectPath& device_path, | |
| 86 const std::string& name, | |
| 87 const VoidDBusMethodCallback& callback) = 0; | |
| 88 | |
| 89 // Calls AddIPConfig method. | |
| 90 // |callback| is called after the method call finishes. | |
| 91 virtual void AddIPConfig(const dbus::ObjectPath& device_path, | |
| 92 const std::string& method, | |
| 93 const ObjectPathDBusMethodCallback& callback) = 0; | |
| 94 | |
| 95 // DEPRECATED DO NOT USE: Calls AddIPConfig method and blocks until the method | |
| 96 // call finishes. | |
| 97 // This method returns an empty path when method call fails. | |
| 98 // | |
| 99 // TODO(hashimoto): Refactor CrosAddIPConfig and remove this method. | |
| 100 // crosbug.com/29902 | |
| 101 virtual dbus::ObjectPath CallAddIPConfigAndBlock( | |
| 102 const dbus::ObjectPath& device_path, | |
| 103 const std::string& method) = 0; | |
| 104 | |
| 105 // Calls RequirePin method. | |
| 106 // |callback| is called after the method call finishes. | |
| 107 virtual void RequirePin(const dbus::ObjectPath& device_path, | |
| 108 const std::string& pin, | |
| 109 bool require, | |
| 110 const base::Closure& callback, | |
| 111 const ErrorCallback& error_callback) = 0; | |
| 112 | |
| 113 // Calls EnterPin method. | |
| 114 // |callback| is called after the method call finishes. | |
| 115 virtual void EnterPin(const dbus::ObjectPath& device_path, | |
| 116 const std::string& pin, | |
| 117 const base::Closure& callback, | |
| 118 const ErrorCallback& error_callback) = 0; | |
| 119 | |
| 120 // Calls UnblockPin method. | |
| 121 // |callback| is called after the method call finishes. | |
| 122 virtual void UnblockPin(const dbus::ObjectPath& device_path, | |
| 123 const std::string& puk, | |
| 124 const std::string& pin, | |
| 125 const base::Closure& callback, | |
| 126 const ErrorCallback& error_callback) = 0; | |
| 127 | |
| 128 // Calls ChangePin method. | |
| 129 // |callback| is called after the method call finishes. | |
| 130 virtual void ChangePin(const dbus::ObjectPath& device_path, | |
| 131 const std::string& old_pin, | |
| 132 const std::string& new_pin, | |
| 133 const base::Closure& callback, | |
| 134 const ErrorCallback& error_callback) = 0; | |
| 135 | |
| 136 // Calls Register method. | |
| 137 // |callback| is called after the method call finishes. | |
| 138 virtual void Register(const dbus::ObjectPath& device_path, | |
| 139 const std::string& network_id, | |
| 140 const base::Closure& callback, | |
| 141 const ErrorCallback& error_callback) = 0; | |
| 142 | |
| 143 protected: | |
| 144 // Create() should be used instead. | |
| 145 FlimflamDeviceClient(); | |
| 146 | |
| 147 private: | |
| 148 DISALLOW_COPY_AND_ASSIGN(FlimflamDeviceClient); | |
| 149 }; | |
| 150 | |
| 151 } // namespace chromeos | |
| 152 | |
| 153 #endif // CHROMEOS_DBUS_FLIMFLAM_DEVICE_CLIENT_H_ | |
| OLD | NEW |