datastream_mqtt.h
Go to the documentation of this file.
1 #ifndef DATASTREAM_MQTT_H
2 #define DATASTREAM_MQTT_H
3 
4 #include <QDialog>
5 #include <QtPlugin>
6 #include <QTimer>
7 #include <thread>
10 #include "ui_datastream_mqtt.h"
11 #include "mqtt_dialog.h"
12 
13 using namespace PJ;
14 
16 {
17  Q_OBJECT
18  Q_PLUGIN_METADATA(IID "facontidavide.PlotJuggler3.DataStreamer")
19  Q_INTERFACES(PJ::DataStreamer)
20 
21 public:
23 
24  ~DataStreamMQTT() override;
25 
26  virtual bool start(QStringList*) override;
27 
28  virtual void shutdown() override;
29 
30  virtual bool isRunning() const override;
31 
32  virtual const char* name() const override
33  {
34  return "MQTT Subscriber (Mosquitto)";
35  }
36 
37  virtual bool isDebugPlugin() override
38  {
39  return false;
40  }
41 
42  std::pair<QAction*, int> notificationAction() override
43  {
44  return { _notification_action, _failed_parsing };
45  }
46 
47 private slots:
48 
49  void onComboProtocolChanged(const QString &);
50 
51  void onMessageReceived(const mosquitto_message* message);
52 
53 private:
54 
55  bool _running;
56 
57  std::unordered_map<std::string, PJ::MessageParserPtr> _parsers;
58 
60 
61  std::thread _mqtt_thread;
62  QString _protocol;
63 
64  QString _topic_to_parse;
65 
67  int _failed_parsing = 0;
68 
71 };
72 
73 
74 #endif // DATASTREAM_MQTT_H
std::pair< QAction *, int > notificationAction() override
Gets the action to execute when clicking the &#39;notifications&#39; button and the current number of outstan...
MQTTClient::Ptr _mosq
std::shared_ptr< MQTTClient > Ptr
Definition: mqtt_client.h:18
ROSCPP_DECL void start()
std::unordered_map< std::string, PJ::MessageParserPtr > _parsers
The DataStreamer base classm used to read streaming of data.
std::shared_ptr< ParserFactoryPlugin > Ptr
QString _topic_to_parse
MQTT_Dialog * _dialog
ParserFactoryPlugin::Ptr _current_parser_creator
virtual const char * name() const override
Name of the plugin type, NOT the particular instance.
QAction * _notification_action
virtual bool isDebugPlugin() override
ROSCONSOLE_DECL void shutdown()
std::thread _mqtt_thread


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