16#ifndef QGSABSTRACTSENSOR_H
17#define QGSABSTRACTSENSOR_H
43 if ( item->type() == QLatin1String(
"tcp_socket" ) &&
dynamic_cast<QgsTcpSocketSensor *
>( item ) != NULL )
45 sipType = sipType_QgsTcpSocketSensor;
47 else if ( item->type() == QLatin1String(
"udp_socket" ) &&
dynamic_cast<QgsUdpSocketSensor *
>( item ) != NULL )
49 sipType = sipType_QgsUdpSocketSensor;
51#if defined( HAVE_QTSERIALPORT )
52 else if ( item->type() == QLatin1String(
"serial_port" ) &&
dynamic_cast<QgsSerialPortSensor *
>( item ) != NULL )
54 sipType = sipType_QgsSerialPortSensor;
59 sipType = sipType_QgsAbstractSensor;
99 QString
id()
const {
return mId; }
104 virtual QString
type()
const {
return QString(); }
109 QString name()
const;
114 void setName(
const QString &name );
129 void connectSensor();
134 void disconnectSensor();
149 QString errorString()
const;
156 bool writeXml( QDomElement &parentElement, QDomDocument &document )
const;
163 bool readXml(
const QDomElement &element,
const QDomDocument &document );
170 virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document )
const;
177 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.