tinkerforge 2.1.24 → 2.1.25

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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +155 -74
  3. data/lib/tinkerforge/brick_hat.rb +70 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +56 -22
  5. data/lib/tinkerforge/brick_imu.rb +184 -77
  6. data/lib/tinkerforge/brick_imu_v2.rb +208 -105
  7. data/lib/tinkerforge/brick_master.rb +484 -182
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +185 -101
  10. data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
  11. data/lib/tinkerforge/brick_stepper.rb +210 -98
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
  18. data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +66 -26
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -18
  27. data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +34 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
  30. data/lib/tinkerforge/bricklet_color.rb +69 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +78 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +58 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +58 -24
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
  37. data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
  39. data/lib/tinkerforge/bricklet_dmx.rb +88 -34
  40. data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
  46. data/lib/tinkerforge/bricklet_gps.rb +64 -26
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
  50. data/lib/tinkerforge/bricklet_humidity.rb +51 -21
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
  52. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
  53. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
  54. data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
  55. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
  57. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
  59. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
  62. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
  64. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
  65. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
  66. data/lib/tinkerforge/bricklet_io16.rb +55 -21
  67. data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
  68. data/lib/tinkerforge/bricklet_io4.rb +55 -23
  69. data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
  70. data/lib/tinkerforge/bricklet_isolator.rb +72 -28
  71. data/lib/tinkerforge/bricklet_joystick.rb +59 -25
  72. data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
  73. data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
  74. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
  75. data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
  76. data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
  77. data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
  78. data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
  79. data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
  80. data/lib/tinkerforge/bricklet_line.rb +34 -14
  81. data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
  82. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
  83. data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
  84. data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
  85. data/lib/tinkerforge/bricklet_moisture.rb +40 -16
  86. data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
  87. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
  88. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
  89. data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
  90. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
  91. data/lib/tinkerforge/bricklet_nfc.rb +123 -58
  92. data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
  93. data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
  94. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
  95. data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
  96. data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
  97. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
  98. data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
  99. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
  100. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
  101. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
  102. data/lib/tinkerforge/bricklet_ptc.rb +74 -42
  103. data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
  104. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
  105. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
  106. data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
  107. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
  108. data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
  109. data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
  110. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
  111. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
  112. data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
  113. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
  114. data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
  115. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
  116. data/lib/tinkerforge/bricklet_rs232.rb +90 -28
  117. data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
  118. data/lib/tinkerforge/bricklet_rs485.rb +223 -95
  119. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
  120. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
  121. data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
  122. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
  123. data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
  124. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
  125. data/lib/tinkerforge/bricklet_temperature.rb +40 -16
  126. data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
  127. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
  128. data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
  129. data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
  130. data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
  131. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
  132. data/lib/tinkerforge/bricklet_tilt.rb +24 -10
  133. data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
  134. data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
  135. data/lib/tinkerforge/bricklet_voltage.rb +52 -28
  136. data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
  137. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
  138. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
  139. data/lib/tinkerforge/device_display_names.rb +163 -0
  140. data/lib/tinkerforge/ip_connection.rb +151 -32
  141. data/lib/tinkerforge/version.rb +1 -1
  142. metadata +3 -2
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Measures IAQ index, temperature, humidity and air pressure
14
16
  class BrickletAirQuality < Device
@@ -108,7 +110,7 @@ module Tinkerforge
108
110
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
109
111
  # the IP Connection <tt>ipcon</tt>.
110
112
  def initialize(uid, ipcon)
111
- super uid, ipcon
113
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
112
114
 
113
115
  @api_version = [2, 0, 1]
114
116
 
@@ -145,16 +147,17 @@ module Tinkerforge
145
147
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
146
148
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
147
149
 
148
- @callback_formats[CALLBACK_ALL_VALUES] = 'l C l l l'
149
- @callback_formats[CALLBACK_IAQ_INDEX] = 'l C'
150
- @callback_formats[CALLBACK_TEMPERATURE] = 'l'
151
- @callback_formats[CALLBACK_HUMIDITY] = 'l'
152
- @callback_formats[CALLBACK_AIR_PRESSURE] = 'l'
150
+ @callback_formats[CALLBACK_ALL_VALUES] = [25, 'l C l l l']
151
+ @callback_formats[CALLBACK_IAQ_INDEX] = [13, 'l C']
152
+ @callback_formats[CALLBACK_TEMPERATURE] = [12, 'l']
153
+ @callback_formats[CALLBACK_HUMIDITY] = [12, 'l']
154
+ @callback_formats[CALLBACK_AIR_PRESSURE] = [12, 'l']
153
155
 
