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