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" |
Christopher Wiley | b691efd | 2012-08-09 13:51:51 -0700 | [diff] [blame] | 11 | #include "shill/logging.h" |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame] | 12 | |
| 13 | using std::map; |
| 14 | using std::string; |
| 15 | |
| 16 | namespace shill { |
| 17 | |
| 18 | // static |
| 19 | unsigned int RPCTask::serial_number_ = 0; |
| 20 | |
| 21 | RPCTask::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 Petkov | 6999022 | 2012-11-14 09:25:25 +0100 | [diff] [blame] | 26 | LOG(INFO) << "RPCTask " + unique_name_ + " created."; |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | RPCTask::~RPCTask() { |
Darin Petkov | 6999022 | 2012-11-14 09:25:25 +0100 | [diff] [blame] | 30 | LOG(INFO) << "RPCTask " + unique_name_ + " destroyed."; |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame] | 31 | } |
| 32 | |
Darin Petkov | 209e629 | 2012-04-20 11:33:32 +0200 | [diff] [blame] | 33 | void RPCTask::GetLogin(string *user, string *password) { |
| 34 | delegate_->GetLogin(user, password); |
| 35 | } |
| 36 | |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame] | 37 | void RPCTask::Notify(const string &reason, const map<string, string> &dict) { |
| 38 | delegate_->Notify(reason, dict); |
| 39 | } |
| 40 | |
| 41 | string RPCTask::GetRpcIdentifier() const { |
| 42 | return adaptor_->GetRpcIdentifier(); |
| 43 | } |
| 44 | |
| 45 | string RPCTask::GetRpcInterfaceIdentifier() const { |
| 46 | return adaptor_->GetRpcInterfaceIdentifier(); |
| 47 | } |
| 48 | |
| 49 | string RPCTask::GetRpcConnectionIdentifier() const { |
| 50 | return adaptor_->GetRpcConnectionIdentifier(); |
| 51 | } |
| 52 | |
| 53 | } // namespace shill |