[shill] Add Profile objects
Add a mostly-empty Profile object and all the wiring to hook it up to DBus
BUG=chromium-os:17154
TEST=unit tests
Change-Id: I16bf488969f071dd91c31ef454c7e10a81f9afe7
Reviewed-on: http://gerrit.chromium.org/gerrit/3423
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
diff --git a/profile_dbus_adaptor.cc b/profile_dbus_adaptor.cc
new file mode 100644
index 0000000..fb7d5e0
--- /dev/null
+++ b/profile_dbus_adaptor.cc
@@ -0,0 +1,80 @@
+// 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/profile_dbus_adaptor.h"
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include <base/logging.h>
+#include <dbus-c++/dbus.h>
+
+#include "shill/error.h"
+#include "shill/profile.h"
+
+using std::map;
+using std::string;
+using std::vector;
+
+namespace shill {
+
+// static
+const char ProfileDBusAdaptor::kInterfaceName[] = SHILL_INTERFACE;
+// static
+const char ProfileDBusAdaptor::kPath[] = "/profile/";
+
+ProfileDBusAdaptor::ProfileDBusAdaptor(DBus::Connection* conn, Profile *profile)
+ : DBusAdaptor(conn, kPath),
+ profile_(profile) {
+}
+
+ProfileDBusAdaptor::~ProfileDBusAdaptor() {
+ profile_ = NULL;
+}
+
+void ProfileDBusAdaptor::EmitBoolChanged(const string &name, bool value) {
+ PropertyChanged(name, DBusAdaptor::BoolToVariant(value));
+}
+
+void ProfileDBusAdaptor::EmitUintChanged(const string &name,
+ uint32 value) {
+ PropertyChanged(name, DBusAdaptor::Uint32ToVariant(value));
+}
+
+void ProfileDBusAdaptor::EmitIntChanged(const string &name, int value) {
+ PropertyChanged(name, DBusAdaptor::Int32ToVariant(value));
+}
+
+void ProfileDBusAdaptor::EmitStringChanged(const string &name,
+ const string &value) {
+ PropertyChanged(name, DBusAdaptor::StringToVariant(value));
+}
+
+map<string, ::DBus::Variant> ProfileDBusAdaptor::GetProperties(
+ ::DBus::Error &error) {
+ map<string, ::DBus::Variant> properties;
+ DBusAdaptor::GetProperties(profile_, &properties, &error);
+ return properties;
+}
+
+void ProfileDBusAdaptor::SetProperty(const string &name,
+ const ::DBus::Variant &value,
+ ::DBus::Error &error) {
+ if (DBusAdaptor::DispatchOnType(profile_, name, value, &error)) {
+ PropertyChanged(name, value);
+ }
+}
+
+map<string, ::DBus::Variant> ProfileDBusAdaptor::GetEntry(
+ const std::string& name,
+ ::DBus::Error &error) {
+ return map<string, ::DBus::Variant>();
+}
+
+void ProfileDBusAdaptor::DeleteEntry(const std::string& name,
+ ::DBus::Error &error) {
+}
+
+} // namespace shill