Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame^] | 1 | // 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 | |
| 17 | using std::map; |
| 18 | using std::string; |
| 19 | using std::vector; |
| 20 | |
| 21 | namespace shill { |
| 22 | |
| 23 | // static |
| 24 | const char IPConfigDBusAdaptor::kInterfaceName[] = SHILL_INTERFACE; |
| 25 | // static |
| 26 | const char IPConfigDBusAdaptor::kPath[] = "/ipconfig/"; |
| 27 | |
| 28 | IPConfigDBusAdaptor::IPConfigDBusAdaptor(DBus::Connection* conn, |
| 29 | IPConfig *config) |
| 30 | : DBusAdaptor(conn, kPath), |
| 31 | ipconfig_(config) { |
| 32 | } |
| 33 | |
| 34 | IPConfigDBusAdaptor::~IPConfigDBusAdaptor() { |
| 35 | ipconfig_ = NULL; |
| 36 | } |
| 37 | |
| 38 | void IPConfigDBusAdaptor::EmitBoolChanged(const string &name, bool value) { |
| 39 | PropertyChanged(name, DBusAdaptor::BoolToVariant(value)); |
| 40 | } |
| 41 | |
| 42 | void IPConfigDBusAdaptor::EmitUintChanged(const string &name, |
| 43 | uint32 value) { |
| 44 | PropertyChanged(name, DBusAdaptor::Uint32ToVariant(value)); |
| 45 | } |
| 46 | |
| 47 | void IPConfigDBusAdaptor::EmitIntChanged(const string &name, int value) { |
| 48 | PropertyChanged(name, DBusAdaptor::Int32ToVariant(value)); |
| 49 | } |
| 50 | |
| 51 | void IPConfigDBusAdaptor::EmitStringChanged(const string &name, |
| 52 | const string &value) { |
| 53 | PropertyChanged(name, DBusAdaptor::StringToVariant(value)); |
| 54 | } |
| 55 | |
| 56 | map<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 | |
| 63 | void 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 | |
| 71 | void IPConfigDBusAdaptor::ClearProperty(const std::string& name, |
| 72 | ::DBus::Error &error) { |
| 73 | } |
| 74 | |
| 75 | void IPConfigDBusAdaptor::Remove(::DBus::Error &error) { |
| 76 | } |
| 77 | |
| 78 | void IPConfigDBusAdaptor::MoveBefore(const ::DBus::Path& path, |
| 79 | ::DBus::Error &error) { |
| 80 | } |
| 81 | |
| 82 | void IPConfigDBusAdaptor::MoveAfter(const ::DBus::Path& path, |
| 83 | ::DBus::Error &error) { |
| 84 | } |
| 85 | |
| 86 | } // namespace shill |