156
+ @ipcon.add_device self
154
157
  end
155
158
 
156
159
  # Returns all values measured by the Air Quality Bricklet. The values are
157
- # IAQ (Indoor Air Quality) Index, IAQ Index Accuracy, Temperature, Humidity and
160
+ # IAQ (Indoor Air Quality) Index (higher value means greater level of air pollution), IAQ Index Accuracy, Temperature, Humidity and
158
161
  # Air Pressure.
159
162
  #
160
163
  # .. image:: /Images/Misc/bricklet_air_quality_iaq_index.png
@@ -162,20 +165,13 @@ module Tinkerforge
162
165
  # :alt: Air Quality Index description
163
166
  # :align: center
164
167
  # :target: ../../_images/Misc/bricklet_air_quality_iaq_index.png
165
- #
166
- # The values have these ranges and units:
167
- #
168
- # * IAQ Index: 0 to 500, higher value means greater level of air pollution
169
- # * IAQ Index Accuracy: 0 = unreliable to 3 = high
170
- # * Temperature: in steps of 0.01 °C
171
- # * Humidity: in steps of 0.01 %RH
172
- # * Air Pressure: in steps of 0.01 hPa
173
168
  def get_all_values
174
- send_request FUNCTION_GET_ALL_VALUES, [], '', 17, 'l C l l l'
169
+ check_validity
170
+
171
+ send_request FUNCTION_GET_ALL_VALUES, [], '', 25, 'l C l l l'
175
172
  end
176
173
 
177
- # Sets a temperature offset with resolution 1/100 °C. A offset of 10 will decrease
178
- # the measured temperature by 0.1 °C.
174
+ # Sets a temperature offset. A offset of 10 will decrease the measured temperature by 0.1 °C.
179
175
  #
180
176
  # If you install this Bricklet into an enclosure and you want to measure the ambient
181
177
  # temperature, you may have to decrease the measured temperature by some value to
@@ -187,16 +183,20 @@ module Tinkerforge
187
183
  #
188
184
  # This temperature offset is used to calculate the relative humidity and
189
185
  # IAQ index measurements. In case the Bricklet is installed in an enclosure, we
190
- # recommend to measure and set the temperature offset to imporve the accuracy of
186
+ # recommend to measure and set the temperature offset to improve the accuracy of
191
187
  # the measurements.
192
188
  def set_temperature_offset(offset)
193
- send_request FUNCTION_SET_TEMPERATURE_OFFSET, [offset], 'l', 0, ''
189
+ check_validity
190
+
191
+ send_request FUNCTION_SET_TEMPERATURE_OFFSET, [offset], 'l', 8, ''
194
192
  end
195
193
 
196
194
  # Returns the temperature offset as set by
197
195
  # BrickletAirQuality#set_temperature_offset.
198
196
  def get_temperature_offset
199
- send_request FUNCTION_GET_TEMPERATURE_OFFSET, [], '', 4, 'l'
197
+ check_validity
198
+
199
+ send_request FUNCTION_GET_TEMPERATURE_OFFSET, [], '', 12, 'l'
200
200
  end
201
201
 
202
202
  # The period is the period with which the CALLBACK_ALL_VALUES
@@ -209,17 +209,20 @@ module Tinkerforge
209
209
  # If it is set to false, the callback is continuously triggered with the period,
210
210
  # independent of the value.
211
211
  def set_all_values_callback_configuration(period, value_has_to_change)
212
- send_request FUNCTION_SET_ALL_VALUES_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
212
+ check_validity
213
+
214
+ send_request FUNCTION_SET_ALL_VALUES_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
213
215
  end
214
216
 
215
217
  # Returns the callback configuration as set by
216
218
  # BrickletAirQuality#set_all_values_callback_configuration.
217
219
  def get_all_values_callback_configuration
218
- send_request FUNCTION_GET_ALL_VALUES_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
220
+ check_validity
221
+
222
+ send_request FUNCTION_GET_ALL_VALUES_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
219
223
  end
220
224
 
221
- # Returns the IAQ index and accuracy. The IAQ index goes from
222
- # 0 to 500. The higher the IAQ index, the greater the level of air pollution.
225
+ # Returns the IAQ index and accuracy. The higher the IAQ index, the greater the level of air pollution.
223
226
  #
