QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgssensormanager.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssensormanager.h
3 ------------------
4 Date : March 2023
5 Copyright : (C) 2023 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
16#ifndef QGSSENSORMANAGER_H
17#define QGSSENSORMANAGER_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
21#include "qgis.h"
22#include "qgsabstractsensor.h"
23
24#include <QObject>
25#include <QDomElement>
26
27class QgsProject;
28
41class CORE_EXPORT QgsSensorManager : public QObject
42{
43 Q_OBJECT
44
45 public:
46
50 explicit QgsSensorManager( QObject *parent SIP_TRANSFERTHIS = nullptr );
51
52 ~QgsSensorManager() override;
53
57 void clear();
58
62 QList<QgsAbstractSensor *> sensors() const;
63
68 QgsAbstractSensor *sensor( const QString &id ) const;
69
78 void addSensor( QgsAbstractSensor *sensor SIP_TRANSFER );
79
84 bool removeSensor( const QString &id );
85
89 QStringList sensorNames() const;
90
94 QgsAbstractSensor::SensorData sensorData( const QString &name ) const;
95
99 QMap<QString, QgsAbstractSensor::SensorData> sensorsData() const;
100
106 bool readXml( const QDomElement &element, const QDomDocument &document );
107
112 QDomElement writeXml( QDomDocument &document ) const;
113
114 signals:
115
117 void sensorAdded( const QString &id );
118
120 void sensorAboutToBeRemoved( const QString &id );
121
123 void sensorRemoved( const QString &id );
124
126 void sensorNameChanged( const QString &id );
127
129 void sensorStatusChanged( const QString &id );
130
132 void sensorDataCaptured( const QString &id );
133
135 void sensorErrorOccurred( const QString &id );
136
137 private slots:
138
139 void handleSensorNameChanged();
140 void handleSensorStatusChanged();
141 void captureSensorData();
142 void handleSensorErrorOccurred( const QString &errorMessage );
143
144 private:
145
146 QList<QgsAbstractSensor *> mSensors;
147 QMap<QString, QgsAbstractSensor::SensorData> mSensorsData;
148
149};
150
151#endif // QGSSENSORMANAGER_H
An abstract base class for sensor classes.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107
Manages sensors.
void sensorRemoved(const QString &id)
Emitted when a sensor has been removed.
void sensorErrorOccurred(const QString &id)
Emitted when a sensor error has occurred.
void sensorNameChanged(const QString &id)
Emitted when a sensor name has changed.
void sensorDataCaptured(const QString &id)
Emitted when newly captured data from a sensor has occurred.
void sensorAdded(const QString &id)
Emitted when a sensor has been registered.
void sensorAboutToBeRemoved(const QString &id)
Emitted when a sensor is about to be removed.
void sensorStatusChanged(const QString &id)
Emitted when a sensor status has changed.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_TRANSFER
Definition qgis_sip.h:36
Contains details of a sensor data capture.