blob: 906bc3c166dbd76bd5980c404a509d6cd0e1bada [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.h"
6
7#include <base/string_number_conversions.h>
8
9#include "shill/adaptor_interfaces.h"
10#include "shill/control_interface.h"
Christopher Wileyb691efd2012-08-09 13:51:51 -070011#include "shill/logging.h"
Darin Petkova9b1fed2012-02-29 11:49:05 +010012
13using std::map;
14using std::string;
15
16namespace shill {
17
18// static
19unsigned int RPCTask::serial_number_ = 0;
20
21RPCTask::RPCTask(ControlInterface *control_interface, RPCTaskDelegate *delegate)
22 : delegate_(delegate),
23 unique_name_(base::UintToString(serial_number_++)),
24 adaptor_(control_interface->CreateRPCTaskAdaptor(this)) {
25 CHECK(delegate);
Darin Petkov69990222012-11-14 09:25:25 +010026 LOG(INFO) << "RPCTask " + unique_name_ + " created.";
Darin Petkova9b1fed2012-02-29 11:49:05 +010027}
28
29RPCTask::~RPCTask() {
Darin Petkov69990222012-11-14 09:25:25 +010030 LOG(INFO) << "RPCTask " + unique_name_ + " destroyed.";
Darin Petkova9b1fed2012-02-29 11:49:05 +010031}
32
Darin Petkov209e6292012-04-20 11:33:32 +020033void RPCTask::GetLogin(string *user, string *password) {
34 delegate_->GetLogin(user, password);
35}
36
Darin Petkova9b1fed2012-02-29 11:49:05 +010037void RPCTask::Notify(const string &reason, const map<string, string> &dict) {
38 delegate_->Notify(reason, dict);
39}
40
41string RPCTask::GetRpcIdentifier() const {
42 return adaptor_->GetRpcIdentifier();
43}
44
45string RPCTask::GetRpcInterfaceIdentifier() const {
46 return adaptor_->GetRpcInterfaceIdentifier();
47}
48
49string RPCTask::GetRpcConnectionIdentifier() const {
50 return adaptor_->GetRpcConnectionIdentifier();
51}
52
53} // namespace shill