Home | History | Annotate | Download | only in shims
      1 //
      2 // Copyright (C) 2012 The Android Open Source Project
      3 //
      4 // Licensed under the Apache License, Version 2.0 (the "License");
      5 // you may not use this file except in compliance with the License.
      6 // You may obtain a copy of the License at
      7 //
      8 //      http://www.apache.org/licenses/LICENSE-2.0
      9 //
     10 // Unless required by applicable law or agreed to in writing, software
     11 // distributed under the License is distributed on an "AS IS" BASIS,
     12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 // See the License for the specific language governing permissions and
     14 // limitations under the License.
     15 //
     16 
     17 #include "shill/shims/task_proxy.h"
     18 
     19 #include <base/logging.h>
     20 
     21 using std::map;
     22 using std::string;
     23 
     24 namespace shill {
     25 
     26 namespace shims {
     27 
     28 TaskProxy::TaskProxy(scoped_refptr<dbus::Bus> bus,
     29                      const string& path,
     30                      const string& service)
     31       : proxy_(bus, dbus::ObjectPath(path)) {}
     32 
     33 TaskProxy::~TaskProxy() {}
     34 
     35 void TaskProxy::Notify(const string& reason, const map<string, string>& dict) {
     36   LOG(INFO) << __func__ << "(" << reason
     37             << ", argcount: " << dict.size() << ")";
     38   brillo::ErrorPtr error;
     39   if (!proxy_.notify(reason, dict, &error)) {
     40     LOG(ERROR) << "DBus error: " << error->GetCode() << ": "
     41                << error->GetMessage();
     42   }
     43 }
     44 
     45 bool TaskProxy::GetSecret(string* username, string* password) {
     46   LOG(INFO) << __func__;
     47   brillo::ErrorPtr error;
     48   if (!proxy_.getsec(username, password, &error)) {
     49     LOG(ERROR) << "DBus error: " << error->GetCode() << ": "
     50                << error->GetMessage();
     51     return false;
     52   }
     53   return true;
     54 }
     55 
     56 }  // namespace shims
     57 
     58 }  // namespace shill
     59