blob: 6a9e0e4a482998279d762f4b1a0f455d3b9fb8e8 [file] [log] [blame]
Chris Masoned7732e42011-05-20 11:08:56 -07001// 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>
Chris Masone8fe2c7e2011-06-09 15:51:19 -070012#include <dbus-c++/dbus.h>
Chris Masoned7732e42011-05-20 11:08:56 -070013
14#include "shill/adaptor_interfaces.h"
15#include "shill/dbus_adaptor.h"
16#include "shill/flimflam-manager.h"
17
18namespace shill {
Chris Masoneec6b18b2011-06-08 14:09:10 -070019
Chris Masoned7732e42011-05-20 11:08:56 -070020class Manager;
21
22// Subclass of DBusAdaptor for Manager objects
Chris Masoneec6b18b2011-06-08 14:09:10 -070023// 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 Masoned7732e42011-05-20 11:08:56 -070027class ManagerDBusAdaptor : public org::chromium::flimflam::Manager_adaptor,
28 public DBusAdaptor,
29 public ManagerAdaptorInterface {
30 public:
31 static const char kInterfaceName[];
32 static const char kPath[];
33
Chris Masoned0ceb8c2011-06-02 10:05:39 -070034 ManagerDBusAdaptor(DBus::Connection *conn, Manager *manager);
Chris Masoned7732e42011-05-20 11:08:56 -070035 virtual ~ManagerDBusAdaptor();
Chris Masoned0ceb8c2011-06-02 10:05:39 -070036
37 // Implementation of ManagerAdaptorInterface.
Chris Masoned7732e42011-05-20 11:08:56 -070038 void UpdateRunning();
Chris Masone8fe2c7e2011-06-09 15:51:19 -070039 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);
43 void EmitStateChanged(const std::string &new_state);
Chris Masoned7732e42011-05-20 11:08:56 -070044
45 // Implementation of Manager_adaptor
46 std::map<std::string, ::DBus::Variant> GetProperties(::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070047 void SetProperty(const std::string &name,
48 const ::DBus::Variant &value,
Chris Masoned7732e42011-05-20 11:08:56 -070049 ::DBus::Error &error);
50 std::string GetState(::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070051 ::DBus::Path CreateProfile(const std::string &name, ::DBus::Error &error);
52 void RemoveProfile(const std::string &name, ::DBus::Error &error);
53 ::DBus::Path PushProfile(const std::string &, ::DBus::Error &error);
54 void PopProfile(const std::string &, ::DBus::Error &error);
Chris Masoneccc88812011-06-08 18:00:10 -070055 void PopAnyProfile(::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070056 void RequestScan(const std::string &, ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070057
Chris Masone8fe2c7e2011-06-09 15:51:19 -070058 void EnableTechnology(const std::string &, ::DBus::Error &error);
59 void DisableTechnology(const std::string &, ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070060
Chris Masone8fe2c7e2011-06-09 15:51:19 -070061 ::DBus::Path GetService(const std::map<std::string, ::DBus::Variant> &,
Chris Masoned7732e42011-05-20 11:08:56 -070062 ::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070063 ::DBus::Path GetWifiService(const std::map<std::string, ::DBus::Variant> &,
Chris Masoned7732e42011-05-20 11:08:56 -070064 ::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070065 void ConfigureWifiService(const std::map<std::string, ::DBus::Variant> &,
Chris Masoned7732e42011-05-20 11:08:56 -070066 ::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070067 ::DBus::Path GetVPNService(const std::map< std::string, ::DBus::Variant> &,
Chris Masoneccc88812011-06-08 18:00:10 -070068 ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070069
Chris Masone8fe2c7e2011-06-09 15:51:19 -070070 void RegisterAgent(const ::DBus::Path &, ::DBus::Error &error);
71 void UnregisterAgent(const ::DBus::Path &, ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070072
Chris Masone7ccc8192011-05-24 14:54:49 -070073 int32_t GetDebugLevel(::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070074 void SetDebugLevel(const int32_t &level, ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070075
76 std::string GetServiceOrder(::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070077 void SetServiceOrder(const std::string &, ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070078
79 private:
80 Manager *manager_;
81 DISALLOW_COPY_AND_ASSIGN(ManagerDBusAdaptor);
82};
83
84} // namespace shill
85#endif // SHILL_MANAGER_DBUS_ADAPTOR_H_