224
227
  # .. image:: /Images/Misc/bricklet_air_quality_iaq_index.png
225
228
  # :scale: 100 %
@@ -231,7 +234,9 @@ module Tinkerforge
231
234
  # CALLBACK_IAQ_INDEX callback. You can set the callback configuration
232
235
  # with BrickletAirQuality#set_iaq_index_callback_configuration.
233
236
  def get_iaq_index
234
- send_request FUNCTION_GET_IAQ_INDEX, [], '', 5, 'l C'
237
+ check_validity
238
+
239
+ send_request FUNCTION_GET_IAQ_INDEX, [], '', 13, 'l C'
235
240
  end
236
241
 
237
242
  # The period is the period with which the CALLBACK_IAQ_INDEX
@@ -244,23 +249,29 @@ module Tinkerforge
244
249
  # If it is set to false, the callback is continuously triggered with the period,
245
250
  # independent of the value.
246
251
  def set_iaq_index_callback_configuration(period, value_has_to_change)
247
- send_request FUNCTION_SET_IAQ_INDEX_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
252
+ check_validity
253
+
254
+ send_request FUNCTION_SET_IAQ_INDEX_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
248
255
  end
249
256
 
250
257
  # Returns the callback configuration as set by
251
258
  # BrickletAirQuality#set_iaq_index_callback_configuration.
252
259
  def get_iaq_index_callback_configuration
253
- send_request FUNCTION_GET_IAQ_INDEX_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
260
+ check_validity
261
+
262
+ send_request FUNCTION_GET_IAQ_INDEX_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
254
263
  end
255
264
 
256
- # Returns temperature in steps of 0.01 °C.
265
+ # Returns temperature.
257
266
  #
258
267
  #
259
268
  # If you want to get the value periodically, it is recommended to use the
260
269
  # CALLBACK_TEMPERATURE callback. You can set the callback configuration
261
270
  # with BrickletAirQuality#set_temperature_callback_configuration.
262
271
  def get_temperature
263
- send_request FUNCTION_GET_TEMPERATURE, [], '', 4, 'l'
272
+ check_validity
273
+
274
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 12, 'l'
264
275
  end
265
276
 
266
277
  # The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
@@ -289,22 +300,28 @@ module Tinkerforge
289
300
  #
290
301
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
291
302
  def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
292
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
303
+ check_validity
304
+
305
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
293
306
  end
294
307
 
295
308
  # Returns the callback configuration as set by BrickletAirQuality#set_temperature_callback_configuration.
296
309
  def get_temperature_callback_configuration
297
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
310
+ check_validity
311
+
312
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
298
313
  end
299
314
 
300
- # Returns relative humidity in steps of 0.01 %RH.
315
+ # Returns relative humidity.
301
316
  #
302
317
  #
303
318
  # If you want to get the value periodically, it is recommended to use the
304
319
  # CALLBACK_HUMIDITY callback. You can set the callback configuration
305
320
  # with BrickletAirQuality#set_humidity_callback_configuration.
306
321
  def get_humidity
307
- send_request FUNCTION_GET_HUMIDITY, [], '', 4, 'l'
322
+ check_validity
323
+
324
+ send_request FUNCTION_GET_HUMIDITY, [], '', 12, 'l'
308
325
  end
309
326
 
310
327
  # The period is the period with which the CALLBACK_HUMIDITY callback is triggered
@@ -333,22 +350,28 @@ module Tinkerforge
333
350
  #
334
351
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
335
352
  def set_humidity_callback_configuration(period, value_has_to_change, option, min, max)
336
- send_request FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
353
+ check_validity
354
+
355
+ send_request FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
337
356
  end
338
357
 
339
358
  # Returns the callback configuration as set by BrickletAirQuality#set_humidity_callback_configuration.
340
359
  def get_humidity_callback_configuration
341
- send_request FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
360
+ check_validity
361
+
362
+ send_request FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
342
363
  end
343
364
 
344
- # Returns air pressure in steps of 0.01 hPa.
365
+ # Returns air pressure.
345
366
  #
346
367
  #
347
368
  # If you want to get the value periodically, it is recommended to use the
348
369
  # CALLBACK_AIR_PRESSURE callback. You can set the callback configuration
349
370
  # with BrickletAirQuality#set_air_pressure_callback_configuration.
