123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- //
- // Created by zx on 2020/7/3.
- //
- #include <iostream>
- #include "../lidar_locate/Locate_communicator.h";
- #include <unistd.h>
- #include "../tool/thread_safe_list.h"
- int main()
- {
- Locate_communicator* pLocator=Locate_communicator::get_instance_pointer();
- pLocator->communication_bind("tcp://127.0.0.1:9005");
- pLocator->communication_connect("tcp://127.0.0.1:9006");
- pLocator->communication_run();
- int k=1;
- Thread_safe_list<std::string*> list;
- /*nnxx::socket socket{ nnxx::SP, nnxx::BUS };
- socket.bind("tcp://127.0.0.1:9005");
- socket.connect("tcp://127.0.0.1:9006");*/
- while(1) {
- message::Measure_request_msg request;
- message::Base_info base_msg;
- request.mutable_base_info()->CopyFrom(base_msg);
- request.mutable_base_info()->set_msg_type(message::eLocate_request_msg);
- request.mutable_base_info()->set_sender(message::eMain);
- request.mutable_base_info()->set_receiver(message::eMeasurer);
- request.mutable_base_info()->set_timeout_ms(1000);
- request.set_command_id(222);
- request.set_terminal_id(0);
- message::Measure_response_msg response;
- message::Measure_request_msg request_1;
- std::string str=request.SerializeAsString();
- //socket.send(request_1.SerializeAsString());
- Error_manager code=pLocator->locate_request(request,response);
- if(code!=SUCCESS)
- {
- std::cout<<code.to_string()<<std::endl;
- }
- else if(request.command_id()==response.command_id()){
- std::cout<<" Success request command :"<<request.command_id()<<std::endl;
- }
- k++;
- usleep(1000*500);
- }
- return 0;
- }
|