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 else if ( item->type() == QLatin1String(
"serial_port" ) &&
dynamic_cast<QgsSerialPortSensor *
>( item ) != NULL )
55 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.