Elly Jones | 16227d3 | 2012-02-09 14:17:25 -0500 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 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> |
Chris Masone | 8fe2c7e | 2011-06-09 15:51:19 -0700 | [diff] [blame] | 12 | #include <dbus-c++/dbus.h> |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 13 | |
| 14 | #include "shill/adaptor_interfaces.h" |
| 15 | #include "shill/dbus_adaptor.h" |
Darin Petkov | 4a09b6b | 2011-07-19 12:52:06 -0700 | [diff] [blame] | 16 | #include "shill/dbus_bindings/flimflam-manager.h" |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 17 | |
| 18 | namespace shill { |
Chris Masone | ec6b18b | 2011-06-08 14:09:10 -0700 | [diff] [blame] | 19 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 20 | class Manager; |
| 21 | |
| 22 | // Subclass of DBusAdaptor for Manager objects |
Chris Masone | ec6b18b | 2011-06-08 14:09:10 -0700 | [diff] [blame] | 23 | // There is a 1:1 mapping between Manager and ManagerDBusAdaptor |
| 24 | // instances. Furthermore, the Manager owns the ManagerDBusAdaptor |
| 25 | // and manages its lifetime, so we're OK with ManagerDBusAdaptor |
| 26 | // having a bare pointer to its owner manager. |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 27 | class ManagerDBusAdaptor : public org::chromium::flimflam::Manager_adaptor, |
| 28 | public DBusAdaptor, |
| 29 | public ManagerAdaptorInterface { |
| 30 | public: |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 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 | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 37 | virtual const std::string &GetRpcIdentifier() { return path(); } |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 38 | void UpdateRunning(); |
Chris Masone | 8fe2c7e | 2011-06-09 15:51:19 -0700 | [diff] [blame] | 39 | void EmitBoolChanged(const std::string &name, bool value); |
| 40 | void EmitUintChanged(const std::string &name, uint32 value); |
| 41 | void EmitIntChanged(const std::string &name, int value); |
| 42 | void EmitStringChanged(const std::string &name, const std::string &value); |
Gaurav Shah | 435de2c | 2011-11-17 19:01:07 -0800 | [diff] [blame] | 43 | void EmitStringsChanged(const std::string &name, |
| 44 | const std::vector<std::string> &value); |
Paul Stewart | 49739c0 | 2012-08-08 17:24:03 -0700 | [diff] [blame] | 45 | void EmitRpcIdentifierChanged( |
| 46 | const std::string &name, const std::string &value); |
mukesh agrawal | 3239932 | 2011-09-01 10:53:43 -0700 | [diff] [blame] | 47 | void EmitRpcIdentifierArrayChanged( |
| 48 | const std::string &name, const std::vector<std::string> &value); |
Chris Masone | 8fe2c7e | 2011-06-09 15:51:19 -0700 | [diff] [blame] | 49 | void EmitStateChanged(const std::string &new_state); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 50 | |
| 51 | // Implementation of Manager_adaptor |
| 52 | std::map<std::string, ::DBus::Variant> GetProperties(::DBus::Error &error); |
Chris Masone | 8fe2c7e | 2011-06-09 15:51:19 -0700 | [diff] [blame] | 53 | void SetProperty(const std::string &name, |
| 54 | const ::DBus::Variant &value, |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 55 | ::DBus::Error &error); |
| 56 | std::string GetState(::DBus::Error &error); |
Chris Masone | 8fe2c7e | 2011-06-09 15:51:19 -0700 | [diff] [blame] | 57 | ::DBus::Path CreateProfile(const std::string &name, ::DBus::Error &error); |
| 58 | void RemoveProfile(const std::string &name, ::DBus::Error &error); |
| 59 | ::DBus::Path PushProfile(const std::string &, ::DBus::Error &error); |
| 60 | void PopProfile(const std::string &, ::DBus::Error &error); |
Chris Masone | ccc8881 | 2011-06-08 18:00:10 -0700 | [diff] [blame] | 61 | void PopAnyProfile(::DBus::Error &error); |
Paul Stewart | c681fa0 | 2012-03-02 19:40:04 -0800 | [diff] [blame] | 62 | void RecheckPortal(::DBus::Error &error); |
Chris Masone | 8fe2c7e | 2011-06-09 15:51:19 -0700 | [diff] [blame] | 63 | void RequestScan(const std::string &, ::DBus::Error &error); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 64 | |
Chris Masone | 8fe2c7e | 2011-06-09 15:51:19 -0700 | [diff] [blame] | 65 | void EnableTechnology(const std::string &, ::DBus::Error &error); |
| 66 | void DisableTechnology(const std::string &, ::DBus::Error &error); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 67 | |
Darin Petkov | b65c245 | 2012-02-23 15:17:06 +0100 | [diff] [blame] | 68 | ::DBus::Path GetService(const std::map<std::string, ::DBus::Variant> &args, |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 69 | ::DBus::Error &error); |
Darin Petkov | b65c245 | 2012-02-23 15:17:06 +0100 | [diff] [blame] | 70 | ::DBus::Path GetVPNService(const std::map<std::string, ::DBus::Variant> &args, |
| 71 | ::DBus::Error &error); |
| 72 | ::DBus::Path GetWifiService( |
| 73 | const std::map<std::string, ::DBus::Variant> &args, |
| 74 | ::DBus::Error &error); |
Paul Stewart | 7f61e52 | 2012-03-22 11:13:45 -0700 | [diff] [blame] | 75 | void ConfigureService(const std::map<std::string, ::DBus::Variant> &args, |
| 76 | ::DBus::Error &error); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 77 | |
Chris Masone | 7ccc819 | 2011-05-24 14:54:49 -0700 | [diff] [blame] | 78 | int32_t GetDebugLevel(::DBus::Error &error); |
Chris Masone | 8fe2c7e | 2011-06-09 15:51:19 -0700 | [diff] [blame] | 79 | void SetDebugLevel(const int32_t &level, ::DBus::Error &error); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 80 | |
| 81 | std::string GetServiceOrder(::DBus::Error &error); |
Chris Masone | 8fe2c7e | 2011-06-09 15:51:19 -0700 | [diff] [blame] | 82 | void SetServiceOrder(const std::string &, ::DBus::Error &error); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 83 | |
Elly Jones | 16227d3 | 2012-02-09 14:17:25 -0500 | [diff] [blame] | 84 | std::string GetDebugTags(::DBus::Error &error); |
| 85 | void SetDebugTags(const std::string &tags, ::DBus::Error &error); |
| 86 | std::string ListDebugTags(::DBus::Error &error); |
| 87 | |
Gaurav Shah | 645bff8 | 2012-10-08 14:06:04 -0700 | [diff] [blame] | 88 | std::map<std::string, ::DBus::Variant> GetNetworksForGeolocation( |
| 89 | ::DBus::Error &error); |
| 90 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 91 | private: |
| 92 | Manager *manager_; |
| 93 | DISALLOW_COPY_AND_ASSIGN(ManagerDBusAdaptor); |
| 94 | }; |
| 95 | |
| 96 | } // namespace shill |
| 97 | #endif // SHILL_MANAGER_DBUS_ADAPTOR_H_ |