ADD: added new basic messages and added the parentID as an part of the identifier
This commit is contained in:
23
src/main.cpp
23
src/main.cpp
@@ -1,5 +1,6 @@
|
||||
#include "WHISPER/InternalUDPService.hpp"
|
||||
#include "WHISPER/Messages/Message.hpp"
|
||||
#include "WHISPER/Messages/stringData.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <loguru.hpp>
|
||||
@@ -43,14 +44,14 @@ int main()
|
||||
// WHISPER::Join join(1,1,WHISPER::SourceType::SHIP,8000,"192.168.1.178");
|
||||
|
||||
auto receiver = std::make_shared<WHISPER::threadSafeQueue<WHISPER::Message>>();
|
||||
WHISPER::InternalUDPService service(1,WHISPER::SHIP,8000,"192.168.0.255","192.168.1.178");
|
||||
WHISPER::InternalUDPService service(0,1,WHISPER::SHIP,8000,"127.0.0.255","127.0.0.1");
|
||||
service.connect(receiver);
|
||||
|
||||
service.subscribe(WHISPER::MsgTopicsMap[WHISPER::MsgTopics::DATA]);
|
||||
service.subscribe(WHISPER::MsgTopicsMap[WHISPER::MsgTopics::TRACK]);
|
||||
// service.subscribe(WHISPER::MsgTopicsMap[WHISPER::MsgTopics::TRACK]);
|
||||
|
||||
|
||||
// service.publish(join.serialize(), WHISPER::MsgTopicsMap[WHISPER::MsgTopics::MANAGEMENT]);
|
||||
WHISPER::StringData data(0,1,WHISPER::SHIP,"hello world");
|
||||
service.publish(data.serialize(), WHISPER::MsgTopicsMap[WHISPER::MsgTopics::DATA]);
|
||||
|
||||
|
||||
|
||||
@@ -61,18 +62,12 @@ int main()
|
||||
|
||||
// service.publish(RawTrack.serialize(),WHISPER::MsgTopicsMap[WHISPER::MsgTopics::TRACK]);
|
||||
|
||||
// while (running) {
|
||||
// // zmq::message_t msg(string.begin(),string.end());
|
||||
// // msg.set_group("data");
|
||||
// // sock.send(msg,zmq::send_flags::none);
|
||||
while (running) {
|
||||
service.publish(data.serialize(), WHISPER::MsgTopicsMap[WHISPER::MsgTopics::DATA]);
|
||||
|
||||
// // if (size != receiver->size()) {
|
||||
// // LOG_S(INFO)<<"received messages " << size;
|
||||
// // size = receiver->size();
|
||||
// // }
|
||||
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
// }
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
}
|
||||
|
||||
|
||||
service.disconnect();
|
||||
|
||||
Reference in New Issue
Block a user