QGIS API Documentation 3.41.0-Master (3440c17df1d)
|
A TCP socket sensor class. More...
#include <qgsiodevicesensor.h>
Public Member Functions | |
QgsTcpSocketSensor (QObject *parent=nullptr) | |
Constructor for a TCP socket sensor, bound to the specified parent. | |
~QgsTcpSocketSensor () override=default | |
QString | hostName () const |
Returns the host name the socket connects to. | |
int | port () const |
Returns the port the socket connects to. | |
bool | readPropertiesFromElement (const QDomElement &element, const QDomDocument &document) override |
Restores specific sensor type properties from a DOM element. | |
void | setHostName (const QString &hostName) |
Sets the host name the socket connects to. | |
void | setPort (int port) |
Sets the port the socket connects to. | |
QString | type () const override |
Returns the sensor type. | |
bool | writePropertiesToElement (QDomElement &element, QDomDocument &document) const override |
Write specific sensor type properties into a DOM element. | |
Public Member Functions inherited from QgsIODeviceSensor | |
QgsIODeviceSensor (QObject *parent=nullptr) | |
Constructor for a abstract QIODevice-based sensor, bound to the specified parent. | |
~QgsIODeviceSensor () override | |
QIODevice * | iODevice () const |
Returns the I/O device. | |
Public Member Functions inherited from QgsAbstractSensor | |
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. | |
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. | |
bool | writeXml (QDomElement &parentElement, QDomDocument &document) const |
Write generic sensor properties into a DOM element. | |
Static Public Member Functions | |
static QgsTcpSocketSensor * | create (QObject *parent) |
Returns a new TCP socket sensor. | |
Protected Member Functions | |
void | handleConnect () override |
Handles the connection to the sensor. | |
void | handleDisconnect () override |
Handles the disconnection from the sensor. | |
Protected Member Functions inherited from QgsIODeviceSensor | |
void | initIODevice (QIODevice *device) |
Initiates the I/O device. | |
Additional Inherited Members | |
Signals inherited from QgsAbstractSensor | |
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. | |
Protected Slots inherited from QgsIODeviceSensor | |
virtual void | parseData () |
Parses the data read from the device when available. | |
Protected Attributes inherited from QgsAbstractSensor | |
QgsAbstractSensor::SensorData | mData |
QString | mErrorString |
|
explicit |
Constructor for a TCP socket sensor, bound to the specified parent.
Definition at line 56 of file qgsiodevicesensor.cpp.
|
overridedefault |
|
static |
Returns a new TCP socket sensor.
The caller takes responsibility for deleting the returned object.
Definition at line 66 of file qgsiodevicesensor.cpp.
|
overrideprotectedvirtual |
Handles the connection to the sensor.
Implements QgsAbstractSensor.
Definition at line 102 of file qgsiodevicesensor.cpp.
|
overrideprotectedvirtual |
Handles the disconnection from the sensor.
Implements QgsAbstractSensor.
Definition at line 113 of file qgsiodevicesensor.cpp.
QString QgsTcpSocketSensor::hostName | ( | ) | const |
Returns the host name the socket connects to.
Definition at line 76 of file qgsiodevicesensor.cpp.
int QgsTcpSocketSensor::port | ( | ) | const |
Returns the port the socket connects to.
Definition at line 89 of file qgsiodevicesensor.cpp.
|
overridevirtual |
Restores specific sensor type properties from a DOM element.
element | DOM node corresponding to item (e.g. 'Sensor' element) |
document | DOM document |
Reimplemented from QgsAbstractSensor.
Definition at line 166 of file qgsiodevicesensor.cpp.
void QgsTcpSocketSensor::setHostName | ( | const QString & | hostName | ) |
Sets the host name the socket connects to.
hostName | the host name string (a domain name or an IP address) |
Definition at line 81 of file qgsiodevicesensor.cpp.
void QgsTcpSocketSensor::setPort | ( | int | port | ) |
Sets the port the socket connects to.
Definition at line 94 of file qgsiodevicesensor.cpp.
|
overridevirtual |
Returns the sensor type.
This will match the type string of the sensor class, as used by QgsSensorRegistry.
Reimplemented from QgsAbstractSensor.
Definition at line 71 of file qgsiodevicesensor.cpp.
|
overridevirtual |
Write specific sensor type properties into a DOM element.
element | DOM node corresponding to item (e.g. 'Sensor' element) |
document | DOM document |
Reimplemented from QgsAbstractSensor.
Definition at line 158 of file qgsiodevicesensor.cpp.