16#ifndef QGSABSTRACTSENSOR_H
17#define QGSABSTRACTSENSOR_H
45 if ( item->type() == QLatin1String(
"tcp_socket" ) &&
dynamic_cast<QgsTcpSocketSensor *
>( item ) != NULL )
47 sipType = sipType_QgsTcpSocketSensor;
49 else if ( item->type() == QLatin1String(
"udp_socket" ) &&
dynamic_cast<QgsUdpSocketSensor *
>( item ) != NULL )
51 sipType = sipType_QgsUdpSocketSensor;
53#if defined( HAVE_QTSERIALPORT )
54 else if ( item->type() == QLatin1String(
"serial_port" ) &&
dynamic_cast<QgsSerialPortSensor *
>( item ) != NULL )
56 sipType = sipType_QgsSerialPortSensor;
61 sipType = sipType_QgsAbstractSensor;
101 QString
id()
const {
return mId; }
106 virtual QString
type()
const {
return QString(); }
111 QString name()
const;
116 void setName(
const QString &name );
131 void connectSensor();
136 void disconnectSensor();
151 QString errorString()
const;
158 bool writeXml( QDomElement &parentElement, QDomDocument &document )
const;
165 bool readXml(
const QDomElement &element,
const QDomDocument &document );
172 virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document )
const;
179 virtual bool readPropertiesFromElement(
const QDomElement &element,
const QDomDocument &document );
DeviceConnectionStatus
GPS connection status.
@ Disconnected
Device is disconnected.
An abstract base class for sensor classes.
QString id() const
Returns the sensor ID.
virtual void handleDisconnect()=0
Handles the disconnection from the sensor.
void statusChanged()
Emitted when the sensor status has changed.
virtual QString type() const
Returns the sensor type.
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.
QgsAbstractSensor::SensorData mData
virtual void handleConnect()=0
Handles the connection to the sensor.
void dataChanged()
Emitted when the captured sensor data has changed.
virtual ~QgsAbstractSensor()=default
A TCP socket sensor class.
A UDP socket sensor class.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
Contains details of a sensor data capture.
QVariant lastValue
Last captured sensor value stored as a QVariant.
QDateTime lastTimestamp
Timestamp of last captured sensor value.