QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgssensorwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssensorwidget.h
3 ---------------------
4 begin : March 2023
5 copyright : (C) 2023 by Mathieu Pellerin
6 email : mathieu at opengis dot ch
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15#ifndef QGSSENSORWIDGET_H
16#define QGSSENSORWIDGET_H
17
18#include "ui_widget_tcpsocketsensor.h"
19#include "ui_widget_udpsocketsensor.h"
20#include "ui_widget_serialportsensor.h"
21
22#include "qgsconfig.h"
23
24#include "qgis_sip.h"
25#include "qgis_gui.h"
26#include "qgsabstractsensor.h"
27
28#include <QWidget>
29
36class GUI_EXPORT QgsAbstractSensorWidget : public QWidget
37{
38
39 Q_OBJECT
40
41 public:
42
47 QgsAbstractSensorWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
48
53
61 virtual bool updateSensor( QgsAbstractSensor *sensor ) = 0;
62
71 virtual bool setSensor( QgsAbstractSensor *sensor ) = 0;
72
73 signals:
74
78 void changed();
79};
80
81#ifndef SIP_RUN
83
90class GUI_EXPORT QgsTcpSocketSensorWidget : public QgsAbstractSensorWidget, private Ui::WidgetTcpSocketSensor
91{
92
93 Q_OBJECT
94
95 public:
96
101 QgsTcpSocketSensorWidget( QWidget *parent );
102
103 QgsAbstractSensor *createSensor() override;
104 bool updateSensor( QgsAbstractSensor *sensor ) override;
105 bool setSensor( QgsAbstractSensor *sensor ) override;
106};
107
114class GUI_EXPORT QgsUdpSocketSensorWidget : public QgsAbstractSensorWidget, private Ui::WidgetUdpSocketSensor
115{
116
117 Q_OBJECT
118
119 public:
120
125 QgsUdpSocketSensorWidget( QWidget *parent );
126
127 QgsAbstractSensor *createSensor() override;
128 bool updateSensor( QgsAbstractSensor *sensor ) override;
129 bool setSensor( QgsAbstractSensor *sensor ) override;
130};
131
132#if defined( HAVE_QTSERIALPORT )
133
140class GUI_EXPORT QgsSerialPortSensorWidget : public QgsAbstractSensorWidget, private Ui::WidgetSerialPortSensor
141{
142
143 Q_OBJECT
144
145 public:
146
151 QgsSerialPortSensorWidget( QWidget *parent );
152
153 QgsAbstractSensor *createSensor() override;
154 bool updateSensor( QgsAbstractSensor *sensor ) override;
155 bool setSensor( QgsAbstractSensor *sensor ) override;
156
157 private:
158
159 void updateSerialPortDetails();
160};
161#endif
162
163#endif
165
166#endif // QGSSENSORWIDGET_H
Base class for widgets which allow control over the properties of sensors.
virtual QgsAbstractSensor * createSensor()=0
Creates a new sensor matching the settings defined in the widget.
void changed()
Emitted whenever configuration changes happened on this sensor configuration.
virtual bool setSensor(QgsAbstractSensor *sensor)=0
Sets the widget settings to match a given sensor.
virtual bool updateSensor(QgsAbstractSensor *sensor)=0
Updates an existing sensor to match the settings defined in the widget.
An abstract base class for sensor classes.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_FACTORY
Definition qgis_sip.h:76