QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
QgsTcpSocketSensor Class Reference

A TCP socket sensor class. More...

#include <qgsiodevicesensor.h>

Inheritance diagram for QgsTcpSocketSensor:
Inheritance graph
[legend]

Public Member Functions

 QgsTcpSocketSensor (QObject *parent=nullptr)
 Constructor for a TCP socket sensor, bound to the specified parent. More...
 
 ~QgsTcpSocketSensor () override=default
 
QString hostName () const
 Returns the host name the socket connects to. More...
 
int port () const
 Returns the port the socket connects to. More...
 
bool readPropertiesFromElement (const QDomElement &element, const QDomDocument &document) override
 Restores specific sensor type properties from a DOM element. More...
 
void setHostName (const QString &hostName)
 Sets the host name the socket connects to. More...
 
void setPort (int port)
 Sets the port the socket connects to. More...
 
QString type () const override
 Returns the sensor type. More...
 
bool writePropertiesToElement (QDomElement &element, QDomDocument &document) const override
 Write specific sensor type properties into a DOM element. More...
 
- Public Member Functions inherited from QgsIODeviceSensor
 QgsIODeviceSensor (QObject *parent=nullptr)
 Constructor for a abstract QIODevice-based sensor, bound to the specified parent. More...
 
 ~QgsIODeviceSensor () override
 
QIODevice * iODevice () const
 Returns the I/O device. More...
 
- Public Member Functions inherited from QgsAbstractSensor
 QgsAbstractSensor (QObject *parent=nullptr)
 Constructor for an abstract sensor, bound to the specified parent. More...
 
virtual ~QgsAbstractSensor ()=default
 
void connectSensor ()
 Connects the sensor to its source. More...
 
QgsAbstractSensor::SensorData data () const
 Returns the latest captured data from the sensor. More...
 
void disconnectSensor ()
 Disconnects the sensor from its source. More...
 
QString errorString () const
 Returns the last error message. More...
 
QString id () const
 Returns the sensor ID. More...
 
QString name () const
 Returns the user-friendly name identifying the sensor. More...
 
virtual bool readPropertiesFromElement (const QDomElement &element, const QDomDocument &document)
 Restores specific sensor type properties from a DOM element. More...
 
bool readXml (const QDomElement &element, const QDomDocument &document)
 Restores generic sensor details from a DOM element. More...
 
void setData (const QgsAbstractSensor::SensorData &data)
 Sets the latest captured data from the sensor. More...
 
void setName (const QString &name)
 Sets the user-friendly name identfying the sensor. More...
 
void setStatus (Qgis::DeviceConnectionStatus status)
 Sets the current sensor status. More...
 
Qgis::DeviceConnectionStatus status () const
 Returns the current sensor status. More...
 
virtual QString type () const
 Returns the sensor type. More...
 
virtual bool writePropertiesToElement (QDomElement &element, QDomDocument &document) const
 Write specific sensor type properties into a DOM element. More...
 
bool writeXml (QDomElement &parentElement, QDomDocument &document) const
 Write generic sensor properties into a DOM element. More...
 

Static Public Member Functions

static QgsTcpSocketSensorcreate (QObject *parent)
 Returns a new TCP socket sensor. More...
 

Protected Member Functions

void handleConnect () override
 Handles the connection to the sensor. More...
 
void handleDisconnect () override
 Handles the disconnection from the sensor. More...
 
- Protected Member Functions inherited from QgsIODeviceSensor
void initIODevice (QIODevice *device)
 Initiates the I/O device. More...
 
virtual void handleConnect ()=0
 Handles the connection to the sensor. More...
 
virtual void handleDisconnect ()=0
 Handles the disconnection from the sensor. More...
 

Additional Inherited Members

- Signals inherited from QgsAbstractSensor
void dataChanged ()
 Emitted when the captured sensor data has changed. More...
 
void errorOccurred (const QString &errorString)
 Emitted when an error has occurred. The errorString describes the error. More...
 
void nameChanged ()
 Emitted when the sensor name has changed. More...
 
void statusChanged ()
 Emitted when the sensor status has changed. More...
 
- Protected Slots inherited from QgsIODeviceSensor
virtual void parseData ()
 Parses the data read from the device when available. More...
 
- Protected Attributes inherited from QgsAbstractSensor
QgsAbstractSensor::SensorData mData
 
QString mErrorString
 

Detailed Description

A TCP socket sensor class.

Since
QGIS 3.32

Definition at line 85 of file qgsiodevicesensor.h.

Constructor & Destructor Documentation

◆ QgsTcpSocketSensor()

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

Constructor for a TCP socket sensor, bound to the specified parent.

Definition at line 55 of file qgsiodevicesensor.cpp.

◆ ~QgsTcpSocketSensor()

QgsTcpSocketSensor::~QgsTcpSocketSensor ( )
overridedefault

Member Function Documentation

◆ create()

QgsTcpSocketSensor * QgsTcpSocketSensor::create ( QObject *  parent)
static

Returns a new TCP socket sensor.

The caller takes responsibility for deleting the returned object.

Definition at line 65 of file qgsiodevicesensor.cpp.

◆ handleConnect()

void QgsTcpSocketSensor::handleConnect ( )
overrideprotectedvirtual

Handles the connection to the sensor.

Note
Triggered by calling connectSensor()

Implements QgsAbstractSensor.

Definition at line 101 of file qgsiodevicesensor.cpp.

◆ handleDisconnect()

void QgsTcpSocketSensor::handleDisconnect ( )
overrideprotectedvirtual

Handles the disconnection from the sensor.

Note
Triggered by calling disconnectSensor()

Implements QgsAbstractSensor.

Definition at line 112 of file qgsiodevicesensor.cpp.

◆ hostName()

QString QgsTcpSocketSensor::hostName ( ) const

Returns the host name the socket connects to.

Definition at line 75 of file qgsiodevicesensor.cpp.

◆ port()

int QgsTcpSocketSensor::port ( ) const

Returns the port the socket connects to.

Definition at line 88 of file qgsiodevicesensor.cpp.

◆ readPropertiesFromElement()

bool QgsTcpSocketSensor::readPropertiesFromElement ( const QDomElement &  element,
const QDomDocument &  document 
)
overridevirtual

Restores specific sensor type properties from a DOM element.

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

Reimplemented from QgsAbstractSensor.

Definition at line 165 of file qgsiodevicesensor.cpp.

◆ setHostName()

void QgsTcpSocketSensor::setHostName ( const QString &  hostName)

Sets the host name the socket connects to.

Parameters
hostNamethe host name string (a domain name or an IP address)

Definition at line 80 of file qgsiodevicesensor.cpp.

◆ setPort()

void QgsTcpSocketSensor::setPort ( int  port)

Sets the port the socket connects to.

Definition at line 93 of file qgsiodevicesensor.cpp.

◆ type()

QString QgsTcpSocketSensor::type ( ) const
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 70 of file qgsiodevicesensor.cpp.

◆ writePropertiesToElement()

bool QgsTcpSocketSensor::writePropertiesToElement ( QDomElement &  element,
QDomDocument &  document 
) const
overridevirtual

Write specific sensor type properties into a DOM element.

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

Reimplemented from QgsAbstractSensor.

Definition at line 157 of file qgsiodevicesensor.cpp.


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