| | |
| | | #include "fixed_q.h"
|
| | |
|
| | | #include "3rdparty/bus_nng/interface_bus_api.h"
|
| | | #include "3rdparty/bus_nng/bn_api.h"
|
| | |
|
| | | #include "bhome_msg.pb.h"
|
| | |
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | int bus_client_reply_msg(void* handle, void* src, const struct crepmsg* msg){
|
| | | int bus_client_reply(void* handle, void* src, const struct crepmsg* msg){
|
| | |
|
| | | MsgRequestTopicReply msgR;
|
| | | auto err = msgR.mutable_errmsg();
|
| | |
| | | void* rep = NULL;
|
| | | int repl = 0;
|
| | | auto msg = to_bus<4,5>(ptr(handle), bus_query_procs, pbaddr.data(), pbaddr.size(),
|
| | | pbtopic.data(), pbtopic.size(), &rep, &repl, sndto);
|
| | | pbtopic.data(), pbtopic.size(), &rep, &repl, sndto);
|
| | |
|
| | | if (msg.empty()) return NULL;
|
| | |
|
| | | // bug 已修复, 在 bus_nng 中
|
| | | // bus_query_procs 获取数据失败, 暂时改用BHQueryProcs
|
| | | // if (!BHQueryProcs(pbaddr.data(), pbaddr.size(), pbtopic.data(), pbtopic.size(), &rep, &repl, sndto)) {
|
| | | // return NULL;
|
| | | // }
|
| | |
|
| | | MsgQueryProcReply msgR;
|
| | | msgR.ParseFromArray(rep, repl);
|
| | |
| | | memcpy(id, p.proc().proc_id().data(), idl);
|
| | | procs[i] = cqueryprocs{ .id = id, .idl = idl, .online = p.online() };
|
| | | }
|
| | |
|
| | | return procs;
|
| | | }
|
| | |
|
| | |
| | | pbmsg.set_topic(topic, topicl);
|
| | | pbmsg.set_data(data, size);
|
| | | auto pbstr = pbmsg.SerializeAsString();
|
| | | return bus_client_pubmsg(handle, pbstr.data(), pbstr.size());
|
| | | return bus_client_publish_msg(handle, pbstr.data(), pbstr.size());
|
| | | }
|
| | |
|
| | | // test
|
| | | int bus_client_pubmsg(void* handle, const char* data, const size_t size){
|
| | | int bus_client_publish_msg(void* handle, const char* data, const size_t size){
|
| | | client* cli = ptr(handle);
|
| | | return bus_publish(cli->bus, data, size, 100);
|
| | | }
|