QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
Classes | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QgsAbstractSensor Class Referenceabstract

An abstract base class for sensor classes. More...

#include <qgsabstractsensor.h>

Inheritance diagram for QgsAbstractSensor:
Inheritance graph
[legend]

Classes

struct  SensorData
 Contains details of a sensor data capture. More...
 

Signals

void dataChanged ()
 Emitted when the captured sensor data has changed.
 
void errorOccurred (const QString &errorString)
 Emitted when an error has occurred. The errorString describes the error.
 
void nameChanged ()
 Emitted when the sensor name has changed.
 
void statusChanged ()
 Emitted when the sensor status has changed.
 

Public Member Functions

 QgsAbstractSensor (QObject *parent=nullptr)
 Constructor for an abstract sensor, bound to the specified parent.
 
virtual ~QgsAbstractSensor ()=default
 
void connectSensor ()
 Connects the sensor to its source.
 
QgsAbstractSensor::SensorData data () const
 Returns the latest captured data from the sensor.
 
void disconnectSensor ()
 Disconnects the sensor from its source.
 
QString errorString () const
 Returns the last error message.
 
QString id () const
 Returns the sensor ID.
 
QString name () const
 Returns the user-friendly name identifying the sensor.
 
virtual bool readPropertiesFromElement (const QDomElement &element, const QDomDocument &document)
 Restores specific sensor type properties from a DOM element.
 
bool readXml (const QDomElement &element, const QDomDocument &document)
 Restores generic sensor details from a DOM element.
 
void setData (const QgsAbstractSensor::SensorData &data)
 Sets the latest captured data from the sensor.
 
void setName (const QString &name)
 Sets the user-friendly name identfying the sensor.
 
void setStatus (Qgis::DeviceConnectionStatus status)
 Sets the current sensor status.
 
Qgis::DeviceConnectionStatus status () const
 Returns the current sensor status.
 
virtual QString type () const
 Returns the sensor type.
 
virtual bool writePropertiesToElement (QDomElement &element, QDomDocument &document) const
 Write specific sensor type properties into a DOM element.
 
bool writeXml (QDomElement &parentElement, QDomDocument &document) const
 Write generic sensor properties into a DOM element.
 

Protected Member Functions

virtual void handleConnect ()=0
 Handles the connection to the sensor.
 
virtual void handleDisconnect ()=0
 Handles the disconnection from the sensor.
 

Protected Attributes

QgsAbstractSensor::SensorData mData
 
QString mErrorString
 

Detailed Description

An abstract base class for sensor classes.

Since
QGIS 3.32

Definition at line 33 of file qgsabstractsensor.h.

Constructor & Destructor Documentation

◆ QgsAbstractSensor()

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

Constructor for an abstract sensor, bound to the specified parent.

Definition at line 21 of file qgsabstractsensor.cpp.

◆ ~QgsAbstractSensor()

virtual QgsAbstractSensor::~QgsAbstractSensor ( )
virtualdefault

Member Function Documentation

◆ connectSensor()

void QgsAbstractSensor::connectSensor ( )

Connects the sensor to its source.

Definition at line 71 of file qgsabstractsensor.cpp.

◆ data()

QgsAbstractSensor::SensorData QgsAbstractSensor::data ( ) const

Returns the latest captured data from the sensor.

Definition at line 55 of file qgsabstractsensor.cpp.

◆ dataChanged

void QgsAbstractSensor::dataChanged ( )
signal

Emitted when the captured sensor data has changed.

◆ disconnectSensor()

void QgsAbstractSensor::disconnectSensor ( )

Disconnects the sensor from its source.

Definition at line 77 of file qgsabstractsensor.cpp.

◆ errorOccurred

void QgsAbstractSensor::errorOccurred ( const QString &  errorString)
signal

Emitted when an error has occurred. The errorString describes the error.

◆ errorString()

QString QgsAbstractSensor::errorString ( ) const

Returns the last error message.

Definition at line 66 of file qgsabstractsensor.cpp.

◆ handleConnect()

virtual void QgsAbstractSensor::handleConnect ( )
protectedpure virtual

