Gazebo Gui

API Reference

7.2.2
Publisher.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef GZ_GUI_PLUGINS_PUBLISHER_HH_
19 #define GZ_GUI_PLUGINS_PUBLISHER_HH_
20 
21 #include <memory>
22 
23 #include "gz/gui/Plugin.hh"
24 
25 #ifndef _WIN32
26 # define Publisher_EXPORTS_API
27 #else
28 # if (defined(Publisher_EXPORTS))
29 # define Publisher_EXPORTS_API __declspec(dllexport)
30 # else
31 # define Publisher_EXPORTS_API __declspec(dllimport)
32 # endif
33 #endif
34 
35 namespace gz::gui::plugins
36 {
37  class PublisherPrivate;
38 
43  class Publisher_EXPORTS_API Publisher : public Plugin
44  {
45  Q_OBJECT
46 
48  Q_PROPERTY(
49  QString msgType
50  READ MsgType
51  WRITE SetMsgType
52  NOTIFY MsgTypeChanged
53  )
54 
55 
56  Q_PROPERTY(
57  QString msgData
58  READ MsgData
59  WRITE SetMsgData
60  NOTIFY MsgDataChanged
61  )
62 
64  Q_PROPERTY(
65  QString topic
66  READ Topic
67  WRITE SetTopic
68  NOTIFY TopicChanged
69  )
70 
72  Q_PROPERTY(
73  double frequency
74  READ Frequency
75  WRITE SetFrequency
76  NOTIFY FrequencyChanged
77  )
78 
80  public: Publisher();
81 
83  public: virtual ~Publisher();
84 
85  // Documentation inherited
86  public: virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem);
87 
90  public slots: void OnPublish(const bool _checked);
91 
95  public: Q_INVOKABLE QString MsgType() const;
96 
100  public: Q_INVOKABLE void SetMsgType(const QString &_msgType);
101 
103  signals: void MsgTypeChanged();
104 
108  public: Q_INVOKABLE QString MsgData() const;
109 
113  public: Q_INVOKABLE void SetMsgData(const QString &_msgData);
114 
116  signals: void MsgDataChanged();
117 
121  public: Q_INVOKABLE QString Topic() const;
122 
126  public: Q_INVOKABLE void SetTopic(const QString &_topic);
127 
129  signals: void TopicChanged();
130 
133  public: Q_INVOKABLE double Frequency() const;
134 
137  public: Q_INVOKABLE void SetFrequency(const double _frequency);
138 
140  signals: void FrequencyChanged();
141 
144  private: std::unique_ptr<PublisherPrivate> dataPtr;
145  };
146 } // namespace gz::gui::plugins
147 
148 #endif // GZ_GUI_PLUGINS_PUBLISHER_HH_