QGIS API Documentation 3.41.0-Master (3440c17df1d)
|
An abstract base class for sensor classes. More...
#include <qgsabstractsensor.h>
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 |
An abstract base class for sensor classes.
Definition at line 33 of file qgsabstractsensor.h.
|
explicit |
Constructor for an abstract sensor, bound to the specified parent.
Definition at line 22 of file qgsabstractsensor.cpp.
|
virtualdefault |
void QgsAbstractSensor::connectSensor | ( | ) |
Connects the sensor to its source.
Definition at line 72 of file qgsabstractsensor.cpp.
QgsAbstractSensor::SensorData QgsAbstractSensor::data | ( | ) | const |
Returns the latest captured data from the sensor.
Definition at line 56 of file qgsabstractsensor.cpp.
|
signal |
Emitted when the captured sensor data has changed.
void QgsAbstractSensor::disconnectSensor | ( | ) |
Disconnects the sensor from its source.
Definition at line 78 of file qgsabstractsensor.cpp.
|
signal |
Emitted when an error has occurred. The errorString describes the error.
QString QgsAbstractSensor::errorString | ( | ) | const |
Returns the last error message.
Definition at line 67 of file qgsabstractsensor.cpp.
|
protectedpure virtual |
Handles the connection to the sensor.
Implemented in QgsTcpSocketSensor, and QgsUdpSocketSensor.
|
protectedpure virtual |
Handles the disconnection from the sensor.
Implemented in QgsTcpSocketSensor, and QgsUdpSocketSensor.
|
inline |
Returns the sensor ID.
Definition at line 101 of file qgsabstractsensor.h.
QString QgsAbstractSensor::name | ( | ) | const |
Returns the user-friendly name identifying the sensor.
Definition at line 28 of file qgsabstractsensor.cpp.
|
signal |
Emitted when the sensor name has changed.
|
virtual |
Restores specific sensor type properties from a DOM element.
element | DOM node corresponding to item (e.g. 'Sensor' element) |
document | DOM document |
Reimplemented in QgsTcpSocketSensor, and QgsUdpSocketSensor.
Definition at line 89 of file qgsabstractsensor.cpp.
bool QgsAbstractSensor::readXml | ( | const QDomElement & | element, |
const QDomDocument & | document | ||
) |
Restores generic sensor details from a DOM element.
element | DOM node corresponding to item (e.g. 'Sensor' element) |
document | DOM document |
Definition at line 107 of file qgsabstractsensor.cpp.
void QgsAbstractSensor::setData | ( | const QgsAbstractSensor::SensorData & | data | ) |
Sets the latest captured data from the sensor.
Definition at line 61 of file qgsabstractsensor.cpp.
void QgsAbstractSensor::setName | ( | const QString & | name | ) |
Sets the user-friendly name identfying the sensor.
Definition at line 33 of file qgsabstractsensor.cpp.
void QgsAbstractSensor::setStatus | ( | Qgis::DeviceConnectionStatus | status | ) |
Sets the current sensor status.
Definition at line 47 of file qgsabstractsensor.cpp.
Qgis::DeviceConnectionStatus QgsAbstractSensor::status | ( | ) | const |
Returns the current sensor status.
Definition at line 42 of file qgsabstractsensor.cpp.
|
signal |
Emitted when the sensor status has changed.
|
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.
|
virtual |
Write specific sensor type properties into a DOM element.
element | DOM node corresponding to item (e.g. 'Sensor' element) |
document | DOM document |
Reimplemented in QgsTcpSocketSensor, and QgsUdpSocketSensor.
Definition at line 84 of file qgsabstractsensor.cpp.
bool QgsAbstractSensor::writeXml | ( | QDomElement & | parentElement, |
QDomDocument & | document | ||
) | const |
Write generic sensor properties into a DOM element.
parentElement | parent DOM element (e.g 'Sensors' element) |
document | DOM document |
Definition at line 94 of file qgsabstractsensor.cpp.
|
protected |
Definition at line 209 of file qgsabstractsensor.h.
|
protected |
Definition at line 210 of file qgsabstractsensor.h.