blob: f885d9bdf331c33e145888d72e214a988f4e218f [file] [log] [blame]
Chris Masone52cd19b2011-06-29 17:23:04 -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_PROFILE_DBUS_ADAPTOR_H_
6#define SHILL_PROFILE_DBUS_ADAPTOR_H_
7
8#include <map>
9#include <string>
10
11#include <base/basictypes.h>
12#include <dbus-c++/dbus.h>
13
14#include "shill/adaptor_interfaces.h"
15#include "shill/dbus_adaptor.h"
Darin Petkov4a09b6b2011-07-19 12:52:06 -070016#include "shill/dbus_bindings/flimflam-profile.h"
Chris Masone52cd19b2011-06-29 17:23:04 -070017
18namespace shill {
19
20class Profile;
21
22// Subclass of DBusAdaptor for Profile objects
23// There is a 1:1 mapping between Profile and ProfileDBusAdaptor
24// instances. Furthermore, the Profile owns the ProfileDBusAdaptor
25// and manages its lifetime, so we're OK with ProfileDBusAdaptor
26// having a bare pointer to its owner profile.
27//
28// A Profile is a collection of Entry structures (which we will define later).
29class ProfileDBusAdaptor : public org::chromium::flimflam::Profile_adaptor,
30 public DBusAdaptor,
31 public ProfileAdaptorInterface {
32 public:
Chris Masone52cd19b2011-06-29 17:23:04 -070033 static const char kPath[];
34
35 ProfileDBusAdaptor(DBus::Connection *conn, Profile *profile);
36 virtual ~ProfileDBusAdaptor();
37
38 // Implementation of ProfileAdaptorInterface.
Chris Masonec6c6c132011-06-30 11:29:52 -070039 virtual const std::string &GetRpcIdentifier() { return path(); }
40 virtual void EmitBoolChanged(const std::string &name, bool value);
41 virtual void EmitUintChanged(const std::string &name, uint32 value);
42 virtual void EmitIntChanged(const std::string &name, int value);
43 virtual void EmitStringChanged(const std::string &name,
44 const std::string &value);
Chris Masone52cd19b2011-06-29 17:23:04 -070045
46 // Implementation of Profile_adaptor
Chris Masonec6c6c132011-06-30 11:29:52 -070047 virtual std::map<std::string, ::DBus::Variant> GetProperties(
48 ::DBus::Error &error);
49 virtual void SetProperty(const std::string &name,
50 const ::DBus::Variant &value,
51 ::DBus::Error &error);
Chris Masone52cd19b2011-06-29 17:23:04 -070052
53 // Gets an "Entry", which is apparently a different set of properties than
54 // those returned by GetProperties.
Chris Masonec6c6c132011-06-30 11:29:52 -070055 virtual std::map< std::string, ::DBus::Variant> GetEntry(
56 const std::string& ,
57 ::DBus::Error &error);
Chris Masone52cd19b2011-06-29 17:23:04 -070058
59 // Deletes an Entry.
Chris Masonec6c6c132011-06-30 11:29:52 -070060 virtual void DeleteEntry(const std::string& , ::DBus::Error &error);
Chris Masone52cd19b2011-06-29 17:23:04 -070061
62 private:
63 Profile *profile_;
64 DISALLOW_COPY_AND_ASSIGN(ProfileDBusAdaptor);
65};
66
67} // namespace shill
68#endif // SHILL_PROFILE_DBUS_ADAPTOR_H_