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