350
371
  def get_air_pressure
351
- send_request FUNCTION_GET_AIR_PRESSURE, [], '', 4, 'l'
372
+ check_validity
373
+
374
+ send_request FUNCTION_GET_AIR_PRESSURE, [], '', 12, 'l'
352
375
  end
353
376
 
354
377
  # The period is the period with which the CALLBACK_AIR_PRESSURE callback is triggered
@@ -377,12 +400,16 @@ module Tinkerforge
377
400
  #
378
401
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
379
402
  def set_air_pressure_callback_configuration(period, value_has_to_change, option, min, max)
380
- send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
403
+ check_validity
404
+
405
+ send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
381
406
  end
382
407
 
383
408
  # Returns the callback configuration as set by BrickletAirQuality#set_air_pressure_callback_configuration.
384
409
  def get_air_pressure_callback_configuration
385
- send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
410
+ check_validity
411
+
412
+ send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
386
413
  end
387
414
 
388
415
  # Deletes the calibration from flash. After you call this function,
@@ -396,7 +423,9 @@ module Tinkerforge
396
423
  #
397
424
  # .. versionadded:: 2.0.3$nbsp;(Plugin)
398
425
  def remove_calibration
399
- send_request FUNCTION_REMOVE_CALIBRATION, [], '', 0, ''
426
+ check_validity
427
+
428
+ send_request FUNCTION_REMOVE_CALIBRATION, [], '', 8, ''
400
429
  end
401
430
 
402
431
  # The Air Quality Bricklet uses an automatic background calibration mechanism to
@@ -422,7 +451,9 @@ module Tinkerforge
422
451
  #
423
452
  # .. versionadded:: 2.0.3$nbsp;(Plugin)
424
453
  def set_background_calibration_duration(duration)
425
- send_request FUNCTION_SET_BACKGROUND_CALIBRATION_DURATION, [duration], 'C', 0, ''
454
+ check_validity
455
+
456
+ send_request FUNCTION_SET_BACKGROUND_CALIBRATION_DURATION, [duration], 'C', 8, ''
426
457
  end
427
458
 
428
459
  # Returns the background calibration duration as set by
@@ -430,7 +461,9 @@ module Tinkerforge
430
461
  #
431
462
  # .. versionadded:: 2.0.3$nbsp;(Plugin)
432
463
  def get_background_calibration_duration
433
- send_request FUNCTION_GET_BACKGROUND_CALIBRATION_DURATION, [], '', 1, 'C'
464
+ check_validity
465
+
466
+ send_request FUNCTION_GET_BACKGROUND_CALIBRATION_DURATION, [], '', 9, 'C'
434
467
  end
435
468
 
436
469
  # Returns the error count for the communication between Brick and Bricklet.
@@ -445,7 +478,9 @@ module Tinkerforge
445
478
  # The errors counts are for errors that occur on the Bricklet side. All
446
479
  # Bricks have a similar function that returns the errors on the Brick side.
447
480
  def get_spitfp_error_count
448
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
481
+ check_validity
482
+
483
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
449
484
  end
450
485
 
451
486
  # Sets the bootloader mode and returns the status after the requested
@@ -458,12 +493,16 @@ module Tinkerforge
458
493
  # This function is used by Brick Viewer during flashing. It should not be
459
494
  # necessary to call it in a normal user program.
460
495
  def set_bootloader_mode(mode)
461
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
496
+ check_validity
497
+
498
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
462
499
  end
463
500
 
464
501
  # Returns the current bootloader mode, see BrickletAirQuality#set_bootloader_mode.
465
502
  def get_bootloader_mode
466
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
503
+ check_validity
504
+
505
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
467
506
  end
468
507
 
469
508
  # Sets the firmware pointer for BrickletAirQuality#write_firmware. The pointer has
@@ -473,7 +512,9 @@ module Tinkerforge
473
512
  # This function is used by Brick Viewer during flashing. It should not be
474
513
  # necessary to call it in a normal user program.
475
514
  def set_write_firmware_pointer(pointer)
476
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
515
+ check_validity
516
+
517
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
477
518
  end
478
519
 
479
520
  # Writes 64 Bytes of firmware at the position as written by
@@ -485,7 +526,9 @@ module Tinkerforge
485
526
  # This function is used by Brick Viewer during flashing. It should not be
486
527
  # necessary to call it in a normal user program.
487
528
  def write_firmware(data)
