yoctopuce 2.0.59348__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. yoctopuce/__init__.py +0 -0
  2. yoctopuce/cdll/libyapi-aarch64.so +0 -0
  3. yoctopuce/cdll/libyapi-amd64.so +0 -0
  4. yoctopuce/cdll/libyapi-armel.so +0 -0
  5. yoctopuce/cdll/libyapi-armhf.so +0 -0
  6. yoctopuce/cdll/libyapi-i386.so +0 -0
  7. yoctopuce/cdll/libyapi-mips.so +0 -0
  8. yoctopuce/cdll/libyapi-mipsel.so +0 -0
  9. yoctopuce/cdll/libyapi.dylib +0 -0
  10. yoctopuce/cdll/yapi.dll +0 -0
  11. yoctopuce/cdll/yapi64.dll +0 -0
  12. yoctopuce/yocto_accelerometer.py +279 -0
  13. yoctopuce/yocto_altitude.py +246 -0
  14. yoctopuce/yocto_anbutton.py +518 -0
  15. yoctopuce/yocto_api.py +8921 -0
  16. yoctopuce/yocto_arithmeticsensor.py +345 -0
  17. yoctopuce/yocto_audioin.py +294 -0
  18. yoctopuce/yocto_audioout.py +294 -0
  19. yoctopuce/yocto_bluetoothlink.py +463 -0
  20. yoctopuce/yocto_buzzer.py +603 -0
  21. yoctopuce/yocto_carbondioxide.py +281 -0
  22. yoctopuce/yocto_cellular.py +4014 -0
  23. yoctopuce/yocto_colorled.py +477 -0
  24. yoctopuce/yocto_colorledcluster.py +1161 -0
  25. yoctopuce/yocto_compass.py +236 -0
  26. yoctopuce/yocto_current.py +207 -0
  27. yoctopuce/yocto_currentloopoutput.py +295 -0
  28. yoctopuce/yocto_daisychain.py +248 -0
  29. yoctopuce/yocto_datalogger.py +44 -0
  30. yoctopuce/yocto_digitalio.py +609 -0
  31. yoctopuce/yocto_display.py +1146 -0
  32. yoctopuce/yocto_dualpower.py +253 -0
  33. yoctopuce/yocto_files.py +374 -0
  34. yoctopuce/yocto_genericsensor.py +456 -0
  35. yoctopuce/yocto_gps.py +552 -0
  36. yoctopuce/yocto_groundspeed.py +167 -0
  37. yoctopuce/yocto_gyro.py +660 -0
  38. yoctopuce/yocto_hubport.py +251 -0
  39. yoctopuce/yocto_humidity.py +224 -0
  40. yoctopuce/yocto_i2cport.py +1259 -0
  41. yoctopuce/yocto_inputcapture.py +870 -0
  42. yoctopuce/yocto_inputchain.py +692 -0
  43. yoctopuce/yocto_latitude.py +167 -0
  44. yoctopuce/yocto_led.py +274 -0
  45. yoctopuce/yocto_lightsensor.py +240 -0
  46. yoctopuce/yocto_longitude.py +167 -0
  47. yoctopuce/yocto_magnetometer.py +268 -0
  48. yoctopuce/yocto_messagebox.py +1952 -0
  49. yoctopuce/yocto_micropython.py +444 -0
  50. yoctopuce/yocto_motor.py +547 -0
  51. yoctopuce/yocto_multiaxiscontroller.py +373 -0
  52. yoctopuce/yocto_multicellweighscale.py +518 -0
  53. yoctopuce/yocto_multisenscontroller.py +350 -0
  54. yoctopuce/yocto_network.py +1196 -0
  55. yoctopuce/yocto_oscontrol.py +204 -0
  56. yoctopuce/yocto_power.py +314 -0
  57. yoctopuce/yocto_poweroutput.py +210 -0
  58. yoctopuce/yocto_powersupply.py +477 -0
  59. yoctopuce/yocto_pressure.py +167 -0
  60. yoctopuce/yocto_proximity.py +503 -0
  61. yoctopuce/yocto_pwminput.py +467 -0
  62. yoctopuce/yocto_pwmoutput.py +607 -0
  63. yoctopuce/yocto_pwmpowersource.py +211 -0
  64. yoctopuce/yocto_quadraturedecoder.py +272 -0
  65. yoctopuce/yocto_rangefinder.py +430 -0
  66. yoctopuce/yocto_realtimeclock.py +321 -0
  67. yoctopuce/yocto_refframe.py +883 -0
  68. yoctopuce/yocto_relay.py +489 -0
  69. yoctopuce/yocto_rfidreader.py +1559 -0
  70. yoctopuce/yocto_sdi12port.py +1697 -0
  71. yoctopuce/yocto_segmenteddisplay.py +217 -0
  72. yoctopuce/yocto_serialport.py +1919 -0
  73. yoctopuce/yocto_servo.py +417 -0
  74. yoctopuce/yocto_spiport.py +1355 -0
  75. yoctopuce/yocto_steppermotor.py +750 -0
  76. yoctopuce/yocto_temperature.py +478 -0
  77. yoctopuce/yocto_threshold.py +278 -0
  78. yoctopuce/yocto_tilt.py +257 -0
  79. yoctopuce/yocto_tvoc.py +167 -0
  80. yoctopuce/yocto_voc.py +167 -0
  81. yoctopuce/yocto_voltage.py +207 -0
  82. yoctopuce/yocto_voltageoutput.py +266 -0
  83. yoctopuce/yocto_wakeupmonitor.py +413 -0
  84. yoctopuce/yocto_wakeupschedule.py +453 -0
  85. yoctopuce/yocto_watchdog.py +667 -0
  86. yoctopuce/yocto_weighscale.py +659 -0
  87. yoctopuce/yocto_wireless.py +488 -0
  88. yoctopuce-2.0.59348.dist-info/METADATA +344 -0
  89. yoctopuce-2.0.59348.dist-info/RECORD +91 -0
  90. yoctopuce-2.0.59348.dist-info/WHEEL +5 -0
  91. yoctopuce-2.0.59348.dist-info/licenses/LICENSE.txt +237 -0
