QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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:
44 QgsAbstractSensorWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
45
50
58 virtual bool updateSensor( QgsAbstractSensor *sensor ) = 0;
59
68 virtual bool setSensor( QgsAbstractSensor *sensor ) = 0;
69
70 signals:
71
75 void changed();
76};
77
78#ifndef SIP_RUN
80
87class GUI_EXPORT QgsTcpSocketSensorWidget : public QgsAbstractSensorWidget, private Ui::WidgetTcpSocketSensor
88{
89 Q_OBJECT
90
91 public:
96 QgsTcpSocketSensorWidget( QWidget *parent );
97
98 QgsAbstractSensor *createSensor() override;
99 bool updateSensor( QgsAbstractSensor *sensor ) override;
100 bool setSensor( QgsAbstractSensor *sensor ) override;
101};
102
109class GUI_EXPORT QgsUdpSocketSensorWidget : public QgsAbstractSensorWidget, private Ui::WidgetUdpSocketSensor
110{
111 Q_OBJECT
112
113 public:
118 QgsUdpSocketSensorWidget( QWidget *parent );
119
120 QgsAbstractSensor *createSensor() override;
121 bool updateSensor( QgsAbstractSensor *sensor ) override;
122 bool setSensor( QgsAbstractSensor *sensor ) override;
123};
124
125#if defined( HAVE_QTSERIALPORT )
126
133class GUI_EXPORT QgsSerialPortSensorWidget : public QgsAbstractSensorWidget, private Ui::WidgetSerialPortSensor
134{
135 Q_OBJECT
136
137 public:
142 QgsSerialPortSensorWidget( QWidget *parent );
143
144 QgsAbstractSensor *createSensor() override;
145 bool updateSensor( QgsAbstractSensor *sensor ) override;
146 bool setSensor( QgsAbstractSensor *sensor ) override;
147
148 private:
149 void updateSerialPortDetails();
150};
151#endif
152
153#endif
155
156#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