datastream_zmq.h
Go to the documentation of this file.
1 #pragma once
2 #include <QDialog>
3 
4 #include <QtPlugin>
5 #include <thread>
8 #include "ui_datastream_zmq.h"
9 #include "zmq.hpp"
10 
11 class StreamZMQDialog : public QDialog
12 {
13  Q_OBJECT
14 
15 public:
16  explicit StreamZMQDialog(QWidget* parent = nullptr);
18 
19  Ui::DataStreamZMQ* ui;
20 };
21 
23 {
24  Q_OBJECT
25  Q_PLUGIN_METADATA(IID "facontidavide.PlotJuggler3.DataStreamer")
26  Q_INTERFACES(PJ::DataStreamer)
27 
28 public:
29  DataStreamZMQ();
30 
31  virtual ~DataStreamZMQ() override;
32 
33  virtual bool start(QStringList*) override;
34 
35  virtual void shutdown() override;
36 
37  virtual bool isRunning() const override
38  {
39  return _running;
40  }
41 
42  virtual const char* name() const override
43  {
44  return "ZMQ Subscriber";
45  }
46 
47  virtual bool isDebugPlugin() override
48  {
49  return false;
50  }
51 
52 private:
53  bool _running;
57  std::string _socket_address;
58  std::thread _receive_thread;
59  std::vector<std::string> _topic_filters;
60 
61  void receiveLoop();
62  bool parseMessage(const PJ::MessageRef& msg, double& timestamp);
63  void parseTopicFilters(const QString& filters);
64  void subscribeTopics();
65  void unsubscribeTopics();
66 };
StreamZMQDialog::StreamZMQDialog
StreamZMQDialog(QWidget *parent=nullptr)
Definition: datastream_zmq.cpp:14
PJ::MessageParserPtr
std::shared_ptr< MessageParser > MessageParserPtr
Definition: messageparser_base.h:136
DataStreamZMQ
Definition: datastream_zmq.h:22
DataStreamZMQ::_parser
PJ::MessageParserPtr _parser
Definition: datastream_zmq.h:56
zmq::socket_t
Definition: zmq.hpp:2262
DataStreamZMQ::receiveLoop
void receiveLoop()
Definition: datastream_zmq.cpp:195
DataStreamZMQ::_zmq_socket
zmq::socket_t _zmq_socket
Definition: datastream_zmq.h:55
DataStreamZMQ::_topic_filters
std::vector< std::string > _topic_filters
Definition: datastream_zmq.h:59
mqtt_test_proto.msg
msg
Definition: mqtt_test_proto.py:43
DataStreamZMQ::parseTopicFilters
void parseTopicFilters(const QString &filters)
Definition: datastream_zmq.cpp:231
DataStreamZMQ::_receive_thread
std::thread _receive_thread
Definition: datastream_zmq.h:58
DataStreamZMQ::_socket_address
std::string _socket_address
Definition: datastream_zmq.h:57
zmq.hpp
DataStreamZMQ::DataStreamZMQ
DataStreamZMQ()
Definition: datastream_zmq.cpp:31
zmq::context_t
Definition: zmq.hpp:804
PJ::DataStreamer
The DataStreamer base classm used to read streaming of data.
Definition: datastreamer_base.h:25
DataStreamZMQ::subscribeTopics
void subscribeTopics()
Definition: datastream_zmq.cpp:250
DataStreamZMQ::_zmq_context
zmq::context_t _zmq_context
Definition: datastream_zmq.h:54
DataStreamZMQ::unsubscribeTopics
void unsubscribeTopics()
Definition: datastream_zmq.cpp:260
StreamZMQDialog::~StreamZMQDialog
~StreamZMQDialog()
Definition: datastream_zmq.cpp:21
DataStreamZMQ::~DataStreamZMQ
virtual ~DataStreamZMQ() override
Definition: datastream_zmq.cpp:36
DataStreamZMQ::shutdown
virtual void shutdown() override
shutdown Stop streaming
Definition: datastream_zmq.cpp:178
DataStreamZMQ::start
virtual bool start(QStringList *) override
start streaming.
Definition: datastream_zmq.cpp:41
DataStreamZMQ::parseMessage
bool parseMessage(const PJ::MessageRef &msg, double &timestamp)
Definition: datastream_zmq.cpp:217
DataStreamZMQ::name
virtual const char * name() const override
Name of the plugin type, NOT the particular instance.
Definition: datastream_zmq.h:42
PJ::MessageRef
Definition: messageparser_base.h:28
DataStreamZMQ::isDebugPlugin
virtual bool isDebugPlugin() override
Definition: datastream_zmq.h:47
DataStreamZMQ::isRunning
virtual bool isRunning() const override
isRunning
Definition: datastream_zmq.h:37
DataStreamZMQ::_running
bool _running
Definition: datastream_zmq.h:53
StreamZMQDialog::ui
Ui::DataStreamZMQ * ui
Definition: datastream_zmq.h:19
datastreamer_base.h
messageparser_base.h
StreamZMQDialog
Definition: datastream_zmq.h:11


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:44