blob: ff15cad9619317d11e73d63eae7ab389d1c00cd2 [file] [log] [blame]
Chris Masoned7732e42011-05-20 11:08:56 -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
Paul Stewart28fbfdf2011-05-31 09:37:38 -07005#include "shill/device.h"
Chris Masoned7732e42011-05-20 11:08:56 -07006#include "shill/device_dbus_adaptor.h"
7
8#include <map>
9#include <string>
10
Chris Masonea82b7112011-05-25 15:16:29 -070011#include "shill/device.h"
Chris Masone8fe2c7e2011-06-09 15:51:19 -070012#include "shill/error.h"
Chris Masonea82b7112011-05-25 15:16:29 -070013
Chris Masoned7732e42011-05-20 11:08:56 -070014using std::map;
15using std::string;
16
17namespace shill {
18
Chris Masoned7732e42011-05-20 11:08:56 -070019// static
Chris Masonea82b7112011-05-25 15:16:29 -070020const char DeviceDBusAdaptor::kInterfaceName[] = SHILL_INTERFACE;
Chris Masoned7732e42011-05-20 11:08:56 -070021// static
Chris Masonea82b7112011-05-25 15:16:29 -070022const char DeviceDBusAdaptor::kPath[] = "/device/";
Chris Masoned7732e42011-05-20 11:08:56 -070023
Chris Masoneec6b18b2011-06-08 14:09:10 -070024DeviceDBusAdaptor::DeviceDBusAdaptor(DBus::Connection* conn, Device *device)
Chris Masonea82b7112011-05-25 15:16:29 -070025 : DBusAdaptor(conn, kPath + device->UniqueName()),
Chris Masone4e851612011-07-01 10:46:53 -070026 device_(device),
27 connection_name_(conn->unique_name()) {
Chris Masoned7732e42011-05-20 11:08:56 -070028}
Chris Masoned0ceb8c2011-06-02 10:05:39 -070029
Chris Masoneec6b18b2011-06-08 14:09:10 -070030DeviceDBusAdaptor::~DeviceDBusAdaptor() {
31 device_ = NULL;
32}
Chris Masone4e851612011-07-01 10:46:53 -070033const std::string &DeviceDBusAdaptor::GetRpcIdentifier() {
34 return path();
35}
36
37const std::string &DeviceDBusAdaptor::GetRpcConnectionIdentifier() {
38 return connection_name_;
39}
Chris Masoned7732e42011-05-20 11:08:56 -070040
41void DeviceDBusAdaptor::UpdateEnabled() {}
42
Chris Masoned0ceb8c2011-06-02 10:05:39 -070043void DeviceDBusAdaptor::EmitBoolChanged(const std::string& name, bool value) {
44 PropertyChanged(name, DBusAdaptor::BoolToVariant(value));
45}
46
47void DeviceDBusAdaptor::EmitUintChanged(const std::string& name, uint32 value) {
Chris Masone8fe2c7e2011-06-09 15:51:19 -070048 PropertyChanged(name, DBusAdaptor::Uint32ToVariant(value));
Chris Masoned0ceb8c2011-06-02 10:05:39 -070049}
50
51void DeviceDBusAdaptor::EmitIntChanged(const std::string& name, int value) {
Chris Masone8fe2c7e2011-06-09 15:51:19 -070052 PropertyChanged(name, DBusAdaptor::Int32ToVariant(value));
Chris Masoned0ceb8c2011-06-02 10:05:39 -070053}
54
55void DeviceDBusAdaptor::EmitStringChanged(const std::string& name,
56 const std::string& value) {
57 PropertyChanged(name, DBusAdaptor::StringToVariant(value));
58}
59
Chris Masoned7732e42011-05-20 11:08:56 -070060map<string, ::DBus::Variant> DeviceDBusAdaptor::GetProperties(
61 ::DBus::Error &error) {
Chris Masonea8a2c252011-06-27 22:16:30 -070062 map<string, ::DBus::Variant> properties;
Chris Masone27c4aa52011-07-02 13:10:14 -070063 DBusAdaptor::GetProperties(device_->store(), &properties, &error);
Chris Masonea8a2c252011-06-27 22:16:30 -070064 return properties;
Chris Masoned7732e42011-05-20 11:08:56 -070065}
66
Chris Masone8fe2c7e2011-06-09 15:51:19 -070067void DeviceDBusAdaptor::SetProperty(const string& name,
68 const ::DBus::Variant& value,
Chris Masoned7732e42011-05-20 11:08:56 -070069 ::DBus::Error &error) {
Chris Masone27c4aa52011-07-02 13:10:14 -070070 DBusAdaptor::DispatchOnType(device_->store(), name, value, &error);
Chris Masoned7732e42011-05-20 11:08:56 -070071}
72
Chris Masoneccc88812011-06-08 18:00:10 -070073void DeviceDBusAdaptor::ClearProperty(const std::string& ,
74 ::DBus::Error &error) {
75}
76
Chris Masoned7732e42011-05-20 11:08:56 -070077void DeviceDBusAdaptor::ProposeScan(::DBus::Error &error) {
78}
79
80::DBus::Path DeviceDBusAdaptor::AddIPConfig(const string& ,
81 ::DBus::Error &error) {
82 return ::DBus::Path();
83}
84
Darin Petkov9ae310f2011-08-30 15:41:13 -070085void DeviceDBusAdaptor::Register(const string &network_id,
86 ::DBus::Error &error) {
87 Error e;
88 device_->RegisterOnNetwork(network_id, &e);
89 e.ToDBusError(&error);
Chris Masoneccc88812011-06-08 18:00:10 -070090}
91
92void DeviceDBusAdaptor::RequirePin(const std::string& ,
93 const bool& ,
94 ::DBus::Error &error) {
95}
96
97void DeviceDBusAdaptor::EnterPin(const std::string& , ::DBus::Error &error) {
98}
99
100void DeviceDBusAdaptor::UnblockPin(const std::string& ,
101 const std::string& ,
102 ::DBus::Error &error) {
103}
104
105void DeviceDBusAdaptor::ChangePin(const std::string& ,
106 const std::string& ,
107 ::DBus::Error &error) {
108}
109
Chris Masoned7732e42011-05-20 11:08:56 -0700110} // namespace shill