blob: dd8b81ba058aeb6db16442231ef97dbc5dccf0c0 [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"
11
12using std::map;
13using std::string;
14
15namespace shill {
16
17// static
18unsigned int RPCTask::serial_number_ = 0;
19
20RPCTask::RPCTask(ControlInterface *control_interface, RPCTaskDelegate *delegate)
21 : delegate_(delegate),
22 unique_name_(base::UintToString(serial_number_++)),
23 adaptor_(control_interface->CreateRPCTaskAdaptor(this)) {
24 CHECK(delegate);
25 VLOG(2) << "RPCTask " + unique_name_ + " created.";
26}
27
28RPCTask::~RPCTask() {
29 VLOG(2) << "RPCTask " + unique_name_ + " destroyed.";
30}
31
32void RPCTask::Notify(const string &reason, const map<string, string> &dict) {
33 delegate_->Notify(reason, dict);
34}
35
36string RPCTask::GetRpcIdentifier() const {
37 return adaptor_->GetRpcIdentifier();
38}
39
40string RPCTask::GetRpcInterfaceIdentifier() const {
41 return adaptor_->GetRpcInterfaceIdentifier();
42}
43
44string RPCTask::GetRpcConnectionIdentifier() const {
45 return adaptor_->GetRpcConnectionIdentifier();
46}
47
48} // namespace shill