tinkerforge 2.1.17 → 2.1.18

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 (120) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +6 -6
  3. data/lib/tinkerforge/brick_imu.rb +6 -6
  4. data/lib/tinkerforge/brick_imu_v2.rb +13 -6
  5. data/lib/tinkerforge/brick_master.rb +6 -6
  6. data/lib/tinkerforge/brick_red.rb +2 -2
  7. data/lib/tinkerforge/brick_servo.rb +9 -7
  8. data/lib/tinkerforge/brick_silent_stepper.rb +13 -13
  9. data/lib/tinkerforge/brick_stepper.rb +6 -6
  10. data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
  11. data/lib/tinkerforge/bricklet_air_quality.rb +514 -0
  12. data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
  13. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +2 -2
  14. data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
  15. data/lib/tinkerforge/bricklet_analog_in_v2.rb +2 -2
  16. data/lib/tinkerforge/bricklet_analog_in_v3.rb +5 -5
  17. data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
  18. data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
  19. data/lib/tinkerforge/bricklet_analog_out_v3.rb +210 -0
  20. data/lib/tinkerforge/bricklet_barometer.rb +2 -2
  21. data/lib/tinkerforge/bricklet_barometer_v2.rb +497 -0
  22. data/lib/tinkerforge/bricklet_can.rb +2 -2
  23. data/lib/tinkerforge/bricklet_can_v2.rb +5 -5
  24. data/lib/tinkerforge/bricklet_co2.rb +2 -2
  25. data/lib/tinkerforge/bricklet_color.rb +2 -2
  26. data/lib/tinkerforge/bricklet_current12.rb +2 -2
  27. data/lib/tinkerforge/bricklet_current25.rb +2 -2
  28. data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
  29. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +398 -0
  30. data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
  31. data/lib/tinkerforge/bricklet_dmx.rb +7 -5
  32. data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
  33. data/lib/tinkerforge/bricklet_dual_button_v2.rb +283 -0
  34. data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
  35. data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
  36. data/lib/tinkerforge/bricklet_gps.rb +2 -2
  37. data/lib/tinkerforge/bricklet_gps_v2.rb +6 -6
  38. data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
  39. data/lib/tinkerforge/bricklet_humidity.rb +2 -2
  40. data/lib/tinkerforge/bricklet_humidity_v2.rb +5 -5
  41. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
  42. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +336 -0
  43. data/lib/tinkerforge/bricklet_industrial_counter.rb +12 -12
  44. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
  45. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +7 -7
  46. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
  47. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +302 -0
  48. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
  49. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +382 -0
  50. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
  51. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +374 -0
  52. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +5 -5
  53. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
  54. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +11 -11
  55. data/lib/tinkerforge/bricklet_io16.rb +2 -2
  56. data/lib/tinkerforge/bricklet_io16_v2.rb +418 -0
  57. data/lib/tinkerforge/bricklet_io4.rb +2 -2
  58. data/lib/tinkerforge/bricklet_io4_v2.rb +6 -6
  59. data/lib/tinkerforge/bricklet_isolator.rb +282 -0
  60. data/lib/tinkerforge/bricklet_joystick.rb +2 -2
  61. data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
  62. data/lib/tinkerforge/bricklet_lcd_128x64.rb +486 -0
  63. data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
  64. data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
  65. data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
  66. data/lib/tinkerforge/bricklet_led_strip_v2.rb +8 -8
  67. data/lib/tinkerforge/bricklet_line.rb +2 -2
  68. data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
  69. data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
  70. data/lib/tinkerforge/bricklet_load_cell_v2.rb +5 -5
  71. data/lib/tinkerforge/bricklet_moisture.rb +2 -2
  72. data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
  73. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +6 -6
  74. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +5 -5
  75. data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
  76. data/lib/tinkerforge/bricklet_nfc.rb +6 -6
  77. data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
  78. data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
  79. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +387 -0
  80. data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
  81. data/lib/tinkerforge/bricklet_one_wire.rb +305 -0
  82. data/lib/tinkerforge/bricklet_outdoor_weather.rb +5 -5
  83. data/lib/tinkerforge/bricklet_particulate_matter.rb +5 -5
  84. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
  85. data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
  86. data/lib/tinkerforge/bricklet_ptc.rb +2 -2
  87. data/lib/tinkerforge/bricklet_ptc_v2.rb +5 -5
  88. data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
  89. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +5 -5
  90. data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
  91. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +5 -5
  92. data/lib/tinkerforge/bricklet_rgb_led.rb +2 -2
  93. data/lib/tinkerforge/bricklet_rgb_led_button.rb +5 -5
  94. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +5 -5
  95. data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
  96. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +5 -5
  97. data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
  98. data/lib/tinkerforge/bricklet_rs232.rb +2 -2
  99. data/lib/tinkerforge/bricklet_rs232_v2.rb +5 -5
  100. data/lib/tinkerforge/bricklet_rs485.rb +5 -5
  101. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
  102. data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
  103. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +5 -5
  104. data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
  105. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +9 -9
  106. data/lib/tinkerforge/bricklet_temperature.rb +2 -2
  107. data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
  108. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +5 -5
  109. data/lib/tinkerforge/bricklet_temperature_v2.rb +278 -0
  110. data/lib/tinkerforge/bricklet_thermal_imaging.rb +5 -5
  111. data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
  112. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +5 -5
  113. data/lib/tinkerforge/bricklet_tilt.rb +2 -2
  114. data/lib/tinkerforge/bricklet_uv_light.rb +6 -5
  115. data/lib/tinkerforge/bricklet_uv_light_v2.rb +430 -0
  116. data/lib/tinkerforge/bricklet_voltage.rb +2 -2
  117. data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
  118. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +5 -5
  119. data/lib/tinkerforge/version.rb +1 -1
  120. metadata +18 -2
