1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/sensor/qgsabstractsensor.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsAbstractSensor : QObject
{
%Docstring(signature="appended")
An abstract base class for sensor classes
.. versionadded:: 3.32
%End
%TypeHeaderCode
#include "qgsabstractsensor.h"
#include "qgsiodevicesensor.h"
#include "qgssensorregistry.h"
%End
%ConvertToSubClassCode
if ( QgsAbstractSensor *item = qobject_cast< QgsAbstractSensor * >( sipCpp ) )
{
if ( item->type() == QLatin1String( "tcp_socket" ) && dynamic_cast<QgsTcpSocketSensor *>( item ) != NULL )
{
sipType = sipType_QgsTcpSocketSensor;
}
else if ( item->type() == QLatin1String( "udp_socket" ) && dynamic_cast<QgsUdpSocketSensor *>( item ) != NULL )
{
sipType = sipType_QgsUdpSocketSensor;
}
#if defined( HAVE_QTSERIALPORT )
else if ( item->type() == QLatin1String( "serial_port" ) && dynamic_cast<QgsSerialPortSensor *>( item ) != NULL )
{
sipType = sipType_QgsSerialPortSensor;
}
#endif
else
{
sipType = sipType_QgsAbstractSensor;
}
}
else
{
sipType = NULL;
}
%End
public:
struct SensorData
{
QVariant lastValue;
QDateTime lastTimestamp;
};
explicit QgsAbstractSensor( QObject *parent /TransferThis/ = 0 );
%Docstring
Constructor for an abstract sensor, bound to the specified ``parent``.
%End
virtual ~QgsAbstractSensor();
QString id() const;
%Docstring
Returns the sensor ID.
.. note::
This is a autogenerated unique string identifying an individual sensor.
%End
virtual QString type() const;
%Docstring
Returns the sensor type. This will match the type string of the sensor class, as used by :py:class:`QgsSensorRegistry`.
%End
QString name() const;
%Docstring
Returns the user-friendly name identifying the sensor.
%End
void setName( const QString &name );
%Docstring
Sets the user-friendly name identfying the sensor.
%End
Qgis::DeviceConnectionStatus status() const;
%Docstring
Returns the current sensor status.
%End
void setStatus( Qgis::DeviceConnectionStatus status );
%Docstring
Sets the current sensor ``status``.
%End
void connectSensor();
%Docstring
Connects the sensor to its source.
%End
void disconnectSensor();
%Docstring
Disconnects the sensor from its source.
%End
QgsAbstractSensor::SensorData data() const;
%Docstring
Returns the latest captured data from the sensor.
%End
void setData( const QgsAbstractSensor::SensorData &data );
%Docstring
Sets the latest captured data from the sensor.
%End
QString errorString() const;
%Docstring
Returns the last error message.
%End
bool writeXml( QDomElement &parentElement, QDomDocument &document ) const;
%Docstring
Write generic sensor properties into a DOM element.
:param parentElement: parent DOM element (e.g 'Sensors' element)
:param document: DOM document
%End
bool readXml( const QDomElement &element, const QDomDocument &document );
%Docstring
Restores generic sensor details from a DOM element.
:param element: DOM node corresponding to item (e.g. 'Sensor' element)
:param document: DOM document
%End
virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document ) const;
%Docstring
Write specific sensor type properties into a DOM element.
:param element: DOM node corresponding to item (e.g. 'Sensor' element)
:param document: DOM document
%End
virtual bool readPropertiesFromElement( const QDomElement &element, const QDomDocument &document );
%Docstring
Restores specific sensor type properties from a DOM element.
:param element: DOM node corresponding to item (e.g. 'Sensor' element)
:param document: DOM document
%End
signals:
void nameChanged();
%Docstring
Emitted when the sensor name has changed.
%End
void statusChanged();
%Docstring
Emitted when the sensor status has changed.
%End
void dataChanged();
%Docstring
Emitted when the captured sensor data has changed.
%End
void errorOccurred( const QString &errorString );
%Docstring
Emitted when an error has occurred. The ``errorString`` describes the error.
%End
protected:
virtual void handleConnect() = 0;
%Docstring
Handles the connection to the sensor.
.. note::
Triggered by calling :py:func:`~QgsAbstractSensor.connectSensor`
%End
virtual void handleDisconnect() = 0;
%Docstring
Handles the disconnection from the sensor.
.. note::
Triggered by calling :py:func:`~QgsAbstractSensor.disconnectSensor`
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/sensor/qgsabstractsensor.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
|