488
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
529
+ check_validity
530
+
531
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
489
532
  end
490
533
 
491
534
  # Sets the status LED configuration. By default the LED shows
@@ -496,22 +539,28 @@ module Tinkerforge
496
539
  #
497
540
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
498
541
  def set_status_led_config(config)
499
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
542
+ check_validity
543
+
544
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
500
545
  end
501
546
 
502
547
  # Returns the configuration as set by BrickletAirQuality#set_status_led_config
503
548
  def get_status_led_config
504
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
549
+ check_validity
550
+
551
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
505
552
  end
506
553
 
507
- # Returns the temperature in °C as measured inside the microcontroller. The
554
+ # Returns the temperature as measured inside the microcontroller. The
508
555
  # value returned is not the ambient temperature!
509
556
  #
510
557
  # The temperature is only proportional to the real temperature and it has bad
511
558
  # accuracy. Practically it is only useful as an indicator for
512
559
  # temperature changes.
513
560
  def get_chip_temperature
514
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
561
+ check_validity
562
+
563
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
515
564
  end
516
565
 
517
566
  # Calling this function will reset the Bricklet. All configurations
@@ -521,7 +570,9 @@ module Tinkerforge
521
570
  # calling functions on the existing ones will result in
522
571
  # undefined behavior!
523
572
  def reset
524
- send_request FUNCTION_RESET, [], '', 0, ''
573
+ check_validity
574
+
575
+ send_request FUNCTION_RESET, [], '', 8, ''
525
576
  end
526
577
 
527
578
  # Writes a new UID into flash. If you want to set a new UID
@@ -530,25 +581,32 @@ module Tinkerforge
530
581
  #
531
582
  # We recommend that you use Brick Viewer to change the UID.
532
583
  def write_uid(uid)
533
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
584
+ check_validity
585
+
586
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
534
587
  end
535
588
 
536
589
  # Returns the current UID as an integer. Encode as
537
590
  # Base58 to get the usual string version.
538
591
  def read_uid
539
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
592
+ check_validity
593
+
594
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
540
595
  end
541
596
 
542
597
  # Returns the UID, the UID where the Bricklet is connected to,
543
598
  # the position, the hardware and firmware version as well as the
544
599
  # device identifier.
545
600
  #
546
- # The position can be 'a', 'b', 'c' or 'd'.
601
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
602
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
603
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
604
+ # position 'z'.
547
605
  #
548
606
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
549
607
  # |device_identifier_constant|
550
608
  def get_identity
551
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
609
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
552
610
  end
553
611
 
554
612
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Measures ambient light up to 900lux
14
16
  class BrickletAmbientLight < Device
@@ -70,7 +72,7 @@ module Tinkerforge
70
72
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
71
73
  # the IP Connection <tt>ipcon</tt>.
72
74
  def initialize(uid, ipcon)
73
- super uid, ipcon
75
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
74
76
 
75
77
  @api_version = [2, 0, 1]
76
78
 
@@ -88,11 +90,12 @@ module Tinkerforge
88
90
  @response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
89
91
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
90
92
 
91
- @callback_formats[CALLBACK_ILLUMINANCE] = 'S'
92
- @callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
93
- @callback_formats[CALLBACK_ILLUMINANCE_REACHED] = 'S'
94
- @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
93
+ @callback_formats[CALLBACK_ILLUMINANCE] = [10, 'S']
94
+ @callback_formats[CALLBACK_ANALOG_VALUE] = [10, 'S']
95
+ @callback_formats[CALLBACK_ILLUMINANCE_REACHED] = [10, 'S']
96
+ @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = [10, 'S']
95
97
 
98
+ @ipcon.add_device self
96
99
  end
97
100
 
98
101
  # Returns the illuminance of the ambient light sensor.
@@ -101,7 +104,9 @@ module Tinkerforge
101
104
  # CALLBACK_ILLUMINANCE callback and set the period with
102
105
  # BrickletAmbientLight#set_illuminance_callback_period.
103
106
  def get_illuminance
104
- send_request FUNCTION_GET_ILLUMINANCE, [], '', 2, 'S'
107
+ check_validity
108
+
109
+ send_request FUNCTION_GET_ILLUMINANCE, [], '', 10, 'S'
105
110
  end
106
111
 
107
112
  # Returns the value as read by a 12-bit analog-to-digital converter.
