QGIS API Documentation 3.99.0-Master (26c88405ac0)
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 "qgsconfig.h"
19#include "ui_widget_serialportsensor.h"
20#include "ui_widget_tcpsocketsensor.h"
21#include "ui_widget_udpsocketsensor.h"
22
23#include "qgis_gui.h"
24#include "qgis_sip.h"
25#include "qgsabstractsensor.h"
26
27#include <QWidget>
28
35class GUI_EXPORT QgsAbstractSensorWidget : public QWidget
36{
37 Q_OBJECT
38
39 public:
40
45 QgsAbstractSensorWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
46
51
59 virtual bool updateSensor( QgsAbstractSensor *sensor ) = 0;
60
69 virtual bool setSensor( QgsAbstractSensor *sensor ) = 0;
70
71 signals:
72
76 void changed();
77};
78
79#ifndef SIP_RUN
81
88class GUI_EXPORT QgsTcpSocketSensorWidget : public QgsAbstractSensorWidget, private Ui::WidgetTcpSocketSensor
89{
90 Q_OBJECT
91
92 public:
93
98 QgsTcpSocketSensorWidget( QWidget *parent );
99
100 QgsAbstractSensor *createSensor() override;
101 bool updateSensor( QgsAbstractSensor *sensor ) override;
102 bool setSensor( QgsAbstractSensor *sensor ) override;
103};
104
111class GUI_EXPORT QgsUdpSocketSensorWidget : public QgsAbstractSensorWidget, private Ui::WidgetUdpSocketSensor
112{
113 Q_OBJECT
114
115 public:
116
121 QgsUdpSocketSensorWidget( QWidget *parent );
122
123 QgsAbstractSensor *createSensor() override;
124 bool updateSensor( QgsAbstractSensor *sensor ) override;
125 bool setSensor( QgsAbstractSensor *sensor ) override;
126};
127
128#if defined( HAVE_QTSERIALPORT )
129
136class GUI_EXPORT QgsSerialPortSensorWidget : public QgsAbstractSensorWidget, private Ui::WidgetSerialPortSensor
137{
138 Q_OBJECT
139
140 public:
141
146 QgsSerialPortSensorWidget( QWidget *parent );
147
148 QgsAbstractSensor *createSensor() override;
149 bool updateSensor( QgsAbstractSensor *sensor ) override;
150 bool setSensor( QgsAbstractSensor *sensor ) override;
151
152 private:
153 void updateSerialPortDetails();
154};
155#endif
156
157#endif
159
160#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.
QgsAbstractSensorWidget(QWidget *parent=nullptr)
Constructor for QgsAbstractSensorWidget.
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 sensors.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_FACTORY
Definition qgis_sip.h:84