Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium OS 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 SHILL_MANAGER_DBUS_ADAPTOR_H_ |
| 6 | #define SHILL_MANAGER_DBUS_ADAPTOR_H_ |
| 7 | |
| 8 | #include <map> |
| 9 | #include <string> |
| 10 | |
| 11 | #include <base/basictypes.h> |
| 12 | |
| 13 | #include "shill/adaptor_interfaces.h" |
| 14 | #include "shill/dbus_adaptor.h" |
| 15 | #include "shill/flimflam-manager.h" |
| 16 | |
| 17 | namespace shill { |
Chris Masone | ec6b18b | 2011-06-08 14:09:10 -0700 | [diff] [blame] | 18 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 19 | class Manager; |
| 20 | |
| 21 | // Subclass of DBusAdaptor for Manager objects |
Chris Masone | ec6b18b | 2011-06-08 14:09:10 -0700 | [diff] [blame] | 22 | // There is a 1:1 mapping between Manager and ManagerDBusAdaptor |
| 23 | // instances. Furthermore, the Manager owns the ManagerDBusAdaptor |
| 24 | // and manages its lifetime, so we're OK with ManagerDBusAdaptor |
| 25 | // having a bare pointer to its owner manager. |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 26 | class ManagerDBusAdaptor : public org::chromium::flimflam::Manager_adaptor, |
| 27 | public DBusAdaptor, |
| 28 | public ManagerAdaptorInterface { |
| 29 | public: |
| 30 | static const char kInterfaceName[]; |
| 31 | static const char kPath[]; |
| 32 | |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 33 | ManagerDBusAdaptor(DBus::Connection *conn, Manager *manager); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 34 | virtual ~ManagerDBusAdaptor(); |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 35 | |
| 36 | // Implementation of ManagerAdaptorInterface. |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 37 | void UpdateRunning(); |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 38 | void EmitBoolChanged(const std::string& name, bool value); |
| 39 | void EmitUintChanged(const std::string& name, uint32 value); |
| 40 | void EmitIntChanged(const std::string& name, int value); |
| 41 | void EmitStringChanged(const std::string& name, const std::string& value); |
| 42 | void EmitStateChanged(const std::string& new_state); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 43 | |
| 44 | // Implementation of Manager_adaptor |
| 45 | std::map<std::string, ::DBus::Variant> GetProperties(::DBus::Error &error); |
| 46 | void SetProperty(const std::string& name, |
| 47 | const ::DBus::Variant& value, |
| 48 | ::DBus::Error &error); |
| 49 | std::string GetState(::DBus::Error &error); |
| 50 | ::DBus::Path CreateProfile(const std::string& name, ::DBus::Error &error); |
Chris Masone | ccc8881 | 2011-06-08 18:00:10 -0700 | [diff] [blame^] | 51 | void RemoveProfile(const std::string& name, ::DBus::Error &error); |
| 52 | ::DBus::Path PushProfile(const std::string& , ::DBus::Error &error); |
| 53 | void PopProfile(const std::string& , ::DBus::Error &error); |
| 54 | void PopAnyProfile(::DBus::Error &error); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 55 | void RequestScan(const std::string& , ::DBus::Error &error); |
| 56 | |
| 57 | void EnableTechnology(const std::string& , ::DBus::Error &error); |
| 58 | void DisableTechnology(const std::string& , ::DBus::Error &error); |
| 59 | |
| 60 | ::DBus::Path GetService(const std::map<std::string, ::DBus::Variant>& , |
| 61 | ::DBus::Error &error); |
| 62 | ::DBus::Path GetWifiService(const std::map<std::string, ::DBus::Variant>& , |
| 63 | ::DBus::Error &error); |
| 64 | void ConfigureWifiService(const std::map<std::string, ::DBus::Variant>& , |
| 65 | ::DBus::Error &error); |
Chris Masone | ccc8881 | 2011-06-08 18:00:10 -0700 | [diff] [blame^] | 66 | ::DBus::Path GetVPNService(const std::map< std::string, ::DBus::Variant>& , |
| 67 | ::DBus::Error &error); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 68 | |
| 69 | void RegisterAgent(const ::DBus::Path& , ::DBus::Error &error); |
| 70 | void UnregisterAgent(const ::DBus::Path& , ::DBus::Error &error); |
| 71 | |
Chris Masone | 7ccc819 | 2011-05-24 14:54:49 -0700 | [diff] [blame] | 72 | int32_t GetDebugLevel(::DBus::Error &error); |
| 73 | void SetDebugLevel(const int32_t& mask, ::DBus::Error &error); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 74 | |
| 75 | std::string GetServiceOrder(::DBus::Error &error); |
| 76 | void SetServiceOrder(const std::string& , ::DBus::Error &error); |
| 77 | |
| 78 | private: |
| 79 | Manager *manager_; |
| 80 | DISALLOW_COPY_AND_ASSIGN(ManagerDBusAdaptor); |
| 81 | }; |
| 82 | |
| 83 | } // namespace shill |
| 84 | #endif // SHILL_MANAGER_DBUS_ADAPTOR_H_ |