yoctopuce/__init__.py ADDED
File without changes
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,279 @@
1
+ # -*- coding: utf-8 -*-
2
+ # ********************************************************************
3
+ #
4
+ # $Id: yocto_accelerometer.py 50694 2022-08-18 09:01:12Z seb $
5
+ #
6
+ # Implements yFindAccelerometer(), the high-level API for Accelerometer functions
7
+ #
8
+ # - - - - - - - - - License information: - - - - - - - - -
9
+ #
10
+ # Copyright (C) 2011 and beyond by Yoctopuce Sarl, Switzerland.
11
+ #
12
+ # Yoctopuce Sarl (hereafter Licensor) grants to you a perpetual
13
+ # non-exclusive license to use, modify, copy and integrate this
14
+ # file into your software for the sole purpose of interfacing
15
+ # with Yoctopuce products.
16
+ #
17
+ # You may reproduce and distribute copies of this file in
18
+ # source or object form, as long as the sole purpose of this
19
+ # code is to interface with Yoctopuce products. You must retain
20
+ # this notice in the distributed source file.
21
+ #
22
+ # You should refer to Yoctopuce General Terms and Conditions
23
+ # for additional information regarding your rights and
24
+ # obligations.
25
+ #
26
+ # THE SOFTWARE AND DOCUMENTATION ARE PROVIDED 'AS IS' WITHOUT
27
+ # WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
28
+ # WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS
29
+ # FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO
30
+ # EVENT SHALL LICENSOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL,
31
+ # INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
32
+ # COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR
33
+ # SERVICES, ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT
34
+ # LIMITED TO ANY DEFENSE THEREOF), ANY CLAIMS FOR INDEMNITY OR
35
+ # CONTRIBUTION, OR OTHER SIMILAR COSTS, WHETHER ASSERTED ON THE
36
+ # BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE), BREACH OF
37
+ # WARRANTY, OR OTHERWISE.
38
+ #
39
+ # *********************************************************************
40
+
41
+
42
+ __docformat__ = 'restructuredtext en'
43
+ from yoctopuce.yocto_api import *
44
+
45
+
46
+ #--- (YAccelerometer class start)
47
+ #noinspection PyProtectedMember
48
+ class YAccelerometer(YSensor):
49
+ """
50
+ The YAccelerometer class allows you to read and configure Yoctopuce accelerometers.
51
+ It inherits from YSensor class the core functions to read measurements,
52
+ to register callback functions, and to access the autonomous datalogger.
53
+ This class adds the possibility to access x, y and z components of the acceleration
54
+ vector separately.
55
+
56
+ """
57
+ #--- (end of YAccelerometer class start)
58
+ #--- (YAccelerometer return codes)
59
+ #--- (end of YAccelerometer return codes)
60
+ #--- (YAccelerometer dlldef)
61
+ #--- (end of YAccelerometer dlldef)
62
+ #--- (YAccelerometer yapiwrapper)
63
+ #--- (end of YAccelerometer yapiwrapper)
64
+ #--- (YAccelerometer definitions)
65
+ BANDWIDTH_INVALID = YAPI.INVALID_UINT
66
+ XVALUE_INVALID = YAPI.INVALID_DOUBLE
67
+ YVALUE_INVALID = YAPI.INVALID_DOUBLE
68
+ ZVALUE_INVALID = YAPI.INVALID_DOUBLE
69
+ GRAVITYCANCELLATION_OFF = 0
70
+ GRAVITYCANCELLATION_ON = 1
71
+ GRAVITYCANCELLATION_INVALID = -1
72
+ #--- (end of YAccelerometer definitions)
73
+
74
+ def __init__(self, func):
75
+ super(YAccelerometer, self).__init__(func)
76
+ self._className = 'Accelerometer'
77
+ #--- (YAccelerometer attributes)
78
+ self._callback = None
79
+ self._bandwidth = YAccelerometer.BANDWIDTH_INVALID
80
+ self._xValue = YAccelerometer.XVALUE_INVALID
81
+ self._yValue = YAccelerometer.YVALUE_INVALID
82
+ self._zValue = YAccelerometer.ZVALUE_INVALID
83
+ self._gravityCancellation = YAccelerometer.GRAVITYCANCELLATION_INVALID
84
+ #--- (end of YAccelerometer attributes)
85
+
86
+ #--- (YAccelerometer implementation)
87
+ def _parseAttr(self, json_val):
88
+ if json_val.has("bandwidth"):
89
+ self._bandwidth = json_val.getInt("bandwidth")
90
+ if json_val.has("xValue"):
91
+ self._xValue = round(json_val.getDouble("xValue") / 65.536) / 1000.0
92
+ if json_val.has("yValue"):
93
+ self._yValue = round(json_val.getDouble("yValue") / 65.536) / 1000.0
94
+ if json_val.has("zValue"):
95
+ self._zValue = round(json_val.getDouble("zValue") / 65.536) / 1000.0
96
+ if json_val.has("gravityCancellation"):
97
+ self._gravityCancellation = (json_val.getInt("gravityCancellation") > 0 if 1 else 0)
98
+ super(YAccelerometer, self)._parseAttr(json_val)
99
+
100
+ def get_bandwidth(self):
101
+ """
102
+ Returns the measure update frequency, measured in Hz.
103
+
104
+ @return an integer corresponding to the measure update frequency, measured in Hz
105
+
106
+ On failure, throws an exception or returns YAccelerometer.BANDWIDTH_INVALID.
107
+ """
108
+ # res
109
+ if self._cacheExpiration <= YAPI.GetTickCount():
110
+ if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:
111
+ return YAccelerometer.BANDWIDTH_INVALID
112
+ res = self._bandwidth
113
+ return res
114
+
115
+ def set_bandwidth(self, newval):
116
+ """
117
+ Changes the measure update frequency, measured in Hz. When the
118
+ frequency is lower, the device performs averaging.
119
+ Remember to call the saveToFlash()
120
+ method of the module if the modification must be kept.
121
+
122
+ @param newval : an integer corresponding to the measure update frequency, measured in Hz
123
+
124
+ @return YAPI.SUCCESS if the call succeeds.
125
+
126
+ On failure, throws an exception or returns a negative error code.
127
+ """
128
+ rest_val = str(newval)
129
+ return self._setAttr("bandwidth", rest_val)
130
+
131
+ def get_xValue(self):
132
+ """
133
+ Returns the X component of the acceleration, as a floating point number.
134
+
135
+ @return a floating point number corresponding to the X component of the acceleration, as a floating point number
136
+
137
+ On failure, throws an exception or returns YAccelerometer.XVALUE_INVALID.
138
+ """
139
+ # res
140
+ if self._cacheExpiration <= YAPI.GetTickCount():
141
+ if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:
142
+ return YAccelerometer.XVALUE_INVALID
143
+ res = self._xValue
144
+ return res
145
+
146
+ def get_yValue(self):
147
+ """
148
+ Returns the Y component of the acceleration, as a floating point number.
149
+
150
+ @return a floating point number corresponding to the Y component of the acceleration, as a floating point number
151
+
152
+ On failure, throws an exception or returns YAccelerometer.YVALUE_INVALID.
153
+ """
154
+ # res
155
+ if self._cacheExpiration <= YAPI.GetTickCount():
156
+ if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:
157
+ return YAccelerometer.YVALUE_INVALID
158
+ res = self._yValue
159
+ return res
160
+
161
+ def get_zValue(self):
162
+ """
163
+ Returns the Z component of the acceleration, as a floating point number.
164
+
165
+ @return a floating point number corresponding to the Z component of the acceleration, as a floating point number
166
+
167
+ On failure, throws an exception or returns YAccelerometer.ZVALUE_INVALID.
168
+ """
169
+ # res
170
+ if self._cacheExpiration <= YAPI.GetTickCount():
171
+ if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:
172
+ return YAccelerometer.ZVALUE_INVALID
173
+ res = self._zValue
174
+ return res
175
+
176
+ def get_gravityCancellation(self):
177
+ # res
178
+ if self._cacheExpiration <= YAPI.GetTickCount():
179
+ if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:
180
+ return YAccelerometer.GRAVITYCANCELLATION_INVALID
181
+ res = self._gravityCancellation
182
+ return res
183
+
184
+ def set_gravityCancellation(self, newval):
185
+ rest_val = "1" if newval > 0 else "0"
186
+ return self._setAttr("gravityCancellation", rest_val)
187
+
188
+ @staticmethod
189
+ def FindAccelerometer(func):
190
+ """
191
+ Retrieves an accelerometer for a given identifier.
192
+ The identifier can be specified using several formats:
193
+ <ul>
194
+ <li>FunctionLogicalName</li>
195
+ <li>ModuleSerialNumber.FunctionIdentifier</li>
196
+ <li>ModuleSerialNumber.FunctionLogicalName</li>
197
+ <li>ModuleLogicalName.FunctionIdentifier</li>
198
+ <li>ModuleLogicalName.FunctionLogicalName</li>
199
+ </ul>
200
+
201
+ This function does not require that the accelerometer is online at the time
202
+ it is invoked. The returned object is nevertheless valid.
203
+ Use the method YAccelerometer.isOnline() to test if the accelerometer is
204
+ indeed online at a given time. In case of ambiguity when looking for
205
+ an accelerometer by logical name, no error is notified: the first instance
206
+ found is returned. The search is performed first by hardware name,
207
+ then by logical name.
208
+
209
+ If a call to this object's is_online() method returns FALSE although
210
+ you are certain that the matching device is plugged, make sure that you did
211
+ call registerHub() at application initialization time.
212
+
213
+ @param func : a string that uniquely characterizes the accelerometer, for instance
214
+ Y3DMK002.accelerometer.
215
+
216
+ @return a YAccelerometer object allowing you to drive the accelerometer.
217
+ """
218
+ # obj
219
+ obj = YFunction._FindFromCache("Accelerometer", func)
220
+ if obj is None:
221
+ obj = YAccelerometer(func)
222
+ YFunction._AddToCache("Accelerometer", func, obj)
223
+ return obj
224
+
225
+ def nextAccelerometer(self):
226
+ """
227
+ Continues the enumeration of accelerometers started using yFirstAccelerometer().
228
+ Caution: You can't make any assumption about the returned accelerometers order.
229
+ If you want to find a specific an accelerometer, use Accelerometer.findAccelerometer()
230
+ and a hardwareID or a logical name.
231
+
232
+ @return a pointer to a YAccelerometer object, corresponding to
233
+ an accelerometer currently online, or a None pointer
234
+ if there are no more accelerometers to enumerate.
235
+ """
236
+ hwidRef = YRefParam()
237
+ if YAPI.YISERR(self._nextFunction(hwidRef)):
238
+ return None
239
+ if hwidRef.value == "":
240
+ return None
241
+ return YAccelerometer.FindAccelerometer(hwidRef.value)
242
+
243
+ #--- (end of YAccelerometer implementation)
244
+
245
+ #--- (YAccelerometer functions)
246
+
247
+ @staticmethod
248
+ def FirstAccelerometer():
249
+ """
250
+ Starts the enumeration of accelerometers currently accessible.
251
+ Use the method YAccelerometer.nextAccelerometer() to iterate on
252
+ next accelerometers.
253
+
254
+ @return a pointer to a YAccelerometer object, corresponding to
255
+ the first accelerometer currently online, or a None pointer
256
+ if there are none.
257
+ """
258
+ devRef = YRefParam()
259
+ neededsizeRef = YRefParam()
260
+ serialRef = YRefParam()
261
+ funcIdRef = YRefParam()
262
+ funcNameRef = YRefParam()
263
+ funcValRef = YRefParam()
264
+ errmsgRef = YRefParam()
265
+ size = YAPI.C_INTSIZE
266
+ #noinspection PyTypeChecker,PyCallingNonCallable
267
+ p = (ctypes.c_int * 1)()
268
+ err = YAPI.apiGetFunctionsByClass("Accelerometer", 0, p, size, neededsizeRef, errmsgRef)
269
+
270
+ if YAPI.YISERR(err) or not neededsizeRef.value:
271
+ return None
272
+
273
+ if YAPI.YISERR(
274
+ YAPI.yapiGetFunctionInfo(p[0], devRef, serialRef, funcIdRef, funcNameRef, funcValRef, errmsgRef)):
275
+ return None
276
+
277
+ return YAccelerometer.FindAccelerometer(serialRef.value + "." + funcIdRef.value)
278
+
279
+ #--- (end of YAccelerometer functions)
@@ -0,0 +1,246 @@
1
+ # -*- coding: utf-8 -*-
2
+ # ********************************************************************
3
+ #
4
+ # $Id: yocto_altitude.py 50694 2022-08-18 09:01:12Z seb $
5
+ #
6
+ # Implements yFindAltitude(), the high-level API for Altitude functions
7
+ #
8
+ # - - - - - - - - - License information: - - - - - - - - -
9
+ #
10
+ # Copyright (C) 2011 and beyond by Yoctopuce Sarl, Switzerland.
11
+ #
12
+ # Yoctopuce Sarl (hereafter Licensor) grants to you a perpetual
13
+ # non-exclusive license to use, modify, copy and integrate this
14
+ # file into your software for the sole purpose of interfacing
15
+ # with Yoctopuce products.
16
+ #
17
+ # You may reproduce and distribute copies of this file in
18
+ # source or object form, as long as the sole purpose of this
19
+ # code is to interface with Yoctopuce products. You must retain
20
+ # this notice in the distributed source file.
21
+ #
22
+ # You should refer to Yoctopuce General Terms and Conditions
23
+ # for additional information regarding your rights and
24
+ # obligations.
25
+ #
26
+ # THE SOFTWARE AND DOCUMENTATION ARE PROVIDED 'AS IS' WITHOUT
27
+ # WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
28
+ # WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS
29
+ # FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO
30
+ # EVENT SHALL LICENSOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL,
31
+ # INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
32
+ # COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR
33
+ # SERVICES, ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT
34
+ # LIMITED TO ANY DEFENSE THEREOF), ANY CLAIMS FOR INDEMNITY OR
35
+ # CONTRIBUTION, OR OTHER SIMILAR COSTS, WHETHER ASSERTED ON THE
36
+ # BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE), BREACH OF
37
+ # WARRANTY, OR OTHERWISE.
38
+ #
39
+ # *********************************************************************
40
+
41
+
42
+ __docformat__ = 'restructuredtext en'
43
+ from yoctopuce.yocto_api import *
44
+
45
+
46
+ #--- (YAltitude class start)
47
+ #noinspection PyProtectedMember
48
+ class YAltitude(YSensor):
49
+ """
50
+ The YAltitude class allows you to read and configure Yoctopuce altimeters.
51
+ It inherits from YSensor class the core functions to read measurements,
52
+ to register callback functions, and to access the autonomous datalogger.
53
+ This class adds the ability to configure the barometric pressure adjusted to
54
+ sea level (QNH) for barometric sensors.
55
+
56
+ """
57
+ #--- (end of YAltitude class start)
58
+ #--- (YAltitude return codes)
59
+ #--- (end of YAltitude return codes)
60
+ #--- (YAltitude dlldef)
61
+ #--- (end of YAltitude dlldef)
62
+ #--- (YAltitude yapiwrapper)
63
+ #--- (end of YAltitude yapiwrapper)
64
+ #--- (YAltitude definitions)
65
+ QNH_INVALID = YAPI.INVALID_DOUBLE
66
+ TECHNOLOGY_INVALID = YAPI.INVALID_STRING
67
+ #--- (end of YAltitude definitions)
68
+
69
+ def __init__(self, func):
70
+ super(YAltitude, self).__init__(func)
71
+ self._className = 'Altitude'
72
+ #--- (YAltitude attributes)
73
+ self._callback = None
74
+ self._qnh = YAltitude.QNH_INVALID
75
+ self._technology = YAltitude.TECHNOLOGY_INVALID
76
+ #--- (end of YAltitude attributes)
77
+
78
+ #--- (YAltitude implementation)
79
+ def _parseAttr(self, json_val):
80
+ if json_val.has("qnh"):
81
+ self._qnh = round(json_val.getDouble("qnh") / 65.536) / 1000.0
82
+ if json_val.has("technology"):
83
+ self._technology = json_val.getString("technology")
84
+ super(YAltitude, self)._parseAttr(json_val)
85
+
86
+ def set_currentValue(self, newval):
87
+ """
88
+ Changes the current estimated altitude. This allows one to compensate for
89
+ ambient pressure variations and to work in relative mode.
90
+ Remember to call the saveToFlash()
91
+ method of the module if the modification must be kept.
92
+
93
+ @param newval : a floating point number corresponding to the current estimated altitude
94
+
95
+ @return YAPI.SUCCESS if the call succeeds.
96
+
97
+ On failure, throws an exception or returns a negative error code.
98
+ """
99
+ rest_val = str(int(round(newval * 65536.0, 1)))
100
+ return self._setAttr("currentValue", rest_val)
101
+
102
+ def set_qnh(self, newval):
103
+ """
104
+ Changes the barometric pressure adjusted to sea level used to compute
105
+ the altitude (QNH). This enables you to compensate for atmospheric pressure
106
+ changes due to weather conditions. Applicable to barometric altimeters only.
107
+ Remember to call the saveToFlash()
108
+ method of the module if the modification must be kept.
109
+
110
+ @param newval : a floating point number corresponding to the barometric pressure adjusted to sea
111
+ level used to compute
112
+ the altitude (QNH)
113
+
114
+ @return YAPI.SUCCESS if the call succeeds.
115
+
116
+ On failure, throws an exception or returns a negative error code.
117
+ """
118
+ rest_val = str(int(round(newval * 65536.0, 1)))
119
+ return self._setAttr("qnh", rest_val)
120
+
121
+ def get_qnh(self):
122
+ """
123
+ Returns the barometric pressure adjusted to sea level used to compute
124
+ the altitude (QNH). Applicable to barometric altimeters only.
125
+
126
+ @return a floating point number corresponding to the barometric pressure adjusted to sea level used to compute
127
+ the altitude (QNH)
128
+
129
+ On failure, throws an exception or returns YAltitude.QNH_INVALID.
130
+ """
131
+ # res
132
+ if self._cacheExpiration <= YAPI.GetTickCount():
133
+ if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:
134
+ return YAltitude.QNH_INVALID
135
+ res = self._qnh
136
+ return res
137
+
138
+ def get_technology(self):
139
+ """
140
+ Returns the technology used by the sesnor to compute
141
+ altitude. Possibles values are "barometric" and "gps"
142
+
143
+ @return a string corresponding to the technology used by the sesnor to compute
144
+ altitude
145
+
146
+ On failure, throws an exception or returns YAltitude.TECHNOLOGY_INVALID.
147
+ """
148
+ # res
149
+ if self._cacheExpiration <= YAPI.GetTickCount():
150
+ if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:
151
+ return YAltitude.TECHNOLOGY_INVALID
152
+ res = self._technology
153
+ return res
154
+
155
+ @staticmethod
156
+ def FindAltitude(func):
157
+ """
158
+ Retrieves an altimeter for a given identifier.
159
+ The identifier can be specified using several formats:
160
+ <ul>
161
+ <li>FunctionLogicalName</li>
162
+ <li>ModuleSerialNumber.FunctionIdentifier</li>
163
+ <li>ModuleSerialNumber.FunctionLogicalName</li>
164
+ <li>ModuleLogicalName.FunctionIdentifier</li>
165
+ <li>ModuleLogicalName.FunctionLogicalName</li>
166
+ </ul>
167
+
168
+ This function does not require that the altimeter is online at the time
169
+ it is invoked. The returned object is nevertheless valid.
170
+ Use the method YAltitude.isOnline() to test if the altimeter is
171
+ indeed online at a given time. In case of ambiguity when looking for
172
+ an altimeter by logical name, no error is notified: the first instance
173
+ found is returned. The search is performed first by hardware name,
174
+ then by logical name.
175
+
176
+ If a call to this object's is_online() method returns FALSE although
177
+ you are certain that the matching device is plugged, make sure that you did
178
+ call registerHub() at application initialization time.
179
+
180
+ @param func : a string that uniquely characterizes the altimeter, for instance
181
+ YALTIMK2.altitude.
182
+
183
+ @return a YAltitude object allowing you to drive the altimeter.
184
+ """
185
+ # obj
186
+ obj = YFunction._FindFromCache("Altitude", func)
187
+ if obj is None:
188
+ obj = YAltitude(func)
189
+ YFunction._AddToCache("Altitude", func, obj)
190
+ return obj
191
+
192
+ def nextAltitude(self):
193
+ """
194
+ Continues the enumeration of altimeters started using yFirstAltitude().
195
+ Caution: You can't make any assumption about the returned altimeters order.
196
+ If you want to find a specific an altimeter, use Altitude.findAltitude()
197
+ and a hardwareID or a logical name.
198
+
199
+ @return a pointer to a YAltitude object, corresponding to
200
+ an altimeter currently online, or a None pointer
201
+ if there are no more altimeters to enumerate.
202
+ """
203
+ hwidRef = YRefParam()
204
+ if YAPI.YISERR(self._nextFunction(hwidRef)):
205
+ return None
206
+ if hwidRef.value == "":
207
+ return None
208
+ return YAltitude.FindAltitude(hwidRef.value)
209
+
210
+ #--- (end of YAltitude implementation)
211
+
212
+ #--- (YAltitude functions)
213
+
214
+ @staticmethod
215
+ def FirstAltitude():
216
+ """
217
+ Starts the enumeration of altimeters currently accessible.
218
+ Use the method YAltitude.nextAltitude() to iterate on
219
+ next altimeters.
220
+
221
+ @return a pointer to a YAltitude object, corresponding to
222
+ the first altimeter currently online, or a None pointer
223
+ if there are none.
224
+ """
225
+ devRef = YRefParam()
226
+ neededsizeRef = YRefParam()
227
+ serialRef = YRefParam()
228
+ funcIdRef = YRefParam()
229
+ funcNameRef = YRefParam()
230
+ funcValRef = YRefParam()
231
+ errmsgRef = YRefParam()
232
+ size = YAPI.C_INTSIZE
233
+ #noinspection PyTypeChecker,PyCallingNonCallable
234
+ p = (ctypes.c_int * 1)()
235
+ err = YAPI.apiGetFunctionsByClass("Altitude", 0, p, size, neededsizeRef, errmsgRef)
236
+
237
+ if YAPI.YISERR(err) or not neededsizeRef.value:
238
+ return None
239
+
240
+ if YAPI.YISERR(
241
+ YAPI.yapiGetFunctionInfo(p[0], devRef, serialRef, funcIdRef, funcNameRef, funcValRef, errmsgRef)):
242
+ return None
243
+
244
+ return YAltitude.FindAltitude(serialRef.value + "." + funcIdRef.value)
245
+
246
+ #--- (end of YAltitude functions)