blob: 2b69404f939533ccfd881b2675dfcbbc31983bda [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"
Ben Chanfad4a0b2012-04-18 15:49:59 -070011#include "shill/scope_logger.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);
Ben Chanfad4a0b2012-04-18 15:49:59 -070026 SLOG(Task, 2) << "RPCTask " + unique_name_ + " created.";
Darin Petkova9b1fed2012-02-29 11:49:05 +010027}
28
29RPCTask::~RPCTask() {
Ben Chanfad4a0b2012-04-18 15:49:59 -070030 SLOG(Task, 2) << "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