22#include "moc_qgsabstractsensor.cpp"
24using namespace Qt::StringLiterals;
28 , mId( QUuid::createUuid().toString() )
100 QDomElement element = document.createElement( u
"Sensor"_s );
101 element.setAttribute( u
"id"_s,
id() );
102 element.setAttribute( u
"type"_s,
type() );
103 element.setAttribute( u
"name"_s,
name() );
106 parentElement.appendChild( element );
113 if ( element.nodeName() !=
"Sensor"_L1 )
118 mId = element.attribute( u
"id"_s, QUuid::createUuid().toString() );
119 mName = element.attribute( u
"name"_s );
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.