1// Copyright 2012 Google Inc. All Rights Reserved. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15#include "polo/pairing/message/pairingrequestmessage.h" 16 17#include <sstream> 18#include <string> 19 20namespace polo { 21namespace pairing { 22namespace message { 23 24PairingRequestMessage::PairingRequestMessage( 25 const std::string& service_name) 26 : PoloMessage(PoloMessage::kPairingRequest), 27 service_name_(service_name), 28 client_name_("") { 29} 30 31PairingRequestMessage::PairingRequestMessage(const std::string& service_name, 32 const std::string& client_name) 33 : PoloMessage(PoloMessage::kPairingRequest), 34 service_name_(service_name), 35 client_name_(client_name) { 36} 37 38std::string PairingRequestMessage::service_name() const { 39 return service_name_; 40} 41 42std::string PairingRequestMessage::client_name() const { 43 return client_name_; 44} 45 46bool PairingRequestMessage::has_client_name() const { 47 return client_name_.length() > 0; 48} 49 50std::string PairingRequestMessage::ToString() const { 51 std::ostringstream ss; 52 ss << "[PairingRequestMessage service_name=" << service_name_ 53 << ", client_name=" << client_name_ << "]"; 54 return ss.str(); 55} 56 57} // namespace message 58} // namespace pairing 59} // namespace polo 60