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  bool _running;
55 
56  std::unordered_map<std::string, PJ::MessageParserPtr> _parsers;
57 
59 
60  std::thread _mqtt_thread;
61  QString _protocol;
62 
63  QString _topic_to_parse;
64 
66  int _failed_parsing = 0;
67 
70 };
71 
72 #endif // DATASTREAM_MQTT_H
MQTT_Dialog
Definition: mqtt_dialog.h:12
DataStreamMQTT::notificationAction
std::pair< QAction *, int > notificationAction() override
Gets the action to execute when clicking the 'notifications' button and the current number of outstan...
Definition: datastream_mqtt.h:42
DataStreamMQTT::_mosq
MQTTClient::Ptr _mosq
Definition: datastream_mqtt.h:58
DataStreamMQTT::_notification_action
QAction * _notification_action
Definition: datastream_mqtt.h:65
mqtt_dialog.h
DataStreamMQTT::isDebugPlugin
virtual bool isDebugPlugin() override
Definition: datastream_mqtt.h:37
DataStreamMQTT::_current_parser_creator
ParserFactoryPlugin::Ptr _current_parser_creator
Definition: datastream_mqtt.h:69
DataStreamMQTT
Definition: datastream_mqtt.h:15
PJ::DataStreamer
The DataStreamer base classm used to read streaming of data.
Definition: datastreamer_base.h:25
DataStreamMQTT::_running
bool _running
Definition: datastream_mqtt.h:54
shutdown
ROSCONSOLE_DECL void shutdown()
MQTTClient::Ptr
std::shared_ptr< MQTTClient > Ptr
Definition: mqtt_client.h:19
PJ::ParserFactoryPlugin::Ptr
std::shared_ptr< ParserFactoryPlugin > Ptr
Definition: messageparser_base.h:142
start
ROSCPP_DECL void start()
DataStreamMQTT::_protocol
QString _protocol
Definition: datastream_mqtt.h:61
PJ
Definition: dataloader_base.h:16
DataStreamMQTT::_mqtt_thread
std::thread _mqtt_thread
Definition: datastream_mqtt.h:60
DataStreamMQTT::name
virtual const char * name() const override
Name of the plugin type, NOT the particular instance.
Definition: datastream_mqtt.h:32
DataStreamMQTT::_topic_to_parse
QString _topic_to_parse
Definition: datastream_mqtt.h:63
datastreamer_base.h
DataStreamMQTT::_parsers
std::unordered_map< std::string, PJ::MessageParserPtr > _parsers
Definition: datastream_mqtt.h:56
messageparser_base.h
DataStreamMQTT::_dialog
MQTT_Dialog * _dialog
Definition: datastream_mqtt.h:68


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