| | |
| | | proc.put("name", info.proc().name()); |
| | | proc.put("publicInfo", info.proc().public_info()); |
| | | proc.put("online", info.online()); |
| | | Json topics = Json::Array(); |
| | | for (auto &t : info.topics().topic_list()) { |
| | | topics.push_back(t); |
| | | } |
| | | proc.put("topics", topics); |
| | | auto AddTopics = [&](auto &name, auto &topic_list) { |
| | | Json topics = Json::Array(); |
| | | for (auto &t : topic_list) { |
| | | topics.push_back(t); |
| | | } |
| | | proc.put(name, topics); |
| | | }; |
| | | AddTopics("service", info.service().topic_list()); |
| | | AddTopics("local_sub", info.local_sub().topic_list()); |
| | | AddTopics("net_sub", info.net_sub().topic_list()); |
| | | |
| | | list.push_back(proc); |
| | | } |
| | | return json.dump(0); |
| | |
| | | } // namespace |
| | | |
| | | CenterTopicNode::CenterTopicNode(CenterPtr center, SharedMemory &shm) : |
| | | pscenter_(center), pnode_(new TopicNode(shm)), run_(false) {} |
| | | pscenter_(center), pnode_(new TopicNode(shm, 200)), run_(false) {} |
| | | |
| | | CenterTopicNode::~CenterTopicNode() { Stop(); } |
| | | |
| | |
| | | *reply.mutable_errmsg() = data.errmsg(); |
| | | reply.set_data(ToJson(data)); |
| | | } else { |
| | | SetError(*reply.mutable_errmsg(), eInvalidInput, "not supported topic" + request.topic()); |
| | | SetError(*reply.mutable_errmsg(), eInvalidInput, "invalid topic: " + request.topic()); |
| | | } |
| | | pnode_->ServerSendReply(src_info, reply); |
| | | }; |