implemented local client join functionality

This commit is contained in:
Henry Winkel
2022-11-13 15:04:20 +01:00
parent 84305eb7fa
commit cf1800ffba
9 changed files with 231 additions and 40 deletions

View File

@@ -3,7 +3,9 @@
#include "WHISPER/whisper.hpp"
#include <cstdint>
#include <list>
#include <memory>
#include <vector>
#define ZMQ_BUILD_DRAFT_API 1
#include <zmq.hpp>
@@ -11,17 +13,31 @@
namespace WHISPER {
struct localClient{
short port;
zmq::socket_t clientSocket;
};
class InternalUDPService : public whispercomm {
private:
std::string address_;
std::string destinationAdress_;
std::string myAdress_;
std::uint16_t port_;
std::uint16_t ownReceivingPort_;
zmq::context_t ctx;
zmq::socket_t sender;
std::shared_ptr<zmq::socket_t> receiver;
std::shared_ptr<zmq::socket_t> receiver = nullptr;
std::shared_ptr<zmq::socket_t> loopbackSocket = nullptr;
std::vector<std::shared_ptr<localClient>> localclients;
std::uint16_t checkPort(std::uint16_t port);
@@ -32,9 +48,12 @@ namespace WHISPER {
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);
InternalUDPService(std::uint32_t id, SourceType owndevicetype,std::uint16_t port, std::string destinationAdress, std::string myAdress);

View File

@@ -21,6 +21,10 @@ namespace WHISPER {
JOIN=1,
/// participant is leaving
LEAVE,
/// PING
PING,
/// PONG
PONG,
/// owntrack informaton
OWN_TRACK,
/// raw track message

View File

@@ -70,6 +70,8 @@ namespace WHISPER
void subscribe(std::string topic);
void unsubscribe(std::string topic);
std::uint32_t getOwnID();
protected:
void addMsgToReceiverQueue(WHISPER::Message);