Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame] | 1 | // 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 | |
| 12 | using std::map; |
| 13 | using std::string; |
| 14 | |
| 15 | namespace shill { |
| 16 | |
| 17 | // static |
| 18 | unsigned int RPCTask::serial_number_ = 0; |
| 19 | |
| 20 | RPCTask::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 | |
| 28 | RPCTask::~RPCTask() { |
| 29 | VLOG(2) << "RPCTask " + unique_name_ + " destroyed."; |
| 30 | } |
| 31 | |
| 32 | void RPCTask::Notify(const string &reason, const map<string, string> &dict) { |
| 33 | delegate_->Notify(reason, dict); |
| 34 | } |
| 35 | |
| 36 | string RPCTask::GetRpcIdentifier() const { |
| 37 | return adaptor_->GetRpcIdentifier(); |
| 38 | } |
| 39 | |
| 40 | string RPCTask::GetRpcInterfaceIdentifier() const { |
| 41 | return adaptor_->GetRpcInterfaceIdentifier(); |
| 42 | } |
| 43 | |
| 44 | string RPCTask::GetRpcConnectionIdentifier() const { |
| 45 | return adaptor_->GetRpcConnectionIdentifier(); |
| 46 | } |
| 47 | |
| 48 | } // namespace shill |