Handles the connection to the sensor.

Note
Triggered by calling connectSensor()

Implemented in QgsTcpSocketSensor, and QgsUdpSocketSensor.

◆ handleDisconnect()

virtual void QgsAbstractSensor::handleDisconnect ( )
protectedpure virtual

Handles the disconnection from the sensor.

Note
Triggered by calling disconnectSensor()

Implemented in QgsTcpSocketSensor, and QgsUdpSocketSensor.

◆ id()

QString QgsAbstractSensor::id ( ) const
inline

Returns the sensor ID.

Note
This is a autogenerated unique string identifying an individual sensor.

Definition at line 101 of file qgsabstractsensor.h.

◆ name()

QString QgsAbstractSensor::name ( ) const

Returns the user-friendly name identifying the sensor.

Definition at line 27 of file qgsabstractsensor.cpp.

◆ nameChanged

void QgsAbstractSensor::nameChanged ( )
signal

Emitted when the sensor name has changed.

◆ readPropertiesFromElement()

bool QgsAbstractSensor::readPropertiesFromElement ( const QDomElement &  element,
const QDomDocument &  document 
)
virtual

Restores specific sensor type properties from a DOM element.

Parameters
elementDOM node corresponding to item (e.g. 'Sensor' element)
documentDOM document

Reimplemented in QgsTcpSocketSensor, and QgsUdpSocketSensor.

Definition at line 88 of file qgsabstractsensor.cpp.

◆ readXml()

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

Restores generic sensor details from a DOM element.

Parameters
elementDOM node corresponding to item (e.g. 'Sensor' element)
documentDOM document

Definition at line 106 of file qgsabstractsensor.cpp.

◆ setData()

void QgsAbstractSensor::setData ( const QgsAbstractSensor::SensorData data)

Sets the latest captured data from the sensor.

Definition at line 60 of file qgsabstractsensor.cpp.

◆ setName()

void QgsAbstractSensor::setName ( const QString &  name)

Sets the user-friendly name identfying the sensor.

Definition at line 32 of file qgsabstractsensor.cpp.

◆ setStatus()

void QgsAbstractSensor::setStatus ( Qgis::DeviceConnectionStatus  status)

Sets the current sensor status.

Definition at line 46 of file qgsabstractsensor.cpp.

◆ status()

Qgis::DeviceConnectionStatus QgsAbstractSensor::status ( ) const

Returns the current sensor status.

Definition at line 41 of file qgsabstractsensor.cpp.

◆ statusChanged

void QgsAbstractSensor::statusChanged ( )
signal

Emitted when the sensor status has changed.

◆ type()

virtual QString QgsAbstractSensor::type ( ) const
inlinevirtual

Returns the sensor type.

This will match the type string of the sensor class, as used by QgsSensorRegistry.

Reimplemented in QgsTcpSocketSensor, and QgsUdpSocketSensor.

Definition at line 106 of file qgsabstractsensor.h.

◆ writePropertiesToElement()

bool QgsAbstractSensor::writePropertiesToElement ( QDomElement &  element,
QDomDocument &  document 
) const
virtual

Write specific sensor type properties into a DOM element.

Parameters
elementDOM node corresponding to item (e.g. 'Sensor' element)
documentDOM document

Reimplemented in QgsTcpSocketSensor, and QgsUdpSocketSensor.

Definition at line 83 of file qgsabstractsensor.cpp.

◆ writeXml()

bool QgsAbstractSensor::writeXml ( QDomElement &  parentElement,
QDomDocument &  document 
) const

Write generic sensor properties into a DOM element.

Parameters
parentElementparent DOM element (e.g 'Sensors' element)
documentDOM document

Definition at line 93 of file qgsabstractsensor.cpp.

Member Data Documentation

◆ mData

QgsAbstractSensor::SensorData QgsAbstractSensor::mData
protected

Definition at line 209 of file qgsabstractsensor.h.

◆ mErrorString

QString QgsAbstractSensor::mErrorString
protected

Definition at line 210 of file qgsabstractsensor.h.


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