18#include "moc_qgsabstractsensor.cpp"
24 , mId( QUuid::createUuid().toString() )
96 QDomElement element = document.createElement( QStringLiteral(
"Sensor" ) );
97 element.setAttribute( QStringLiteral(
"id" ),
id() );
98 element.setAttribute( QStringLiteral(
"type" ),
type() );
99 element.setAttribute( QStringLiteral(
"name" ),
name() );
102 parentElement.appendChild( element );
109 if ( element.nodeName() != QLatin1String(
"Sensor" ) )
114 mId = element.attribute( QStringLiteral(
"id" ), QUuid::createUuid().toString() );
115 mName = element.attribute( QStringLiteral(
"name" ) );
DeviceConnectionStatus
GPS connection status.
@ Connecting
Device is connecting.
@ Disconnected
Device is disconnected.
QgsAbstractSensor(QObject *parent=nullptr)
Constructor for an abstract sensor, bound to the specified parent.
Qgis::DeviceConnectionStatus status() const
Returns the current sensor status.
void connectSensor()
Connects the sensor to its source.
QgsAbstractSensor::SensorData data() const
Returns the latest captured data from the sensor.
virtual void handleDisconnect()=0
Handles the disconnection from the sensor.
void statusChanged()
Emitted when the sensor status has changed.
void setStatus(Qgis::DeviceConnectionStatus status)
Sets the current sensor status.
void disconnectSensor()
Disconnects the sensor from its source.
QString name() const
Returns the user-friendly name identifying the sensor.
virtual QString type() const
Returns the sensor type.
virtual bool writePropertiesToElement(QDomElement &element, QDomDocument &document) const
Write specific sensor type properties into a DOM element.
void nameChanged()
Emitted when the sensor name has changed.
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.
QgsAbstractSensor::SensorData mData
QString errorString() const
Returns the last error message.
virtual void handleConnect()=0
Handles the connection to the sensor.
virtual bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document)
Restores specific sensor type properties from a DOM element.
void dataChanged()
Emitted when the captured sensor data has changed.
void setName(const QString &name)
Sets the user-friendly name identfying the sensor.
bool writeXml(QDomElement &parentElement, QDomDocument &document) const
Write generic sensor properties into a DOM element.
Contains details of a sensor data capture.