ADD: added message callback to udp listener
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <WHISPER/localClients.hpp>
|
||||
#include <future>
|
||||
|
||||
#define ZMQ_BUILD_DRAFT_API 1
|
||||
#include <zmq.hpp>
|
||||
@@ -18,6 +19,22 @@ namespace WHISPER {
|
||||
|
||||
class InternalUDPListener{
|
||||
|
||||
|
||||
public:
|
||||
InternalUDPListener(std::uint16_t port);
|
||||
~InternalUDPListener();
|
||||
void connect(std::shared_ptr<threadSafeQueue<WHISPER::Message>> receiver);
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
std::uint16_t getPort();
|
||||
|
||||
void subscribe(WHISPER::MsgTopics topic);
|
||||
void unsubscribe(WHISPER::MsgTopics topic);
|
||||
|
||||
void registerMessageCallback(std::function<void(std::string)> MessageHandle);
|
||||
|
||||
|
||||
private:
|
||||
std::uint16_t port_;
|
||||
//zeromq io contex
|
||||
@@ -38,17 +55,8 @@ namespace WHISPER {
|
||||
|
||||
std::uint16_t checkPort(std::uint16_t port);
|
||||
|
||||
public:
|
||||
InternalUDPListener(std::uint16_t port);
|
||||
~InternalUDPListener();
|
||||
void connect(std::shared_ptr<threadSafeQueue<WHISPER::Message>> receiver);
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
std::uint16_t getPort();
|
||||
|
||||
void subscribe(WHISPER::MsgTopics topic);
|
||||
void unsubscribe(WHISPER::MsgTopics topic);
|
||||
std::function<void(std::string)> MessageHandle_ = nullptr;
|
||||
std::atomic_bool useHandl_ = false;;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace WHISPER {
|
||||
|
||||
public:
|
||||
InternalUDPService(std::string id, std::uint16_t port, std::string destinationAdress, std::string myAdress);
|
||||
|
||||
~InternalUDPService();
|
||||
private:
|
||||
/// ip address of the destination
|
||||
|
||||
Reference in New Issue
Block a user