@@ -49,9 +49,10 @@ struct TestUUri {
4949void test_pub_sub (shared_ptr<SocketUTransport> transport)
5050{
5151 TestUUri src{" 10.0.0.1" , 0x10001 , 1 , 0x8000 };
52- auto action_exact = [&](const uprotocol::v1::UMessage& msg) { cout << " #### got sub from pub" << endl; };
5352
54- auto lhandle1 = transport->registerListener (src, action_exact);
53+ auto lhandle1 = transport->registerListener ([&](const uprotocol::v1::UMessage& msg) {
54+ cout << " #### got sub from pub" << endl;
55+ }, src);
5556
5657 for (auto i = 0 ; i < 2 ; i++) {
5758 {
@@ -75,19 +76,22 @@ void test_pub_sub(shared_ptr<SocketUTransport> transport)
7576void test_rpc_req (shared_ptr<SocketUTransport> transport)
7677{
7778 TestUUri src{" 10.0.0.1" , 0x10001 , 1 , 0 };
78- auto action_exact = [&](const uprotocol::v1::UMessage& msg) { cout << " #### got rpc req" << endl; };
79-
8079 TestUUri sink{" 10.0.0.2" , 0x10002 , 2 , 2 };
8180
82- auto lhandle0 = transport->registerListener (src, action_exact, sink);
83- auto lhandle1 = transport->registerListener (src, action_exact);
81+ auto lhandle0 = transport->registerListener ([&](const uprotocol::v1::UMessage& msg) {
82+ cout << " #### got rpc req exact" << endl;
83+ }, src, sink);
84+
85+ // auto lhandle1 = transport->registerListener([&](const uprotocol::v1::UMessage& msg) {
86+ // cout << "#### got rpc req without sink" << endl;
87+ // }, src);
8488
8589 for (auto i = 0 ; i < 2 ; i++) {
8690 {
8791 uprotocol::v1::UAttributes attr;
8892 attr.set_type (uprotocol::v1::UMESSAGE_TYPE_REQUEST);
8993 *attr.mutable_id () = make_uuid ();
90- *attr.mutable_source () = src. withReqIdZero () ;
94+ *attr.mutable_source () = src;
9195 *attr.mutable_sink () = sink;
9296 attr.set_priority (uprotocol::v1::UPRIORITY_CS4);
9397 attr.set_payload_format (uprotocol::v1::UPAYLOAD_FORMAT_TEXT);
@@ -106,12 +110,10 @@ void test_rpc_req(shared_ptr<SocketUTransport> transport)
106110void test_rpc_resp (shared_ptr<SocketUTransport> transport)
107111{
108112 TestUUri src{" 10.0.0.1" , 0x10001 , 1 , 0 };
109- auto action_exact = [&](const uprotocol::v1::UMessage& msg) { cout << " #### got rpc resp" << endl; };
110-
111113 TestUUri sink{" 10.0.0.2" , 0x10002 , 2 , 2 };
112114
113- auto lhandle0 = transport->registerListener (sink, action_exact, src);
114- // auto lhandle1 = transport->registerListener(src, action_exact );
115+ auto lhandle0 = transport->registerListener ([&]( const uprotocol::v1::UMessage& msg) {
116+ cout << " #### got rpc resp " << endl; }, sink, src );
115117
116118 for (auto i = 0 ; i < 2 ; i++) {
117119 {
@@ -136,12 +138,11 @@ void test_rpc_resp(shared_ptr<SocketUTransport> transport)
136138
137139void test_notification (shared_ptr<SocketUTransport> transport)
138140{
139- TestUUri src{" 10.0.0.1" , 0x18001 , 1 , 1 };
140- auto action_exact = [&](const uprotocol::v1::UMessage& msg) { cout << " #### got notification" << endl; };
141-
142- TestUUri sink{" 10.0.0.2" , 0x10002 , 2 , 1 };
141+ TestUUri src{" 10.0.0.1" , 0x8001 , 1 , 1 };
142+ TestUUri sink{" 10.0.0.2" , 0x10002 , 2 , 2 };
143143
144- auto lhandle0 = transport->registerListener (sink, action_exact, src);
144+ auto lhandle0 = transport->registerListener ([&](const uprotocol::v1::UMessage& msg) {
145+ cout << " #### got notification" << endl; }, sink, src);
145146 cout << " after registerListener" << endl;
146147 // auto lhandle1 = transport->registerListener(src, action_exact);
147148
@@ -150,8 +151,8 @@ void test_notification(shared_ptr<SocketUTransport> transport)
150151 uprotocol::v1::UAttributes attr;
151152 attr.set_type (uprotocol::v1::UMESSAGE_TYPE_NOTIFICATION);
152153 *attr.mutable_id () = make_uuid ();
153- *attr.mutable_source () = src;
154- *attr.mutable_sink () = sink. withReqIdZero () ;
154+ *attr.mutable_source () = src; // .withReqIdZero();
155+ *attr.mutable_sink () = sink;
155156 // attr.set_priority(uprotocol::v1::UPRIORITY_CS4);
156157 attr.set_payload_format (uprotocol::v1::UPAYLOAD_FORMAT_TEXT);
157158 // *attr.mutable_reqid() = make_uuid();
0 commit comments