29 lines
441 B
C
29 lines
441 B
C
|
#pragma once
|
||
|
|
||
|
#include <atomic>
|
||
|
#include <QThread>
|
||
|
|
||
|
#include "zmq.hpp"
|
||
|
|
||
|
class ZMQServer : public QThread {
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
explicit ZMQServer(QObject* param = nullptr);
|
||
|
~ZMQServer() override = default;
|
||
|
|
||
|
bool Start(quint16 port);
|
||
|
void Stop();
|
||
|
|
||
|
Q_SIGNALS:
|
||
|
void MessageReady(const QString& Message);
|
||
|
|
||
|
protected:
|
||
|
void run();
|
||
|
|
||
|
private:
|
||
|
zmq::context_t ctx_;
|
||
|
zmq::socket_t socket_;
|
||
|
int port_{ 9527 };
|
||
|
std::atomic_bool stop_{ true };
|
||
|
};
|