blob: ed4ead4e8cd0539965a616ec972effcae149e7cc [file] [log] [blame]
Darin Petkova9b1fed2012-02-29 11:49:05 +01001// Copyright (c) 2012 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/rpc_task_dbus_adaptor.h"
6
7#include <base/logging.h>
8
9#include "shill/error.h"
10#include "shill/rpc_task.h"
11
12using std::map;
13using std::string;
14
15namespace shill {
16
17// static
Darin Petkova9b1fed2012-02-29 11:49:05 +010018const char RPCTaskDBusAdaptor::kPath[] = "/task/";
19
20RPCTaskDBusAdaptor::RPCTaskDBusAdaptor(DBus::Connection *conn, RPCTask *task)
21 : DBusAdaptor(conn, kPath + task->UniqueName()),
22 task_(task),
mukesh agrawald1511fe2012-03-14 17:12:27 -070023 interface_name_(SHILL_INTERFACE ".Task"),
Darin Petkova9b1fed2012-02-29 11:49:05 +010024 connection_name_(conn->unique_name()) {}
25
26RPCTaskDBusAdaptor::~RPCTaskDBusAdaptor() {
27 task_ = NULL;
28}
29
30const string &RPCTaskDBusAdaptor::GetRpcIdentifier() {
31 return DBus::Object::path();
32}
33
34const string &RPCTaskDBusAdaptor::GetRpcInterfaceIdentifier() {
35 // TODO(petkov): We should be able to return DBus::Interface::name() or simply
36 // name() and avoid the need for the |interface_name_| data member. However,
37 // that's non-trivial due to multiple inheritance (crosbug.com/27058).
38 return interface_name_;
39}
40
41const string &RPCTaskDBusAdaptor::GetRpcConnectionIdentifier() {
42 return connection_name_;
43}
44
Darin Petkov209e6292012-04-20 11:33:32 +020045void RPCTaskDBusAdaptor::getsec(
46 string &user, string &password, DBus::Error &error) {
47 task_->GetLogin(&user, &password);
48}
49
Darin Petkova9b1fed2012-02-29 11:49:05 +010050void RPCTaskDBusAdaptor::notify(const string &reason,
51 const map<string, string> &dict,
52 DBus::Error &/*error*/) {
53 task_->Notify(reason, dict);
54}
55
56} // namespace shill