tinkerforge 2.1.4 → 2.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/lib/tinkerforge/brick_dc.rb +42 -4
  2. data/lib/tinkerforge/brick_imu.rb +49 -11
  3. data/lib/tinkerforge/brick_imu_v2.rb +506 -0
  4. data/lib/tinkerforge/brick_master.rb +86 -46
  5. data/lib/tinkerforge/brick_red.rb +36 -5
  6. data/lib/tinkerforge/brick_servo.rb +53 -15
  7. data/lib/tinkerforge/brick_stepper.rb +43 -14
  8. data/lib/tinkerforge/bricklet_accelerometer.rb +229 -0
  9. data/lib/tinkerforge/bricklet_ambient_light.rb +10 -9
  10. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +216 -0
  11. data/lib/tinkerforge/bricklet_analog_in.rb +13 -12
  12. data/lib/tinkerforge/bricklet_analog_in_v2.rb +259 -0
  13. data/lib/tinkerforge/bricklet_analog_out.rb +5 -4
  14. data/lib/tinkerforge/bricklet_analog_out_v2.rb +66 -0
  15. data/lib/tinkerforge/bricklet_barometer.rb +11 -9
  16. data/lib/tinkerforge/bricklet_color.rb +11 -9
  17. data/lib/tinkerforge/bricklet_current12.rb +5 -4
  18. data/lib/tinkerforge/bricklet_current25.rb +5 -4
  19. data/lib/tinkerforge/bricklet_distance_ir.rb +8 -7
  20. data/lib/tinkerforge/bricklet_distance_us.rb +9 -8
  21. data/lib/tinkerforge/bricklet_dual_button.rb +5 -4
  22. data/lib/tinkerforge/bricklet_dual_relay.rb +5 -4
  23. data/lib/tinkerforge/bricklet_dust_detector.rb +178 -0
  24. data/lib/tinkerforge/bricklet_gps.rb +6 -5
  25. data/lib/tinkerforge/bricklet_hall_effect.rb +5 -4
  26. data/lib/tinkerforge/bricklet_humidity.rb +8 -7
  27. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +137 -0
  28. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +8 -7
  29. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +5 -4
  30. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +6 -5
  31. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +209 -0
  32. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +5 -4
  33. data/lib/tinkerforge/bricklet_io16.rb +8 -7
  34. data/lib/tinkerforge/bricklet_io4.rb +8 -7
  35. data/lib/tinkerforge/bricklet_joystick.rb +5 -4
  36. data/lib/tinkerforge/bricklet_laser_range_finder.rb +324 -0
  37. data/lib/tinkerforge/bricklet_lcd_16x2.rb +7 -6
  38. data/lib/tinkerforge/bricklet_lcd_20x4.rb +11 -10
  39. data/lib/tinkerforge/bricklet_led_strip.rb +12 -10
  40. data/lib/tinkerforge/bricklet_line.rb +5 -4
  41. data/lib/tinkerforge/bricklet_linear_poti.rb +8 -7
  42. data/lib/tinkerforge/bricklet_load_cell.rb +261 -0
  43. data/lib/tinkerforge/bricklet_moisture.rb +6 -5
  44. data/lib/tinkerforge/bricklet_motion_detector.rb +5 -4
  45. data/lib/tinkerforge/bricklet_multi_touch.rb +5 -4
  46. data/lib/tinkerforge/bricklet_nfc_rfid.rb +38 -46
  47. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +5 -4
  48. data/lib/tinkerforge/bricklet_piezo_speaker.rb +6 -5
  49. data/lib/tinkerforge/bricklet_ptc.rb +5 -4
  50. data/lib/tinkerforge/bricklet_remote_switch.rb +9 -8
  51. data/lib/tinkerforge/bricklet_rotary_encoder.rb +5 -4
  52. data/lib/tinkerforge/bricklet_rotary_poti.rb +5 -4
  53. data/lib/tinkerforge/bricklet_rs232.rb +183 -0
  54. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +8 -5
  55. data/lib/tinkerforge/bricklet_solid_state_relay.rb +5 -4
  56. data/lib/tinkerforge/bricklet_sound_intensity.rb +6 -5
  57. data/lib/tinkerforge/bricklet_temperature.rb +7 -6
  58. data/lib/tinkerforge/bricklet_temperature_ir.rb +7 -6
  59. data/lib/tinkerforge/bricklet_tilt.rb +5 -4
  60. data/lib/tinkerforge/bricklet_voltage.rb +8 -7
  61. data/lib/tinkerforge/bricklet_voltage_current.rb +5 -4
  62. data/lib/tinkerforge/version.rb +1 -1
  63. metadata +13 -2
