blob: 6ac46a87413f0be95da98c1c30535554296c5100 [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#include "shill/profile_dbus_adaptor.h"
6
7#include <map>
8#include <string>
9#include <vector>
10
11#include <base/logging.h>
12#include <dbus-c++/dbus.h>
13
14#include "shill/error.h"
15#include "shill/profile.h"
16
17using std::map;
18using std::string;
19using std::vector;
20
21namespace shill {
22
23// static
24const char ProfileDBusAdaptor::kInterfaceName[] = SHILL_INTERFACE;
25// static
26const char ProfileDBusAdaptor::kPath[] = "/profile/";
27
28ProfileDBusAdaptor::ProfileDBusAdaptor(DBus::Connection* conn, Profile *profile)
29 : DBusAdaptor(conn, kPath),
30 profile_(profile) {
31}
32
33ProfileDBusAdaptor::~ProfileDBusAdaptor() {
34 profile_ = NULL;
35}
36
37void ProfileDBusAdaptor::EmitBoolChanged(const string &name, bool value) {
38 PropertyChanged(name, DBusAdaptor::BoolToVariant(value));
39}
40
41void ProfileDBusAdaptor::EmitUintChanged(const string &name,
42 uint32 value) {
43 PropertyChanged(name, DBusAdaptor::Uint32ToVariant(value));
44}
45
46void ProfileDBusAdaptor::EmitIntChanged(const string &name, int value) {
47 PropertyChanged(name, DBusAdaptor::Int32ToVariant(value));
48}
49
50void ProfileDBusAdaptor::EmitStringChanged(const string &name,
51 const string &value) {
52 PropertyChanged(name, DBusAdaptor::StringToVariant(value));
53}
54
55map<string, ::DBus::Variant> ProfileDBusAdaptor::GetProperties(
56 ::DBus::Error &error) {
57 map<string, ::DBus::Variant> properties;
Chris Masone27c4aa52011-07-02 13:10:14 -070058 DBusAdaptor::GetProperties(profile_->store(), &properties, &error);
Chris Masone52cd19b2011-06-29 17:23:04 -070059 return properties;
60}
61
62void ProfileDBusAdaptor::SetProperty(const string &name,
63 const ::DBus::Variant &value,
64 ::DBus::Error &error) {
Chris Masone27c4aa52011-07-02 13:10:14 -070065 if (DBusAdaptor::DispatchOnType(profile_->store(), name, value, &error)) {
Chris Masone52cd19b2011-06-29 17:23:04 -070066 PropertyChanged(name, value);
67 }
68}
69
70map<string, ::DBus::Variant> ProfileDBusAdaptor::GetEntry(
71 const std::string& name,
72 ::DBus::Error &error) {
73 return map<string, ::DBus::Variant>();
74}
75
76void ProfileDBusAdaptor::DeleteEntry(const std::string& name,
77 ::DBus::Error &error) {
78}
79
80} // namespace shill