QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
Signals | Public Member Functions | List of all members
QgsSensorManager Class Reference

Manages sensors. More...

#include <qgssensormanager.h>

Inheritance diagram for QgsSensorManager:
Inheritance graph
[legend]

Signals

void sensorAboutToBeRemoved (const QString &id)
 Emitted when a sensor is about to be removed.
 
void sensorAdded (const QString &id)
 Emitted when a sensor has been registered.
 
void sensorDataCaptured (const QString &id)
 Emitted when newly captured data from a sensor has occurred.
 
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 sensorRemoved (const QString &id)
 Emitted when a sensor has been removed.
 
void sensorStatusChanged (const QString &id)
 Emitted when a sensor status has changed.
 

Public Member Functions

 QgsSensorManager (QObject *parent=nullptr)
 Constructor for QgsSensorManager, with the specified parent object.
 
 ~QgsSensorManager () override
 
void addSensor (QgsAbstractSensor *sensor)
 Registers a new sensor.
 
void clear ()
 Deregisters and removes all sensors from the manager.
 
bool readXml (const QDomElement &element, const QDomDocument &document)
 Reads the manager's state from a DOM element, restoring all sensors present in the XML document.
 
bool removeSensor (const QString &id)
 Removes a registered sensor matching a given id.
 
QgsAbstractSensorsensor (const QString &id) const
 Returns a registered sensor pointer matching a given id.
 
QgsAbstractSensor::SensorData sensorData (const QString &name) const
 Returns the last captured data from a registered sensor matching a given name.
 
QStringList sensorNames () const
 Returns a list of registered sensor names.
 
QList< QgsAbstractSensor * > sensors () const
 Returns a list of pointers to all registered sensors.
 
QMap< QString, QgsAbstractSensor::SensorDatasensorsData () const
 Returns the last captured data of all registered sensors.
 
QDomElement writeXml (QDomDocument &document) const
 Returns a DOM element representing the state of the manager.
 

Detailed Description

Manages sensors.

QgsSensorManager handles the storage, serializing and deserializing of sensors. Usually this class is not constructed directly, but rather accessed through a QgsProject via QgsProject::sensorManager().

Since
QGIS 3.32

Definition at line 41 of file qgssensormanager.h.

Constructor & Destructor Documentation

◆ QgsSensorManager()

QgsSensorManager::QgsSensorManager ( QObject *  parent = nullptr)
explicit

Constructor for QgsSensorManager, with the specified parent object.

Definition at line 21 of file qgssensormanager.cpp.

◆ ~QgsSensorManager()

QgsSensorManager::~QgsSensorManager ( )
override

Definition at line 26 of file qgssensormanager.cpp.

Member Function Documentation

◆ addSensor()

void QgsSensorManager::addSensor ( QgsAbstractSensor sensor)

Registers a new sensor.

The sensor name does not require uniqueness; sensors will the same name will store their data in the same sensor name key, allowing for registration of sensors to cover multiple devices (e.g. two serial port sensors with alternative port name to cover two machines).

Note
Takes ownership of the sensor.

Definition at line 83 of file qgssensormanager.cpp.

◆ clear()

void QgsSensorManager::clear ( )

Deregisters and removes all sensors from the manager.

Definition at line 31 of file qgssensormanager.cpp.

◆ readXml()

bool QgsSensorManager::readXml ( const QDomElement &  element,
const QDomDocument &  document 
)

Reads the manager's state from a DOM element, restoring all sensors present in the XML document.

See also
writeXml()

Definition at line 160 of file qgssensormanager.cpp.

◆ removeSensor()

bool QgsSensorManager::removeSensor ( const QString &  id)

Removes a registered sensor matching a given id.

Returns
true if a sensor was removed.

Definition at line 99 of file qgssensormanager.cpp.

◆ sensor()

QgsAbstractSensor * QgsSensorManager::sensor ( const QString &  id) const

Returns a registered sensor pointer matching a given id.

If not matching sensor is found, a nullptr will be returned.

Definition at line 50 of file qgssensormanager.cpp.

◆ sensorAboutToBeRemoved

void QgsSensorManager::sensorAboutToBeRemoved ( const QString &  id)
signal

Emitted when a sensor is about to be removed.

◆ sensorAdded

void QgsSensorManager::sensorAdded ( const QString &  id)
signal

Emitted when a sensor has been registered.

◆ sensorData()

QgsAbstractSensor::SensorData QgsSensorManager::sensorData ( const QString &  name) const

Returns the last captured data from a registered sensor matching a given name.

Definition at line 63 of file qgssensormanager.cpp.

◆ sensorDataCaptured

void QgsSensorManager::sensorDataCaptured ( const QString &  id)
signal

Emitted when newly captured data from a sensor has occurred.

◆ sensorErrorOccurred

void QgsSensorManager::sensorErrorOccurred ( const QString &  id)
signal

Emitted when a sensor error has occurred.

◆ sensorNameChanged

void QgsSensorManager::sensorNameChanged ( const QString &  id)
signal

Emitted when a sensor name has changed.

◆ sensorNames()

QStringList QgsSensorManager::sensorNames ( ) const

Returns a list of registered sensor names.

Definition at line 73 of file qgssensormanager.cpp.

◆ sensorRemoved

void QgsSensorManager::sensorRemoved ( const QString &  id)
signal

Emitted when a sensor has been removed.

◆ sensors()

QList< QgsAbstractSensor * > QgsSensorManager::sensors ( ) const

Returns a list of pointers to all registered sensors.

Definition at line 45 of file qgssensormanager.cpp.

◆ sensorsData()

QMap< QString, QgsAbstractSensor::SensorData > QgsSensorManager::sensorsData ( ) const

Returns the last captured data of all registered sensors.

Definition at line 68 of file qgssensormanager.cpp.

◆ sensorStatusChanged

void QgsSensorManager::sensorStatusChanged ( const QString &  id)
signal

Emitted when a sensor status has changed.

◆ writeXml()

QDomElement QgsSensorManager::writeXml ( QDomDocument &  document) const

Returns a DOM element representing the state of the manager.

See also
readXml()

Definition at line 188 of file qgssensormanager.cpp.


The documentation for this class was generated from the following files: