| | |
| | | using namespace std::chrono_literals; |
| | | using namespace bhome_msg; |
| | | |
| | | bool SocketPublish::Publish(const std::string &topic, const void *data, const size_t size, const int timeout_ms) |
| | | bool SocketPublish::Publish(const Topic &topic, const void *data, const size_t size, const int timeout_ms) |
| | | { |
| | | try { |
| | | MsgI imsg; |
| | |
| | | } |
| | | } |
| | | |
| | | bool SocketSubscribe::Subscribe(const std::vector<std::string> &topics, const int timeout_ms) |
| | | bool SocketSubscribe::Subscribe(const std::vector<Topic> &topics, const int timeout_ms) |
| | | { |
| | | try { |
| | | return mq().Send(kBHTopicBus, MakeSub(mq().Id(), topics), timeout_ms); |
| | |
| | | return tdcb && Start(AsyncRecvProc, nworker); |
| | | } |
| | | |
| | | bool SocketSubscribe::RecvSub(std::string &topic, std::string &data, const int timeout_ms) |
| | | bool SocketSubscribe::RecvSub(Topic &topic, std::string &data, const int timeout_ms) |
| | | { |
| | | BHMsg msg; |
| | | if (SyncRecv(msg, timeout_ms) && msg.type() == kMsgTypePublish) { |