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
20 namespace polo {
21 namespace pairing {
22 namespace message {
23
PairingRequestMessage(const std::string & service_name)24 PairingRequestMessage::PairingRequestMessage(
25 const std::string& service_name)
26 : PoloMessage(PoloMessage::kPairingRequest),
27 service_name_(service_name),
28 client_name_("") {
29 }
30
PairingRequestMessage(const std::string & service_name,const std::string & client_name)31 PairingRequestMessage::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
service_name() const38 std::string PairingRequestMessage::service_name() const {
39 return service_name_;
40 }
41
client_name() const42 std::string PairingRequestMessage::client_name() const {
43 return client_name_;
44 }
45
has_client_name() const46 bool PairingRequestMessage::has_client_name() const {
47 return client_name_.length() > 0;
48 }
49
ToString() const50 std::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