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 };
ROSCPP_DECL void start()
zmq::socket_t _zmq_socket
The DataStreamer base classm used to read streaming of data.
std::shared_ptr< MessageParser > MessageParserPtr
Ui::DataStreamZMQ * ui
std::vector< std::string > _topic_filters
std::thread _receive_thread
PJ::MessageParserPtr _parser
std::string _socket_address
zmq::context_t _zmq_context
StreamZMQDialog(QWidget *parent=nullptr)
ROSCONSOLE_DECL void shutdown()
virtual const char * name() const override
Name of the plugin type, NOT the particular instance.
virtual bool isDebugPlugin() override
virtual bool isRunning() const override
isRunning


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Jun 19 2023 03:01:02