@@ -120,7 +125,9 @@ module Tinkerforge
120
125
  # CALLBACK_ANALOG_VALUE callback and set the period with
121
126
  # BrickletAmbientLight#set_analog_value_callback_period.
122
127
  def get_analog_value
123
- send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
128
+ check_validity
129
+
130
+ send_request FUNCTION_GET_ANALOG_VALUE, [], '', 10, 'S'
124
131
  end
125
132
 
126
133
  # Sets the period with which the CALLBACK_ILLUMINANCE callback is triggered
@@ -129,12 +136,16 @@ module Tinkerforge
129
136
  # The CALLBACK_ILLUMINANCE callback is only triggered if the illuminance has changed
130
137
  # since the last triggering.
131
138
  def set_illuminance_callback_period(period)
132
- send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_PERIOD, [period], 'L', 0, ''
139
+ check_validity
140
+
141
+ send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_PERIOD, [period], 'L', 8, ''
133
142
  end
134
143
 
135
144
  # Returns the period as set by BrickletAmbientLight#set_illuminance_callback_period.
136
145
  def get_illuminance_callback_period
137
- send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_PERIOD, [], '', 4, 'L'
146
+ check_validity
147
+
148
+ send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_PERIOD, [], '', 12, 'L'
138
149
  end
139
150
 
140
151
  # Sets the period with which the CALLBACK_ANALOG_VALUE callback is triggered
@@ -143,12 +154,16 @@ module Tinkerforge
143
154
  # The CALLBACK_ANALOG_VALUE callback is only triggered if the analog value has
144
155
  # changed since the last triggering.
145
156
  def set_analog_value_callback_period(period)
146
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
157
+ check_validity
158
+
159
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 8, ''
147
160
  end
148
161
 
149
162
  # Returns the period as set by BrickletAmbientLight#set_analog_value_callback_period.
150
163
  def get_analog_value_callback_period
151
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
164
+ check_validity
165
+
166
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 12, 'L'
152
167
  end
153
168
 
154
169
  # Sets the thresholds for the CALLBACK_ILLUMINANCE_REACHED callback.
@@ -163,12 +178,16 @@ module Tinkerforge
163
178
  # "'<'", "Callback is triggered when the illuminance is smaller than the min value (max is ignored)"
164
179
  # "'>'", "Callback is triggered when the illuminance is greater than the min value (max is ignored)"
165
180
  def set_illuminance_callback_threshold(option, min, max)
166
- send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
181
+ check_validity
182
+
183
+ send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
167
184
  end
168
185
 
169
186
  # Returns the threshold as set by BrickletAmbientLight#set_illuminance_callback_threshold.
170
187
  def get_illuminance_callback_threshold
171
- send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
188
+ check_validity
189
+
190
+ send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
172
191
  end
173
192
 
174
193
  # Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
@@ -183,12 +202,16 @@ module Tinkerforge
183
202
  # "'<'", "Callback is triggered when the analog value is smaller than the min value (max is ignored)"
184
203
  # "'>'", "Callback is triggered when the analog value is greater than the min value (max is ignored)"
185
204
  def set_analog_value_callback_threshold(option, min, max)
186
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
205
+ check_validity
206
+
207
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
187
208
  end
188
209
 
189
210
  # Returns the threshold as set by BrickletAmbientLight#set_analog_value_callback_threshold.
190
211
  def get_analog_value_callback_threshold
191
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
212
+ check_validity
213
+
214
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
192
215
  end
193
216
 
194
217
  # Sets the period with which the threshold callbacks
@@ -203,24 +226,31 @@ module Tinkerforge
203
226
  #
204
227
  # keep being reached.
205
228
  def set_debounce_period(debounce)
206
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
229
+ check_validity
230
+
231
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
207
232
  end
208
233
 
209
234
  # Returns the debounce period as set by BrickletAmbientLight#set_debounce_period.
210
235
  def get_debounce_period
211
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
236
+ check_validity
237
+
238
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
212
239
  end
213
240
 
214
241
  # Returns the UID, the UID where the Bricklet is connected to,
215
242
  # the position, the hardware and firmware version as well as the
216
243
  # device identifier.
217
244
  #
218
- # The position can be 'a', 'b', 'c' or 'd'.
245
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
246
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
247
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
248
+ # position 'z'.
219
249
  #
220
250
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
221
251
  # |device_identifier_constant|
222
252
  def get_identity
223
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
253
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
224
254
  end
225
255
 
226
256
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.