[shill] Wire IPConfig objects to dbus
BUG=chromium-os:17154
TEST=unit tests
STATUS=Verified
Change-Id: If4344b1df2806dcff914fe1e79d6f0d7705a6eb3
Reviewed-on: http://gerrit.chromium.org/gerrit/3494
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
diff --git a/ipconfig_dbus_adaptor.cc b/ipconfig_dbus_adaptor.cc
new file mode 100644
index 0000000..edd97cf
--- /dev/null
+++ b/ipconfig_dbus_adaptor.cc
@@ -0,0 +1,86 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "shill/ipconfig_dbus_adaptor.h"
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include <base/logging.h>
+#include <dbus-c++/dbus.h>
+
+#include "shill/error.h"
+#include "shill/ipconfig.h"
+
+using std::map;
+using std::string;
+using std::vector;
+
+namespace shill {
+
+// static
+const char IPConfigDBusAdaptor::kInterfaceName[] = SHILL_INTERFACE;
+// static
+const char IPConfigDBusAdaptor::kPath[] = "/ipconfig/";
+
+IPConfigDBusAdaptor::IPConfigDBusAdaptor(DBus::Connection* conn,
+ IPConfig *config)
+ : DBusAdaptor(conn, kPath),
+ ipconfig_(config) {
+}
+
+IPConfigDBusAdaptor::~IPConfigDBusAdaptor() {
+ ipconfig_ = NULL;
+}
+
+void IPConfigDBusAdaptor::EmitBoolChanged(const string &name, bool value) {
+ PropertyChanged(name, DBusAdaptor::BoolToVariant(value));
+}
+
+void IPConfigDBusAdaptor::EmitUintChanged(const string &name,
+ uint32 value) {
+ PropertyChanged(name, DBusAdaptor::Uint32ToVariant(value));
+}
+
+void IPConfigDBusAdaptor::EmitIntChanged(const string &name, int value) {
+ PropertyChanged(name, DBusAdaptor::Int32ToVariant(value));
+}
+
+void IPConfigDBusAdaptor::EmitStringChanged(const string &name,
+ const string &value) {
+ PropertyChanged(name, DBusAdaptor::StringToVariant(value));
+}
+
+map<string, ::DBus::Variant> IPConfigDBusAdaptor::GetProperties(
+ ::DBus::Error &error) {
+ map<string, ::DBus::Variant> properties;
+ DBusAdaptor::GetProperties(ipconfig_, &properties, &error);
+ return properties;
+}
+
+void IPConfigDBusAdaptor::SetProperty(const string &name,
+ const ::DBus::Variant &value,
+ ::DBus::Error &error) {
+ if (DBusAdaptor::DispatchOnType(ipconfig_, name, value, &error)) {
+ PropertyChanged(name, value);
+ }
+}
+
+void IPConfigDBusAdaptor::ClearProperty(const std::string& name,
+ ::DBus::Error &error) {
+}
+
+void IPConfigDBusAdaptor::Remove(::DBus::Error &error) {
+}
+
+void IPConfigDBusAdaptor::MoveBefore(const ::DBus::Path& path,
+ ::DBus::Error &error) {
+}
+
+void IPConfigDBusAdaptor::MoveAfter(const ::DBus::Path& path,
+ ::DBus::Error &error) {
+}
+
+} // namespace shill