@@ -1,18 +1,19 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2014-12-10. #
3
+ # This file was automatically generated on 2015-11-17. #
4
4
  # #
5
- # Bindings Version 2.1.4 #
5
+ # Bindings Version 2.1.6 #
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
- # to the generator git on tinkerforge.com #
9
+ # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
12
  module Tinkerforge
13
- # Device for output of voltage between 0 and 5V
13
+ # Generates configurable DC voltage between 0V and 5V
14
14
  class BrickletAnalogOut < Device
15
15
  DEVICE_IDENTIFIER = 220 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Analog Out Bricklet' # :nodoc:
16
17
 
17
18
  FUNCTION_SET_VOLTAGE = 1 # :nodoc:
18
19
  FUNCTION_GET_VOLTAGE = 2 # :nodoc:
@@ -0,0 +1,66 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2015-11-17. #
4
+ # #
5
+ # Bindings Version 2.1.6 #
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
+ # Generates configurable DC voltage between 0V and 12V
14
+ class BrickletAnalogOutV2 < Device
15
+ DEVICE_IDENTIFIER = 256 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Analog Out Bricklet 2.0' # :nodoc:
17
+
18
+ FUNCTION_SET_OUTPUT_VOLTAGE = 1 # :nodoc:
19
+ FUNCTION_GET_OUTPUT_VOLTAGE = 2 # :nodoc:
20
+ FUNCTION_GET_INPUT_VOLTAGE = 3 # :nodoc:
21
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
22
+
23
+
24
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
25
+ # the IP Connection <tt>ipcon</tt>.
26
+ def initialize(uid, ipcon)
27
+ super uid, ipcon
28
+
29
+ @api_version = [2, 0, 0]
30
+
31
+ @response_expected[FUNCTION_SET_OUTPUT_VOLTAGE] = RESPONSE_EXPECTED_FALSE
32
+ @response_expected[FUNCTION_GET_OUTPUT_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
33
+ @response_expected[FUNCTION_GET_INPUT_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
34
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
35
+
36
+ end
37
+
38
+ # Sets the voltage in mV. The possible range is 0V to 12V (0-12000).
39
+ def set_output_voltage(voltage)
40
+ send_request(FUNCTION_SET_OUTPUT_VOLTAGE, [voltage], 'S', 0, '')
41
+ end
42
+
43
+ # Returns the voltage as set by BrickletAnalogOutV2#set_output_voltage.
44
+ def get_output_voltage
45
+ send_request(FUNCTION_GET_OUTPUT_VOLTAGE, [], '', 2, 'S')
46
+ end
47
+
48
+ # Returns the input voltage in mV.
49
+ def get_input_voltage
50
+ send_request(FUNCTION_GET_INPUT_VOLTAGE, [], '', 2, 'S')
51
+ end
52
+
53
+ # Returns the UID, the UID where the Bricklet is connected to,
54
+ # the position, the hardware and firmware version as well as the
55
+ # device identifier.
56
+ #
57
+ # The position can be 'a', 'b', 'c' or 'd'.
58
+ #
59
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
60
+ # |device_identifier_constant|
61
+ def get_identity
62
+ send_request(FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S')
63
+ end
64
+
65
+ end
66
+ end
@@ -1,18 +1,19 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2014-12-10. #
3
+ # This file was automatically generated on 2015-11-17. #
4
4
  # #
5
- # Bindings Version 2.1.4 #
5
+ # Bindings Version 2.1.6 #
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
- # to the generator git on tinkerforge.com #
9
+ # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
12
  module Tinkerforge
13
- # Device for sensing air pressure and altitude changes
13
+ # Measures air pressure and altitude changes
14
14
  class BrickletBarometer < Device
15
15
  DEVICE_IDENTIFIER = 221 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Barometer Bricklet' # :nodoc:
16
17
 
17
18
  # This callback is triggered periodically with the period that is set by
18
19
  # BrickletBarometer#set_air_pressure_callback_period. The parameter is the air pressure of the
@@ -228,13 +229,14 @@ module Tinkerforge
228
229
  end
229
230
 
230
231
  # Sets the reference air pressure in mbar/1000 for the altitude calculation.
232
+ # Valid values are between 10000 and 1200000.
231
233
  # Setting the reference to the current air pressure results in a calculated
232
234
  # altitude of 0cm. Passing 0 is a shortcut for passing the current air pressure as
233
235
  # reference.
234
236
  #
235
237
  # Well known reference values are the Q codes
236
- # `QNH <http://en.wikipedia.org/wiki/QNH>`__ and
237
- # `QFE <http://en.wikipedia.org/wiki/Mean_sea_level_pressure#Mean_sea_level_pressure>`__
238
+ # `QNH <https://en.wikipedia.org/wiki/QNH>`__ and
239
+ # `QFE <https://en.wikipedia.org/wiki/Mean_sea_level_pressure#Mean_sea_level_pressure>`__
238
240
  # used in aviation.
239
241
  #
240
242
  # The default value is 1013.25mbar.
@@ -261,7 +263,7 @@ module Tinkerforge
261
263
  # Sets the different averaging parameters. It is possible to set
262
264
  # the length of a normal averaging for the temperature and pressure,
263
265
  # as well as an additional length of a
264
- # `moving average <http://en.wikipedia.org/wiki/Moving_average>`__
266
+ # `moving average <https://en.wikipedia.org/wiki/Moving_average>`__
265
267
  # for the pressure. The moving average is calculated from the normal
266
268
  # averages. There is no moving average for the temperature.
267
269
  #
@@ -277,14 +279,14 @@ module Tinkerforge
277
279
  # The default values are 10 for the normal averages and 25 for the
278
280
  # moving average.
279
281
  #
280
- # .. versionadded:: 2.0.1~(Plugin)
282
+ # .. versionadded:: 2.0.1$nbsp;(Plugin)
281
283
  def set_averaging(moving_average_pressure, average_pressure, average_temperature)
282
284
  send_request(FUNCTION_SET_AVERAGING, [moving_average_pressure, average_pressure, average_temperature], 'C C C', 0, '')
283
285
  end
284
286
 
285
287
  # Returns the averaging configuration as set by BrickletBarometer#set_averaging.
286
288
  #
287
- # .. versionadded:: 2.0.1~(Plugin)
289
+ # .. versionadded:: 2.0.1$nbsp;(Plugin)
288
290
  def get_averaging
289
291
  send_request(FUNCTION_GET_AVERAGING, [], '', 3, 'C C C')
290
292
  end
@@ -1,18 +1,19 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2014-12-10. #
3
+ # This file was automatically generated on 2015-11-17. #
4
4
  # #
5
- # Bindings Version 2.1.4 #
5
+ # Bindings Version 2.1.6 #
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
- # to the generator git on tinkerforge.com #
9
+ # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
12
  module Tinkerforge
13
- # Device for measuring color (RGB value), illuminance and color temperature
13
+ # Measures color (RGB value), illuminance and color temperature
14
14
  class BrickletColor < Device
15
15
  DEVICE_IDENTIFIER = 243 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Color Bricklet' # :nodoc:
16
17
 
17
18
  # This callback is triggered periodically with the period that is set by
18
19
  # BrickletColor#set_color_callback_period. The parameter is the color
@@ -22,17 +23,18 @@ module Tinkerforge
22
23
  # last triggering.
23
24
  CALLBACK_COLOR = 8
24
25
 
25
- # This callback is triggered periodically with the period that is set by
26
- # BrickletColor#set_color_callback_period. The parameter is the color
26
+ # This callback is triggered when the threshold as set by
27
+ # BrickletColor#set_color_callback_threshold is reached.
28
+ # The parameter is the color
27
29
  # of the sensor as RGBC.
28
30
  #
29
- # CALLBACK_COLOR is only triggered if the color has changed since the
30
- # last triggering.
31
+ # If the threshold keeps being reached, the callback is triggered periodically
32
+ # with the period as set by BrickletColor#set_debounce_period.
31
33
  CALLBACK_COLOR_REACHED = 9
32
34
 
33
35
  # This callback is triggered periodically with the period that is set by
34
36
  # BrickletColor#set_illuminance_callback_period. The parameter is the illuminance.
35
- # See BrickletColor#get_illuminance for how to interrept this value.
37
+ # See BrickletColor#get_illuminance for how to interpret this value.
36
38
  #
37
39
  # CALLBACK_ILLUMINANCE is only triggered if the illuminance has changed since the
38
40
  # last triggering.
@@ -1,18 +1,19 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2014-12-10. #
3
+ # This file was automatically generated on 2015-11-17. #
4
4
  # #
5
- # Bindings Version 2.1.4 #
5
+ # Bindings Version 2.1.6 #
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
- # to the generator git on tinkerforge.com #
9
+ # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
12
  module Tinkerforge
13
- # Device for sensing current of up to 12.5A
13
+ # Measures AC/DC current between -12.5A and +12.5A
14
14
  class BrickletCurrent12 < Device
15
15
  DEVICE_IDENTIFIER = 23 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Current12 Bricklet' # :nodoc:
16
17
 
17
18
  # This callback is triggered periodically with the period that is set by
18
19
  # BrickletCurrent12#set_current_callback_period. The parameter is the current of the
@@ -1,18 +1,19 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2014-12-10. #
3
+ # This file was automatically generated on 2015-11-17. #
4
4
  # #
5
- # Bindings Version 2.1.4 #
5
+ # Bindings Version 2.1.6 #
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
- # to the generator git on tinkerforge.com #
9
+ # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
12
  module Tinkerforge
13
- # Device for sensing current of up to 25A
13
+ # Measures AC/DC current between -25A and +25A
14
14
  class BrickletCurrent25 < Device
15
15
  DEVICE_IDENTIFIER = 24 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Current25 Bricklet' # :nodoc:
16
17
 
17
18
  # This callback is triggered periodically with the period that is set by
18
19
  # BrickletCurrent25#set_current_callback_period. The parameter is the current of the
@@ -1,18 +1,19 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2014-12-10. #
3
+ # This file was automatically generated on 2015-11-17. #
4
4
  # #
5
- # Bindings Version 2.1.4 #
5
+ # Bindings Version 2.1.6 #
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
- # to the generator git on tinkerforge.com #
9
+ # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
12
  module Tinkerforge
13
- # Device for sensing distance via infrared
13
+ # Measures distance up to 150cm with infrared light
14
14
  class BrickletDistanceIR < Device
15
15
  DEVICE_IDENTIFIER = 25 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Distance IR Bricklet' # :nodoc:
16
17
 
17
18
  # This callback is triggered periodically with the period that is set by
18
19
  # BrickletDistanceIR#set_distance_callback_period. The parameter is the distance of the
@@ -73,7 +74,7 @@ module Tinkerforge
73
74
  def initialize(uid, ipcon)
74
75
  super uid, ipcon
75
76
 
76
- @api_version = [2, 0, 0]
77
+ @api_version = [2, 0, 1]
77
78
 
78
79
  @response_expected[FUNCTION_GET_DISTANCE] = RESPONSE_EXPECTED_ALWAYS_TRUE
79
80
  @response_expected[FUNCTION_GET_ANALOG_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -202,12 +203,12 @@ module Tinkerforge
202
203
  #
203
204
  # The default value is ('x', 0, 0).
204
205
  def set_distance_callback_threshold(option, min, max)
205
- send_request(FUNCTION_SET_DISTANCE_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 0, '')
206
+ send_request(FUNCTION_SET_DISTANCE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, '')
206
207
  end
207
208
 
208
209
  # Returns the threshold as set by BrickletDistanceIR#set_distance_callback_threshold.
209
210
  def get_distance_callback_threshold
210
- send_request(FUNCTION_GET_DISTANCE_CALLBACK_THRESHOLD, [], '', 5, 'k s s')
211
+ send_request(FUNCTION_GET_DISTANCE_CALLBACK_THRESHOLD, [], '', 5, 'k S S')
211
212
  end
212
213
 
213
214
  # Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
@@ -1,18 +1,19 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2014-12-10. #
3
+ # This file was automatically generated on 2015-11-17. #
4
4
  # #
5
- # Bindings Version 2.1.4 #
5
+ # Bindings Version 2.1.6 #
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
- # to the generator git on tinkerforge.com #
9
+ # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
12
  module Tinkerforge
13
- # Device for sensing distance via ultrasound
13
+ # Measures distance between 2cm and 400cm with ultrasound
14
14
  class BrickletDistanceUS < Device
15
15
  DEVICE_IDENTIFIER = 229 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Distance US Bricklet' # :nodoc:
16
17
 
17
18
  # This callback is triggered periodically with the period that is set by
18
19
  # BrickletDistanceUS#set_distance_callback_period. The parameter is the distance value
@@ -52,7 +53,7 @@ module Tinkerforge
52
53
  def initialize(uid, ipcon)
53
54
  super uid, ipcon
54
55
 
55
- @api_version = [2, 0, 0]
56
+ @api_version = [2, 0, 1]
56
57
 
57
58
  @response_expected[FUNCTION_GET_DISTANCE_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
58
59
  @response_expected[FUNCTION_SET_DISTANCE_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
@@ -115,12 +116,12 @@ module Tinkerforge
115
116
  #
116
117
  # The default value is ('x', 0, 0).
117
118
  def set_distance_callback_threshold(option, min, max)
118
- send_request(FUNCTION_SET_DISTANCE_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 0, '')
119
+ send_request(FUNCTION_SET_DISTANCE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, '')
119
120
  end
120
121
 
121
122
  # Returns the threshold as set by BrickletDistanceUS#set_distance_callback_threshold.
122
123
  def get_distance_callback_threshold
123
- send_request(FUNCTION_GET_DISTANCE_CALLBACK_THRESHOLD, [], '', 5, 'k s s')
124
+ send_request(FUNCTION_GET_DISTANCE_CALLBACK_THRESHOLD, [], '', 5, 'k S S')
124
125
  end
125
126
 
126
127
  # Sets the period in ms with which the threshold callbacks
@@ -143,7 +144,7 @@ module Tinkerforge
143
144
  send_request(FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L')
144
145
  end
145
146
 
146
- # Sets the length of a `moving averaging <http://en.wikipedia.org/wiki/Moving_average>`__
147
+ # Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
147
148
  # for the distance value.
148
149
  #
149
150
  # Setting the length to 0 will turn the averaging completely off. With less
@@ -1,18 +1,19 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2014-12-10. #
3
+ # This file was automatically generated on 2015-11-17. #
4
4
  # #
5
- # Bindings Version 2.1.4 #
5
+ # Bindings Version 2.1.6 #
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
- # to the generator git on tinkerforge.com #
9
+ # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
12
  module Tinkerforge
13
- # Device with two buttons and two LEDs
13
+ # Two tactile buttons with built-in blue LEDs
14
14
  class BrickletDualButton < Device
15
15
  DEVICE_IDENTIFIER = 230 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Dual Button Bricklet' # :nodoc:
16
17
 
17
18
  # This callback is called whenever a button is pressed.
18
19
  #
@@ -1,18 +1,19 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2014-12-10. #
3
+ # This file was automatically generated on 2015-11-17. #
4
4
  # #
5
- # Bindings Version 2.1.4 #
5
+ # Bindings Version 2.1.6 #
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
- # to the generator git on tinkerforge.com #
9
+ # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
12
  module Tinkerforge
13
- # Device for controlling two relays
13
+ # Two relays to switch AC/DC devices
14
14
  class BrickletDualRelay < Device
15
15
  DEVICE_IDENTIFIER = 26 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Dual Relay Bricklet' # :nodoc:
16
17
 
17
18
  # This callback is triggered whenever a monoflop timer reaches 0. The
18
19
  # parameter contain the relay (1 or 2) and the current state of the relay
@@ -0,0 +1,178 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2015-11-17. #
4
+ # #
5
+ # Bindings Version 2.1.6 #
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 dust density
14
+ class BrickletDustDetector < Device
15
+ DEVICE_IDENTIFIER = 260 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Dust Detector Bricklet' # :nodoc:
17
+
18
+ # This callback is triggered periodically with the period that is set by
19
+ # BrickletDustDetector#set_dust_density_callback_period. The parameter is the
20
+ # dust density of the sensor.
21
+ #
22
+ # CALLBACK_DUST_DENSITY is only triggered if the dust density value has changed since the
23
+ # last triggering.
24
+ CALLBACK_DUST_DENSITY = 8
25
+
26
+ # This callback is triggered when the threshold as set by
27
+ # BrickletDustDetector#set_dust_density_callback_threshold is reached.
28
+ # The parameter is the dust density of the sensor.
29
+ #
30
+ # If the threshold keeps being reached, the callback is triggered periodically
31
+ # with the period as set by BrickletDustDetector#set_debounce_period.
32
+ CALLBACK_DUST_DENSITY_REACHED = 9
33
+
34
+ FUNCTION_GET_DUST_DENSITY = 1 # :nodoc:
35
+ FUNCTION_SET_DUST_DENSITY_CALLBACK_PERIOD = 2 # :nodoc:
36
+ FUNCTION_GET_DUST_DENSITY_CALLBACK_PERIOD = 3 # :nodoc:
37
+ FUNCTION_SET_DUST_DENSITY_CALLBACK_THRESHOLD = 4 # :nodoc:
38
+ FUNCTION_GET_DUST_DENSITY_CALLBACK_THRESHOLD = 5 # :nodoc:
39
+ FUNCTION_SET_DEBOUNCE_PERIOD = 6 # :nodoc:
40
+ FUNCTION_GET_DEBOUNCE_PERIOD = 7 # :nodoc:
41
+ FUNCTION_SET_MOVING_AVERAGE = 10 # :nodoc:
42
+ FUNCTION_GET_MOVING_AVERAGE = 11 # :nodoc:
43
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
44
+
45
+ THRESHOLD_OPTION_OFF = 'x' # :nodoc:
46
+ THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
47
+ THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
48
+ THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
49
+ THRESHOLD_OPTION_GREATER = '>' # :nodoc:
50
+
51
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
52
+ # the IP Connection <tt>ipcon</tt>.
53
+ def initialize(uid, ipcon)
54
+ super uid, ipcon
55
+
56
+ @api_version = [2, 0, 0]
57
+
58
+ @response_expected[FUNCTION_GET_DUST_DENSITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
59
+ @response_expected[FUNCTION_SET_DUST_DENSITY_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
60
+ @response_expected[FUNCTION_GET_DUST_DENSITY_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
61
+ @response_expected[FUNCTION_SET_DUST_DENSITY_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_TRUE
62
+ @response_expected[FUNCTION_GET_DUST_DENSITY_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
63
+ @response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
64
+ @response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
65
+ @response_expected[CALLBACK_DUST_DENSITY] = RESPONSE_EXPECTED_ALWAYS_FALSE
66
+ @response_expected[CALLBACK_DUST_DENSITY_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
67
+ @response_expected[FUNCTION_SET_MOVING_AVERAGE] = RESPONSE_EXPECTED_FALSE
68
+ @response_expected[FUNCTION_GET_MOVING_AVERAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
69
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
70
+
71
+ @callback_formats[CALLBACK_DUST_DENSITY] = 'S'
72
+ @callback_formats[CALLBACK_DUST_DENSITY_REACHED] = 'S'
73
+ end
74
+
75
+ # Returns the dust density in µg/m³.
76
+ #
77
+ # If you want to get the dust density periodically, it is recommended
78
+ # to use the callback CALLBACK_DUST_DENSITY and set the period with
79
+ # BrickletDustDetector#set_dust_density_callback_period.
80
+ def get_dust_density
81
+ send_request(FUNCTION_GET_DUST_DENSITY, [], '', 2, 'S')
82
+ end
83
+
84
+ # Sets the period in ms with which the CALLBACK_DUST_DENSITY callback is triggered
85
+ # periodically. A value of 0 turns the callback off.
86
+ #
87
+ # CALLBACK_DUST_DENSITY is only triggered if the dust density has changed since the
88
+ # last triggering.
89
+ #
90
+ # The default value is 0.
91
+ def set_dust_density_callback_period(period)
92
+ send_request(FUNCTION_SET_DUST_DENSITY_CALLBACK_PERIOD, [period], 'L', 0, '')
93
+ end
94
+
95
+ # Returns the period as set by BrickletDustDetector#set_dust_density_callback_period.
96
+ def get_dust_density_callback_period
97
+ send_request(FUNCTION_GET_DUST_DENSITY_CALLBACK_PERIOD, [], '', 4, 'L')
98
+ end
99
+
100
+ # Sets the thresholds for the CALLBACK_DUST_DENSITY_REACHED callback.
101
+ #
102
+ # The following options are possible:
103
+ #
104
+ # "Option", "Description"
105
+ #
106
+ # "'x'", "Callback is turned off"
107
+ # "'o'", "Callback is triggered when the dust density value is *outside* the min and max values"
108
+ # "'i'", "Callback is triggered when the dust density value is *inside* the min and max values"
109
+ # "'<'", "Callback is triggered when the dust density value is smaller than the min value (max is ignored)"
110
+ # "'>'", "Callback is triggered when the dust density value is greater than the min value (max is ignored)"
111
+ #
112
+ # The default value is ('x', 0, 0).
113
+ def set_dust_density_callback_threshold(option, min, max)
114
+ send_request(FUNCTION_SET_DUST_DENSITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, '')
115
+ end
116
+
117
+ # Returns the threshold as set by BrickletDustDetector#set_dust_density_callback_threshold.
118
+ def get_dust_density_callback_threshold
119
+ send_request(FUNCTION_GET_DUST_DENSITY_CALLBACK_THRESHOLD, [], '', 5, 'k S S')
120
+ end
121
+
122
+ # Sets the period in ms with which the threshold callback
123
+ #
124
+ # * CALLBACK_DUST_DENSITY_REACHED
125
+ #
126
+ # is triggered, if the threshold
127
+ #
128
+ # * BrickletDustDetector#set_dust_density_callback_threshold
129
+ #
130
+ # keeps being reached.
131
+ #
132
+ # The default value is 100.
133
+ def set_debounce_period(debounce)
134
+ send_request(FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, '')
135
+ end
136
+
137
+ # Returns the debounce period as set by BrickletDustDetector#set_debounce_period.
138
+ def get_debounce_period
139
+ send_request(FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L')
140
+ end
141
+
142
+ # Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
143
+ # for the dust_density.
144
+ #
145
+ # Setting the length to 0 will turn the averaging completely off. With less
146
+ # averaging, there is more noise on the data.
147
+ #
148
+ # The range for the averaging is 0-100.
149
+ #
150
+ # The default value is 100.
151
+ def set_moving_average(average)
152
+ send_request(FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 0, '')
153
+ end
154
+
155
+ # Returns the length moving average as set by BrickletDustDetector#set_moving_average.
156
+ def get_moving_average
157
+ send_request(FUNCTION_GET_MOVING_AVERAGE, [], '', 1, 'C')
158
+ end
159
+
160
+ # Returns the UID, the UID where the Bricklet is connected to,
161
+ # the position, the hardware and firmware version as well as the
162
+ # device identifier.
163
+ #
164
+ # The position can be 'a', 'b', 'c' or 'd'.
165
+ #
166
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
167
+ # |device_identifier_constant|
168
+ def get_identity
169
+ send_request(FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S')
170
+ end
171
+
172
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
173
+ def register_callback(id, &block)
174
+ callback = block
175
+ @registered_callbacks[id] = callback
176
+ end
177
+ end
178
+ end