// // Created by zx on 2020/1/16. // #include #include #include #include #include #include #include #include "../wj_lidar/wj_lidar_msg.pb.h" #include 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(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; } } } }