blob: 92bc4506d03bb3e1caed94fe6a67d3f71d884a24 [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:
33 static const char kInterfaceName[];
34 static const char kPath[];
35
36 ProfileDBusAdaptor(DBus::Connection *conn, Profile *profile);
37 virtual ~ProfileDBusAdaptor();
38
39 // Implementation of ProfileAdaptorInterface.
Chris Masonec6c6c132011-06-30 11:29:52 -070040 virtual const std::string &GetRpcIdentifier() { return path(); }
41 virtual void EmitBoolChanged(const std::string &name, bool value);
42 virtual void EmitUintChanged(const std::string &name, uint32 value);
43 virtual void EmitIntChanged(const std::string &name, int value);
44 virtual void EmitStringChanged(const std::string &name,
45 const std::string &value);
Chris Masone52cd19b2011-06-29 17:23:04 -070046
47 // Implementation of Profile_adaptor
Chris Masonec6c6c132011-06-30 11:29:52 -070048 virtual std::map<std::string, ::DBus::Variant> GetProperties(
49 ::DBus::Error &error);
50 virtual void SetProperty(const std::string &name,
51 const ::DBus::Variant &value,
52 ::DBus::Error &error);
Chris Masone52cd19b2011-06-29 17:23:04 -070053
54 // Gets an "Entry", which is apparently a different set of properties than
55 // those returned by GetProperties.
Chris Masonec6c6c132011-06-30 11:29:52 -070056 virtual std::map< std::string, ::DBus::Variant> GetEntry(
57 const std::string& ,
58 ::DBus::Error &error);
Chris Masone52cd19b2011-06-29 17:23:04 -070059
60 // Deletes an Entry.
Chris Masonec6c6c132011-06-30 11:29:52 -070061 virtual void DeleteEntry(const std::string& , ::DBus::Error &error);
Chris Masone52cd19b2011-06-29 17:23:04 -070062
63 private:
64 Profile *profile_;
65 DISALLOW_COPY_AND_ASSIGN(ProfileDBusAdaptor);
66};
67
68} // namespace shill
69#endif // SHILL_PROFILE_DBUS_ADAPTOR_H_