Home | History | Annotate | Download | only in test-rpc-proxy
      1 //
      2 // Copyright (C) 2015 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 "proxy_rpc_out_data_types.h"
     18 
     19 namespace {
     20 // Autotest Server test encodes the object type in this key.
     21 static const char kXmlRpcStructTypeKey[] = "xmlrpc_struct_type_key";
     22 } // namespace
     23 
     24 AssociationResult::AssociationResult(
     25     bool success,
     26     double discovery_time,
     27     double association_time,
     28     double configuration_time,
     29     const std::string& failure_reason)
     30   : success_(success),
     31     discovery_time_(discovery_time),
     32     association_time_(association_time),
     33     configuration_time_(configuration_time),
     34     failure_reason_(failure_reason) {}
     35 
     36 XmlRpc::XmlRpcValue AssociationResult::ConvertToXmlRpcValue() {
     37   XmlRpc::XmlRpcValue value;
     38   value["discovery_time"] = discovery_time_;
     39   value["association_time"] = association_time_;
     40   value["configuration_time"] = configuration_time_;
     41   value["failure_reason"] = failure_reason_;
     42   value["success"] = success_;
     43   value[kXmlRpcStructTypeKey] = "AssociationResult";
     44   return value;
     45 }
     46