23 , mId( QUuid::createUuid().toString() )
95 QDomElement element = document.createElement( QStringLiteral(
"Sensor" ) );
96 element.setAttribute( QStringLiteral(
"id" ),
id() );
97 element.setAttribute( QStringLiteral(
"type" ),
type() );
98 element.setAttribute( QStringLiteral(
"name" ),
name() );
101 parentElement.appendChild( element );
108 if ( element.nodeName() != QLatin1String(
"Sensor" ) )
113 mId = element.attribute( QStringLiteral(
"id" ), QUuid::createUuid().toString() );
114 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.