47 lines
1.0 KiB
C++
47 lines
1.0 KiB
C++
#pragma once
|
|
|
|
|
|
#include "WHISPER/whisper.hpp"
|
|
#include <cstdint>
|
|
#include <memory>
|
|
|
|
#define ZMQ_BUILD_DRAFT_API 1
|
|
#include <zmq.hpp>
|
|
#include <zmq_addon.hpp>
|
|
|
|
namespace WHISPER {
|
|
|
|
class InternalUDPService : public whispercomm {
|
|
|
|
|
|
private:
|
|
std::string address_;
|
|
std::uint16_t port_;
|
|
std::uint16_t ownReceivingPort_;
|
|
|
|
zmq::context_t ctx;
|
|
zmq::socket_t sender;
|
|
std::shared_ptr<zmq::socket_t> receiver;
|
|
|
|
std::uint16_t checkPort(std::uint16_t port);
|
|
|
|
void derivedConnect() override;
|
|
void derivedDisconnect() override;
|
|
void derivedPublish(std::string msg,std::string topic) override;
|
|
void derivedReceive() override;
|
|
void derivedSubscribe(std::string topic) override;
|
|
void derivedUnsubscribe(std::string topic) override;
|
|
|
|
|
|
public:
|
|
InternalUDPService(std::uint32_t id, SourceType owndevicetype,std::uint16_t port, std::string address);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} |