qsensor.sip 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. // qsensor.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtSensors Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. %If (Qt_6_2_0 -)
  22. struct qoutputrange
  23. {
  24. %TypeHeaderCode
  25. #include <qsensor.h>
  26. %End
  27. qreal minimum;
  28. qreal maximum;
  29. qreal accuracy;
  30. };
  31. %End
  32. %If (Qt_6_2_0 -)
  33. typedef QList<qoutputrange> qoutputrangelist;
  34. %End
  35. %If (Qt_6_2_0 -)
  36. class QSensorReading : public QObject /NoDefaultCtors/
  37. {
  38. %TypeHeaderCode
  39. #include <qsensor.h>
  40. %End
  41. public:
  42. virtual ~QSensorReading();
  43. quint64 timestamp() const;
  44. void setTimestamp(quint64 timestamp);
  45. int valueCount() const;
  46. QVariant value(int index) const;
  47. };
  48. %End
  49. %If (Qt_6_2_0 -)
  50. class QSensorFilter
  51. {
  52. %TypeHeaderCode
  53. #include <qsensor.h>
  54. %End
  55. public:
  56. virtual bool filter(QSensorReading *reading) = 0;
  57. protected:
  58. QSensorFilter();
  59. virtual ~QSensorFilter();
  60. };
  61. %End
  62. %If (Qt_6_2_0 -)
  63. class QSensor : public QObject
  64. {
  65. %TypeHeaderCode
  66. #include <qsensor.h>
  67. %End
  68. %ConvertToSubClassCode
  69. static struct class_graph {
  70. const char *name;
  71. sipTypeDef **type;
  72. int yes, no;
  73. } graph[] = {
  74. {sipName_QSensor, &sipType_QSensor, 2, 1},
  75. {sipName_QSensorReading, &sipType_QSensorReading, 18, -1},
  76. {sipName_QAccelerometer, &sipType_QAccelerometer, -1, 3},
  77. {sipName_QAmbientLightSensor, &sipType_QAmbientLightSensor, -1, 4},
  78. {sipName_QAmbientTemperatureSensor, &sipType_QAmbientTemperatureSensor, -1, 5},
  79. {sipName_QCompass, &sipType_QCompass, -1, 6},
  80. {sipName_QGyroscope, &sipType_QGyroscope, -1, 7},
  81. {sipName_QHumiditySensor, &sipType_QHumiditySensor, -1, 8},
  82. {sipName_QIRProximitySensor, &sipType_QIRProximitySensor, -1, 9},
  83. {sipName_QLidSensor, &sipType_QLidSensor, -1, 10},
  84. {sipName_QLightSensor, &sipType_QLightSensor, -1, 11},
  85. {sipName_QMagnetometer, &sipType_QMagnetometer, -1, 12},
  86. {sipName_QOrientationSensor, &sipType_QOrientationSensor, -1, 13},
  87. {sipName_QPressureSensor, &sipType_QPressureSensor, -1, 14},
  88. {sipName_QProximitySensor, &sipType_QProximitySensor, -1, 15},
  89. {sipName_QRotationSensor, &sipType_QRotationSensor, -1, 16},
  90. {sipName_QTapSensor, &sipType_QTapSensor, -1, 17},
  91. {sipName_QTiltSensor, &sipType_QTiltSensor, -1, -1},
  92. {sipName_QAccelerometerReading, &sipType_QAccelerometerReading, -1, 19},
  93. {sipName_QAmbientLightReading, &sipType_QAmbientLightReading, -1, 20},
  94. {sipName_QAmbientTemperatureReading, &sipType_QAmbientTemperatureReading, -1, 21},
  95. {sipName_QCompassReading, &sipType_QCompassReading, -1, 22},
  96. {sipName_QGyroscopeReading, &sipType_QGyroscopeReading, -1, 23},
  97. {sipName_QHumidityReading, &sipType_QHumidityReading, -1, 24},
  98. {sipName_QIRProximityReading, &sipType_QIRProximityReading, -1, 25},
  99. {sipName_QLidReading, &sipType_QLidReading, -1, 26},
  100. {sipName_QLightReading, &sipType_QLightReading, -1, 27},
  101. {sipName_QMagnetometerReading, &sipType_QMagnetometerReading, -1, 28},
  102. {sipName_QOrientationReading, &sipType_QOrientationReading, -1, 29},
  103. {sipName_QPressureReading, &sipType_QPressureReading, -1, 30},
  104. {sipName_QProximityReading, &sipType_QProximityReading, -1, 31},
  105. {sipName_QRotationReading, &sipType_QRotationReading, -1, 32},
  106. {sipName_QTapReading, &sipType_QTapReading, -1, 33},
  107. {sipName_QTiltReading, &sipType_QTiltReading, -1, -1},
  108. };
  109. int i = 0;
  110. sipType = NULL;
  111. do
  112. {
  113. struct class_graph *cg = &graph[i];
  114. if (cg->name != NULL && sipCpp->inherits(cg->name))
  115. {
  116. sipType = *cg->type;
  117. i = cg->yes;
  118. }
  119. else
  120. i = cg->no;
  121. }
  122. while (i >= 0);
  123. %End
  124. public:
  125. enum Feature
  126. {
  127. Buffering,
  128. AlwaysOn,
  129. GeoValues,
  130. FieldOfView,
  131. AccelerationMode,
  132. SkipDuplicates,
  133. AxesOrientation,
  134. PressureSensorTemperature,
  135. };
  136. enum AxesOrientationMode
  137. {
  138. FixedOrientation,
  139. AutomaticOrientation,
  140. UserOrientation,
  141. };
  142. QSensor(const QByteArray &type, QObject *parent /TransferThis/ = 0);
  143. virtual ~QSensor();
  144. QByteArray identifier() const;
  145. void setIdentifier(const QByteArray &identifier);
  146. QByteArray type() const;
  147. bool connectToBackend();
  148. bool isConnectedToBackend() const;
  149. bool isBusy() const;
  150. void setActive(bool active);
  151. bool isActive() const;
  152. bool isAlwaysOn() const;
  153. void setAlwaysOn(bool alwaysOn);
  154. bool skipDuplicates() const;
  155. void setSkipDuplicates(bool skipDuplicates);
  156. qrangelist availableDataRates() const;
  157. int dataRate() const;
  158. void setDataRate(int rate);
  159. qoutputrangelist outputRanges() const;
  160. int outputRange() const;
  161. void setOutputRange(int index);
  162. QString description() const;
  163. int error() const;
  164. void addFilter(QSensorFilter *filter);
  165. void removeFilter(QSensorFilter *filter);
  166. QList<QSensorFilter *> filters() const;
  167. QSensorReading *reading() const;
  168. static QList<QByteArray> sensorTypes();
  169. static QList<QByteArray> sensorsForType(const QByteArray &type);
  170. static QByteArray defaultSensorForType(const QByteArray &type);
  171. bool isFeatureSupported(QSensor::Feature feature) const;
  172. QSensor::AxesOrientationMode axesOrientationMode() const;
  173. void setAxesOrientationMode(QSensor::AxesOrientationMode axesOrientationMode);
  174. int currentOrientation() const;
  175. void setCurrentOrientation(int currentOrientation);
  176. int userOrientation() const;
  177. void setUserOrientation(int userOrientation);
  178. int maxBufferSize() const;
  179. void setMaxBufferSize(int maxBufferSize);
  180. int efficientBufferSize() const;
  181. void setEfficientBufferSize(int efficientBufferSize);
  182. int bufferSize() const;
  183. void setBufferSize(int bufferSize);
  184. public slots:
  185. bool start();
  186. void stop();
  187. signals:
  188. void busyChanged();
  189. void activeChanged();
  190. void readingChanged();
  191. void sensorError(int error);
  192. void availableSensorsChanged();
  193. void alwaysOnChanged();
  194. void dataRateChanged();
  195. void skipDuplicatesChanged(bool skipDuplicates);
  196. void axesOrientationModeChanged(QSensor::AxesOrientationMode axesOrientationMode /ScopesStripped=1/);
  197. void currentOrientationChanged(int currentOrientation);
  198. void userOrientationChanged(int userOrientation);
  199. void maxBufferSizeChanged(int maxBufferSize);
  200. void efficientBufferSizeChanged(int efficientBufferSize);
  201. void bufferSizeChanged(int bufferSize);
  202. void identifierChanged();
  203. };
  204. %End
  205. %If (Qt_6_2_0 -)
  206. typedef std::pair<int, int> qrange;
  207. %End
  208. %If (Qt_6_2_0 -)
  209. typedef QList<std::pair<int, int>> qrangelist;
  210. %End