123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- //
- // Created by zx on 2020/1/16.
- //
- #include <nnxx/message.h>
- #include <nnxx/message_control.h>
- #include <nnxx/socket.h>
- #include <nnxx/pubsub.h>
- #include <nnxx/timeout.h>
- #include <nnxx/error.h>
- #include <iostream>
- #include "../wj_lidar/wj_lidar_msg.pb.h"
- #include <thread>
- int main()
- {
- nnxx::socket s{nnxx::SP,nnxx::SUB};
- s.connect("tcp://127.0.0.1:10080");
- nnxx::subscribe(s);
- std::string message;
- while(true)
- {
- message=s.recv<std::string>(0);
- if(message.length()>0)
- {
- wj_lidar_message::Fence_statu_message fence_statu;
- if(fence_statu.ParseFromString(message))
- {
- if(fence_statu.fence_statu_size()==0)
- {
- std::this_thread::yield();
- continue;
- }
- char buf[255] = {0};
- sprintf(buf, " terminal status: ");
- for (int i = 0; i < fence_statu.fence_statu_size(); ++i) {
- sprintf(buf+strlen(buf), "[%d, %d] ", fence_statu.fence_statu(i).cloud_statu(),
- fence_statu.fence_statu(i).position_statu());
- }
- std::cout << buf << std::endl;
- }
- }
- }
- }
|