blob: edd97cf5e6180e38794b52d0451ba3fada373e9a [file] [log] [blame]
Chris Masonec6c6c132011-06-30 11:29:52 -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/ipconfig_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/ipconfig.h"
16
17using std::map;
18using std::string;
19using std::vector;
20
21namespace shill {
22
23// static
24const char IPConfigDBusAdaptor::kInterfaceName[] = SHILL_INTERFACE;
25// static
26const char IPConfigDBusAdaptor::kPath[] = "/ipconfig/";
27
28IPConfigDBusAdaptor::IPConfigDBusAdaptor(DBus::Connection* conn,
29 IPConfig *config)
30 : DBusAdaptor(conn, kPath),
31 ipconfig_(config) {
32}
33
34IPConfigDBusAdaptor::~IPConfigDBusAdaptor() {
35 ipconfig_ = NULL;
36}
37
38void IPConfigDBusAdaptor::EmitBoolChanged(const string &name, bool value) {
39 PropertyChanged(name, DBusAdaptor::BoolToVariant(value));
40}
41
42void IPConfigDBusAdaptor::EmitUintChanged(const string &name,
43 uint32 value) {
44 PropertyChanged(name, DBusAdaptor::Uint32ToVariant(value));
45}
46
47void IPConfigDBusAdaptor::EmitIntChanged(const string &name, int value) {
48 PropertyChanged(name, DBusAdaptor::Int32ToVariant(value));
49}
50
51void IPConfigDBusAdaptor::EmitStringChanged(const string &name,
52 const string &value) {
53 PropertyChanged(name, DBusAdaptor::StringToVariant(value));
54}
55
56map<string, ::DBus::Variant> IPConfigDBusAdaptor::GetProperties(
57 ::DBus::Error &error) {
58 map<string, ::DBus::Variant> properties;
59 DBusAdaptor::GetProperties(ipconfig_, &properties, &error);
60 return properties;
61}
62
63void IPConfigDBusAdaptor::SetProperty(const string &name,
64 const ::DBus::Variant &value,
65 ::DBus::Error &error) {
66 if (DBusAdaptor::DispatchOnType(ipconfig_, name, value, &error)) {
67 PropertyChanged(name, value);
68 }
69}
70
71void IPConfigDBusAdaptor::ClearProperty(const std::string& name,
72 ::DBus::Error &error) {
73}
74
75void IPConfigDBusAdaptor::Remove(::DBus::Error &error) {
76}
77
78void IPConfigDBusAdaptor::MoveBefore(const ::DBus::Path& path,
79 ::DBus::Error &error) {
80}
81
82void IPConfigDBusAdaptor::MoveAfter(const ::DBus::Path& path,
83 ::DBus::Error &error) {
84}
85
86} // namespace shill