QGIS API Documentation 3.41.0-Master (cea29feecf2)
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 Q_OBJECT
39
40 public:
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:
97 QgsTcpSocketSensorWidget( QWidget *parent );
98
99 QgsAbstractSensor *createSensor() override;
100 bool updateSensor( QgsAbstractSensor *sensor ) override;
101 bool setSensor( QgsAbstractSensor *sensor ) override;
102};
103
110class GUI_EXPORT QgsUdpSocketSensorWidget : public QgsAbstractSensorWidget, private Ui::WidgetUdpSocketSensor
111{
112 Q_OBJECT
113
114 public:
119 QgsUdpSocketSensorWidget( QWidget *parent );
120
121 QgsAbstractSensor *createSensor() override;
122 bool updateSensor( QgsAbstractSensor *sensor ) override;
123 bool setSensor( QgsAbstractSensor *sensor ) override;
124};
125
126#if defined( HAVE_QTSERIALPORT )
127
134class GUI_EXPORT QgsSerialPortSensorWidget : public QgsAbstractSensorWidget, private Ui::WidgetSerialPortSensor
135{
136 Q_OBJECT
137
138 public:
143 QgsSerialPortSensorWidget( QWidget *parent );
144
145 QgsAbstractSensor *createSensor() override;
146 bool updateSensor( QgsAbstractSensor *sensor ) override;
147 bool setSensor( QgsAbstractSensor *sensor ) override;
148
149 private:
150 void updateSerialPortDetails();
151};
152#endif
153
154#endif
156
157#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