@@ -0,0 +1,514 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2018-09-28. #
4
+ # #
5
+ # Ruby Bindings Version 2.1.18 #
6
+ # #
7
+ # If you have a bugfix for this file and want to commit it, #
8
+ # please fix the bug in the generator. You can find a link #
9
+ # to the generators git repository on tinkerforge.com #
10
+ #############################################################
11
+
12
+ module Tinkerforge
13
+ # Measures IAQ index, temperature, humidity and air pressure
14
+ class BrickletAirQuality < Device
15
+ DEVICE_IDENTIFIER = 297 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Air Quality Bricklet' # :nodoc:
17
+
18
+ # This callback is triggered periodically according to the configuration set by
19
+ # BrickletAirQuality#set_all_values_callback_configuration.
20
+ #
21
+ # The parameters are the same as BrickletAirQuality#get_all_values.
22
+ CALLBACK_ALL_VALUES = 6
23
+
24
+ # This callback is triggered periodically according to the configuration set by
25
+ # BrickletAirQuality#set_iaq_index_callback_configuration.
26
+ #
27
+ # The parameters are the same as BrickletAirQuality#get_iaq_index.
28
+ CALLBACK_IAQ_INDEX = 10
29
+
30
+ # This callback is triggered periodically according to the configuration set by
31
+ # BrickletAirQuality#set_temperature_callback_configuration.
32
+ #
33
+ # The parameter is the same as BrickletAirQuality#get_temperature.
34
+ CALLBACK_TEMPERATURE = 14
35
+
36
+ # This callback is triggered periodically according to the configuration set by
37
+ # BrickletAirQuality#set_humidity_callback_configuration.
38
+ #
39
+ # The parameter is the same as BrickletAirQuality#get_humidity.
40
+ CALLBACK_HUMIDITY = 18
41
+
42
+ # This callback is triggered periodically according to the configuration set by
43
+ # BrickletAirQuality#set_air_pressure_callback_configuration.
44
+ #
45
+ # The parameter is the same as BrickletAirQuality#get_air_pressure.
46
+ CALLBACK_AIR_PRESSURE = 22
47
+
48
+ FUNCTION_GET_ALL_VALUES = 1 # :nodoc:
49
+ FUNCTION_SET_TEMPERATURE_OFFSET = 2 # :nodoc:
50
+ FUNCTION_GET_TEMPERATURE_OFFSET = 3 # :nodoc:
51
+ FUNCTION_SET_ALL_VALUES_CALLBACK_CONFIGURATION = 4 # :nodoc:
52
+ FUNCTION_GET_ALL_VALUES_CALLBACK_CONFIGURATION = 5 # :nodoc:
53
+ FUNCTION_GET_IAQ_INDEX = 7 # :nodoc:
54
+ FUNCTION_SET_IAQ_INDEX_CALLBACK_CONFIGURATION = 8 # :nodoc:
55
+ FUNCTION_GET_IAQ_INDEX_CALLBACK_CONFIGURATION = 9 # :nodoc:
56
+ FUNCTION_GET_TEMPERATURE = 11 # :nodoc:
57
+ FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION = 12 # :nodoc:
58
+ FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION = 13 # :nodoc:
59
+ FUNCTION_GET_HUMIDITY = 15 # :nodoc:
60
+ FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION = 16 # :nodoc:
61
+ FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION = 17 # :nodoc:
62
+ FUNCTION_GET_AIR_PRESSURE = 19 # :nodoc:
63
+ FUNCTION_SET_AIR_PRESSURE_CALLBACK_CONFIGURATION = 20 # :nodoc:
64
+ FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION = 21 # :nodoc:
65
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
66
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
67
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
68
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
69
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
70
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
71
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
72
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
73
+ FUNCTION_RESET = 243 # :nodoc:
74
+ FUNCTION_WRITE_UID = 248 # :nodoc:
75
+ FUNCTION_READ_UID = 249 # :nodoc:
76
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
77
+
78
+ ACCURACY_UNRELIABLE = 0 # :nodoc:
79
+ ACCURACY_LOW = 1 # :nodoc:
80
+ ACCURACY_MEDIUM = 2 # :nodoc:
81
+ ACCURACY_HIGH = 3 # :nodoc:
82
+ THRESHOLD_OPTION_OFF = 'x' # :nodoc:
83
+ THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
84
+ THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
85
+ THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
86
+ THRESHOLD_OPTION_GREATER = '>' # :nodoc:
87
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
88
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
89
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
90
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
91
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
92
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
93
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
94
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
95
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
96
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
97
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
98
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
99
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
100
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
101
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
102
+
103
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
104
+ # the IP Connection <tt>ipcon</tt>.
105
+ def initialize(uid, ipcon)
106
+ super uid, ipcon
107
+
108
+ @api_version = [2, 0, 0]
109
+
110
+ @response_expected[FUNCTION_GET_ALL_VALUES] = RESPONSE_EXPECTED_ALWAYS_TRUE
111
+ @response_expected[FUNCTION_SET_TEMPERATURE_OFFSET] = RESPONSE_EXPECTED_FALSE
112
+ @response_expected[FUNCTION_GET_TEMPERATURE_OFFSET] = RESPONSE_EXPECTED_ALWAYS_TRUE
113
+ @response_expected[FUNCTION_SET_ALL_VALUES_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
114
+ @response_expected[FUNCTION_GET_ALL_VALUES_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
115
+ @response_expected[FUNCTION_GET_IAQ_INDEX] = RESPONSE_EXPECTED_ALWAYS_TRUE
116
+ @response_expected[FUNCTION_SET_IAQ_INDEX_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
117
+ @response_expected[FUNCTION_GET_IAQ_INDEX_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
118
+ @response_expected[FUNCTION_GET_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
119
+ @response_expected[FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
120
+ @response_expected[FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
121
+ @response_expected[FUNCTION_GET_HUMIDITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
122
+ @response_expected[FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
123
+ @response_expected[FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
124
+ @response_expected[FUNCTION_GET_AIR_PRESSURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
125
+ @response_expected[FUNCTION_SET_AIR_PRESSURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
126
+ @response_expected[FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
127
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
128
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
129
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
130
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
131
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
132
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
133
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
134
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
135
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
136
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
137
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
138
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
139
+
140
+ @callback_formats[CALLBACK_ALL_VALUES] = 'l C l l l'
141
+ @callback_formats[CALLBACK_IAQ_INDEX] = 'l C'
142
+ @callback_formats[CALLBACK_TEMPERATURE] = 'l'
143
+ @callback_formats[CALLBACK_HUMIDITY] = 'l'
144
+ @callback_formats[CALLBACK_AIR_PRESSURE] = 'l'
145
+
146
+ end
147
+
148
+ # Returns all values measured by the Air Quality Bricklet. The values are
149
+ # IAQ (Indoor Air Quality) Index, IAQ Index Accuracy, Temperature, Humidity and
150
+ # Air Pressure.
151
+ #
152
+ # .. image:: /Images/Misc/bricklet_air_quality_iaq_index.png
153
+ # :scale: 100 %
154
+ # :alt: Air Quality Index description
155
+ # :align: center
156
+ # :target: ../../_images/Misc/bricklet_air_quality_iaq_index.png
157
+ #
158
+ # The values have these ranges and units:
159
+ #
160
+ # * IAQ Index: 0 to 500, higher value means greater level of air pollution
161
+ # * IAQ Index Accuracy: 0 = unreliable to 3 = high
162
+ # * Temperature: in steps of 0.01 °C
163
+ # * Humidity: in steps of 0.01 %RH
164
+ # * Air Pressure: in steps of 0.01 mbar
165
+ def get_all_values
166
+ send_request FUNCTION_GET_ALL_VALUES, [], '', 17, 'l C l l l'
167
+ end
168
+
169
+ # Sets a temperature offset in 1/100°C. A offset of 10 will decrease the measured
170
+ # temperature by 0.1°C.
171
+ #
172
+ # If you install this Bricklet into an enclosure and you want to measure the ambient
173
+ # temperature, you may have to decrease the measured temperature by some value to
174
+ # compensate for the error because of the heating inside of the enclosure.
175
+ #
176
+ # We recommend that you leave the parts in the enclosure running for at least
177
+ # 24 hours such that a temperature equilibrium can be reached. After that you can measure
178
+ # the temperature directly outside of enclosure and set the difference as offset.
179
+ #
180
+ # This temperature offset is used to calculate the relative humidity and
181
+ # IAQ index measurements. In case the Bricklet is installed in an enclosure, we
182
+ # recommend to measure and set the temperature offset to imporve the accuracy of
183
+ # the measurements.
184
+ def set_temperature_offset(offset)
185
+ send_request FUNCTION_SET_TEMPERATURE_OFFSET, [offset], 'l', 0, ''
186
+ end
187
+
188
+ # Returns the temperature offset as set by
189
+ # BrickletAirQuality#set_temperature_offset.
190
+ def get_temperature_offset
191
+ send_request FUNCTION_GET_TEMPERATURE_OFFSET, [], '', 4, 'l'
192
+ end
193
+
194
+ # The period in ms is the period with which the CALLBACK_ALL_VALUES
195
+ # callback is triggered periodically. A value of 0 turns the callback off.
196
+ #
197
+ # If the `value has to change`-parameter is set to true, the callback is only
198
+ # triggered after at least one of the values has changed. If the values didn't
199
+ # change within the period, the callback is triggered immediately on change.
200
+ #
201
+ # If it is set to false, the callback is continuously triggered with the period,
202
+ # independent of the value.
203
+ #
204
+ # The default value is (0, false).
205
+ def set_all_values_callback_configuration(period, value_has_to_change)
206
+ send_request FUNCTION_SET_ALL_VALUES_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
207
+ end
208
+
209
+ # Returns the callback configuration as set by
210
+ # BrickletAirQuality#set_all_values_callback_configuration.
211
+ def get_all_values_callback_configuration
212
+ send_request FUNCTION_GET_ALL_VALUES_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
213
+ end
214
+
215
+ # Returns the IAQ index and accuracy. The IAQ index goes from
216
+ # 0 to 500. The higher the IAQ index, the greater the level of air pollution.
217
+ #
218
+ # .. image:: /Images/Misc/bricklet_air_quality_iaq_index.png
219
+ # :scale: 100 %
220
+ # :alt: IAQ index description
221
+ # :align: center
222
+ # :target: ../../_images/Misc/bricklet_air_quality_iaq_index.png
223
+ #
224
+ # If you want to get the value periodically, it is recommended to use the
225
+ # CALLBACK_IAQ_INDEX callback. You can set the callback configuration
226
+ # with BrickletAirQuality#set_iaq_index_callback_configuration.
227
+ def get_iaq_index
228
+ send_request FUNCTION_GET_IAQ_INDEX, [], '', 5, 'l C'
229
+ end
230
+
231
+ # The period in ms is the period with which the CALLBACK_IAQ_INDEX
232
+ # callback is triggered periodically. A value of 0 turns the callback off.
233
+ #
234
+ # If the `value has to change`-parameter is set to true, the callback is only
235
+ # triggered after at least one of the values has changed. If the values didn't
236
+ # change within the period, the callback is triggered immediately on change.
237
+ #
238
+ # If it is set to false, the callback is continuously triggered with the period,
239
+ # independent of the value.
240
+ #
241
+ # The default value is (0, false).
242
+ def set_iaq_index_callback_configuration(period, value_has_to_change)
243
+ send_request FUNCTION_SET_IAQ_INDEX_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
244
+ end
245
+
246
+ # Returns the callback configuration as set by
247
+ # BrickletAirQuality#set_iaq_index_callback_configuration.
248
+ def get_iaq_index_callback_configuration
249
+ send_request FUNCTION_GET_IAQ_INDEX_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
250
+ end
251
+
252
+ # Returns temperature in steps of 0.01 °C.
253
+ #
254
+ #
255
+ # If you want to get the value periodically, it is recommended to use the
256
+ # CALLBACK_TEMPERATURE callback. You can set the callback configuration
257
+ # with BrickletAirQuality#set_temperature_callback_configuration.
258
+ def get_temperature
259
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 4, 'l'
260
+ end
261
+
262
+ # The period in ms is the period with which the CALLBACK_TEMPERATURE callback is triggered
263
+ # periodically. A value of 0 turns the callback off.
264
+ #
265
+ # If the `value has to change`-parameter is set to true, the callback is only
266
+ # triggered after the value has changed. If the value didn't change
267
+ # within the period, the callback is triggered immediately on change.
268
+ #
269
+ # If it is set to false, the callback is continuously triggered with the period,
270
+ # independent of the value.
271
+ #
272
+ # It is furthermore possible to constrain the callback with thresholds.
273
+ #
274
+ # The `option`-parameter together with min/max sets a threshold for the CALLBACK_TEMPERATURE callback.
275
+ #
276
+ # The following options are possible:
277
+ #
278
+ # "Option", "Description"
279
+ #
280
+ # "'x'", "Threshold is turned off"
281
+ # "'o'", "Threshold is triggered when the value is *outside* the min and max values"
282
+ # "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
283
+ # "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
284
+ # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
285
+ #
286
+ # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
287
+ #
288
+ # The default value is (0, false, 'x', 0, 0).
289
+ def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
290
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
291
+ end
292
+
293
+ # Returns the callback configuration as set by BrickletAirQuality#set_temperature_callback_configuration.
294
+ def get_temperature_callback_configuration
295
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
296
+ end
297
+
298
+ # Returns relative humidity in steps of 0.01 %RH.
299
+ #
300
+ #
301
+ # If you want to get the value periodically, it is recommended to use the
302
+ # CALLBACK_HUMIDITY callback. You can set the callback configuration
303
+ # with BrickletAirQuality#set_humidity_callback_configuration.
304
+ def get_humidity
305
+ send_request FUNCTION_GET_HUMIDITY, [], '', 4, 'l'
306
+ end
307
+
308
+ # The period in ms is the period with which the CALLBACK_HUMIDITY callback is triggered
309
+ # periodically. A value of 0 turns the callback off.
310
+ #
311
+ # If the `value has to change`-parameter is set to true, the callback is only
312
+ # triggered after the value has changed. If the value didn't change
313
+ # within the period, the callback is triggered immediately on change.
314
+ #
315
+ # If it is set to false, the callback is continuously triggered with the period,
316
+ # independent of the value.
317
+ #
318
+ # It is furthermore possible to constrain the callback with thresholds.
319
+ #
320
+ # The `option`-parameter together with min/max sets a threshold for the CALLBACK_HUMIDITY callback.
321
+ #
322
+ # The following options are possible:
323
+ #
324
+ # "Option", "Description"
325
+ #
326
+ # "'x'", "Threshold is turned off"
327
+ # "'o'", "Threshold is triggered when the value is *outside* the min and max values"
328
+ # "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
329
+ # "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
330
+ # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
331
+ #
332
+ # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
333
+ #
334
+ # The default value is (0, false, 'x', 0, 0).
335
+ 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, ''
337
+ end
338
+
339
+ # Returns the callback configuration as set by BrickletAirQuality#set_humidity_callback_configuration.
340
+ def get_humidity_callback_configuration
341
+ send_request FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
342
+ end
343
+
344
+ # Returns air pressure in steps of 0.01 mbar.
345
+ #
346
+ #
347
+ # If you want to get the value periodically, it is recommended to use the
348
+ # CALLBACK_AIR_PRESSURE callback. You can set the callback configuration
349
+ # with BrickletAirQuality#set_air_pressure_callback_configuration.
350
+ def get_air_pressure
351
+ send_request FUNCTION_GET_AIR_PRESSURE, [], '', 4, 'l'
352
+ end
353
+
354
+ # The period in ms is the period with which the CALLBACK_AIR_PRESSURE callback is triggered
355
+ # periodically. A value of 0 turns the callback off.
356
+ #
357
+ # If the `value has to change`-parameter is set to true, the callback is only
358
+ # triggered after the value has changed. If the value didn't change
359
+ # within the period, the callback is triggered immediately on change.
360
+ #
361
+ # If it is set to false, the callback is continuously triggered with the period,
362
+ # independent of the value.
363
+ #
364
+ # It is furthermore possible to constrain the callback with thresholds.
365
+ #
366
+ # The `option`-parameter together with min/max sets a threshold for the CALLBACK_AIR_PRESSURE callback.
367
+ #
368
+ # The following options are possible:
369
+ #
370
+ # "Option", "Description"
371
+ #
372
+ # "'x'", "Threshold is turned off"
373
+ # "'o'", "Threshold is triggered when the value is *outside* the min and max values"
374
+ # "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
375
+ # "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
376
+ # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
377
+ #
378
+ # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
379
+ #
380
+ # The default value is (0, false, 'x', 0, 0).
381
+ def set_air_pressure_callback_configuration(period, value_has_to_change, option, min, max)
382
+ send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
383
+ end
384
+
385
+ # Returns the callback configuration as set by BrickletAirQuality#set_air_pressure_callback_configuration.
386
+ def get_air_pressure_callback_configuration
387
+ send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
388
+ end
389
+
390
+ # Returns the error count for the communication between Brick and Bricklet.
391
+ #
392
+ # The errors are divided into
393
+ #
394
+ # * ACK checksum errors,
395
+ # * message checksum errors,
396
+ # * framing errors and
397
+ # * overflow errors.
398
+ #
399
+ # The errors counts are for errors that occur on the Bricklet side. All
400
+ # Bricks have a similar function that returns the errors on the Brick side.
401
+ def get_spitfp_error_count
402
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
403
+ end
404
+
405
+ # Sets the bootloader mode and returns the status after the requested
406
+ # mode change was instigated.
407
+ #
408
+ # You can change from bootloader mode to firmware mode and vice versa. A change
409
+ # from bootloader mode to firmware mode will only take place if the entry function,
410
+ # device identifier and CRC are present and correct.
411
+ #
412
+ # This function is used by Brick Viewer during flashing. It should not be
413
+ # necessary to call it in a normal user program.
414
+ def set_bootloader_mode(mode)
415
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
416
+ end
417
+
418
+ # Returns the current bootloader mode, see BrickletAirQuality#set_bootloader_mode.
419
+ def get_bootloader_mode
420
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
421
+ end
422
+
423
+ # Sets the firmware pointer for BrickletAirQuality#write_firmware. The pointer has
424
+ # to be increased by chunks of size 64. The data is written to flash
425
+ # every 4 chunks (which equals to one page of size 256).
426
+ #
427
+ # This function is used by Brick Viewer during flashing. It should not be
428
+ # necessary to call it in a normal user program.
429
+ def set_write_firmware_pointer(pointer)
430
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
431
+ end
432
+
433
+ # Writes 64 Bytes of firmware at the position as written by
434
+ # BrickletAirQuality#set_write_firmware_pointer before. The firmware is written
435
+ # to flash every 4 chunks.
436
+ #
437
+ # You can only write firmware in bootloader mode.
438
+ #
439
+ # This function is used by Brick Viewer during flashing. It should not be
440
+ # necessary to call it in a normal user program.
441
+ def write_firmware(data)
442
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
443
+ end
444
+
445
+ # Sets the status LED configuration. By default the LED shows
446
+ # communication traffic between Brick and Bricklet, it flickers once
447
+ # for every 10 received data packets.
448
+ #
449
+ # You can also turn the LED permanently on/off or show a heartbeat.
450
+ #
451
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
452
+ def set_status_led_config(config)
453
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
454
+ end
455
+
456
+ # Returns the configuration as set by BrickletAirQuality#set_status_led_config
457
+ def get_status_led_config
458
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
459
+ end
460
+
461
+ # Returns the temperature in °C as measured inside the microcontroller. The
462
+ # value returned is not the ambient temperature!
463
+ #
464
+ # The temperature is only proportional to the real temperature and it has bad
465
+ # accuracy. Practically it is only useful as an indicator for
466
+ # temperature changes.
467
+ def get_chip_temperature
468
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
469
+ end
470
+
471
+ # Calling this function will reset the Bricklet. All configurations
472
+ # will be lost.
473
+ #
474
+ # After a reset you have to create new device objects,
475
+ # calling functions on the existing ones will result in
476
+ # undefined behavior!
477
+ def reset
478
+ send_request FUNCTION_RESET, [], '', 0, ''
479
+ end
480
+
481
+ # Writes a new UID into flash. If you want to set a new UID
482
+ # you have to decode the Base58 encoded UID string into an
483
+ # integer first.
484
+ #
485
+ # We recommend that you use Brick Viewer to change the UID.
486
+ def write_uid(uid)
487
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
488
+ end
489
+
490
+ # Returns the current UID as an integer. Encode as
491
+ # Base58 to get the usual string version.
492
+ def read_uid
493
+ send_request FUNCTION_READ_UID, [], '', 4, 'L'
494
+ end
495
+
496
+ # Returns the UID, the UID where the Bricklet is connected to,
497
+ # the position, the hardware and firmware version as well as the
498
+ # device identifier.
499
+ #
500
+ # The position can be 'a', 'b', 'c' or 'd'.
501
+ #
502
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
503
+ # |device_identifier_constant|
504
+ def get_identity
505
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
506
+ end
507
+
508
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
509
+ def register_callback(id, &block)
510
+ callback = block
511
+ @registered_callbacks[id] = callback
512
+ end
513
+ end
514
+ end
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #
@@ -195,9 +195,9 @@ module Tinkerforge
195
195
  #
196
196
  # The errors are divided into
197
197
  #
198
- # * ack checksum errors,
198
+ # * ACK checksum errors,
199
199
  # * message checksum errors,
200
- # * frameing errors and
200
+ # * framing errors and
201
201
  # * overflow errors.
202
202
  #
203
203
  # The errors counts are for errors that occur on the Bricklet side. All
@@ -211,7 +211,7 @@ module Tinkerforge
211
211
  #
212
212
  # You can change from bootloader mode to firmware mode and vice versa. A change
213
213
  # from bootloader mode to firmware mode will only take place if the entry function,
214
- # device identifier und crc are present and correct.
214
+ # device identifier and CRC are present and correct.
215
215
  #
216
216
  # This function is used by Brick Viewer during flashing. It should not be
217
217
  # necessary to call it in a normal user program.
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #