tinkerforge 2.1.15 → 2.1.16

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 (89) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +2 -2
  3. data/lib/tinkerforge/brick_imu.rb +2 -2
  4. data/lib/tinkerforge/brick_imu_v2.rb +2 -2
  5. data/lib/tinkerforge/brick_master.rb +2 -2
  6. data/lib/tinkerforge/brick_red.rb +2 -2
  7. data/lib/tinkerforge/brick_servo.rb +2 -2
  8. data/lib/tinkerforge/brick_silent_stepper.rb +2 -2
  9. data/lib/tinkerforge/brick_stepper.rb +2 -2
  10. data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
  11. data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
  12. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +2 -2
  13. data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
  14. data/lib/tinkerforge/bricklet_analog_in_v2.rb +2 -2
  15. data/lib/tinkerforge/bricklet_analog_in_v3.rb +319 -0
  16. data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
  17. data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
  18. data/lib/tinkerforge/bricklet_barometer.rb +2 -2
  19. data/lib/tinkerforge/bricklet_can.rb +2 -2
  20. data/lib/tinkerforge/bricklet_co2.rb +2 -2
  21. data/lib/tinkerforge/bricklet_color.rb +2 -2
  22. data/lib/tinkerforge/bricklet_current12.rb +2 -2
  23. data/lib/tinkerforge/bricklet_current25.rb +2 -2
  24. data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
  25. data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
  26. data/lib/tinkerforge/bricklet_dmx.rb +3 -3
  27. data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
  28. data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
  29. data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
  30. data/lib/tinkerforge/bricklet_gps.rb +2 -2
  31. data/lib/tinkerforge/bricklet_gps_v2.rb +2 -2
  32. data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
  33. data/lib/tinkerforge/bricklet_humidity.rb +2 -2
  34. data/lib/tinkerforge/bricklet_humidity_v2.rb +2 -2
  35. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
  36. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
  37. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
  38. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
  39. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
  40. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
  41. data/lib/tinkerforge/bricklet_io16.rb +2 -2
  42. data/lib/tinkerforge/bricklet_io4.rb +2 -2
  43. data/lib/tinkerforge/bricklet_joystick.rb +2 -2
  44. data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
  45. data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
  46. data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
  47. data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
  48. data/lib/tinkerforge/bricklet_line.rb +2 -2
  49. data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
  50. data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
  51. data/lib/tinkerforge/bricklet_moisture.rb +2 -2
  52. data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
  53. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +261 -0
  54. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +2 -2
  55. data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
  56. data/lib/tinkerforge/bricklet_nfc.rb +998 -0
  57. data/lib/tinkerforge/bricklet_nfc_rfid.rb +5 -5
  58. data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
  59. data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
  60. data/lib/tinkerforge/bricklet_outdoor_weather.rb +390 -0
  61. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
  62. data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
  63. data/lib/tinkerforge/bricklet_ptc.rb +2 -2
  64. data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
  65. data/lib/tinkerforge/bricklet_remote_switch.rb +3 -3
  66. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +403 -0
  67. data/lib/tinkerforge/bricklet_rgb_led.rb +2 -2
  68. data/lib/tinkerforge/bricklet_rgb_led_button.rb +3 -3
  69. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +2 -2
  70. data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
  71. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +284 -0
  72. data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
  73. data/lib/tinkerforge/bricklet_rs232.rb +2 -2
  74. data/lib/tinkerforge/bricklet_rs485.rb +2 -2
  75. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
  76. data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
  77. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +247 -0
  78. data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
  79. data/lib/tinkerforge/bricklet_temperature.rb +2 -2
  80. data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
  81. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +369 -0
  82. data/lib/tinkerforge/bricklet_thermal_imaging.rb +5 -2
  83. data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
  84. data/lib/tinkerforge/bricklet_tilt.rb +2 -2
  85. data/lib/tinkerforge/bricklet_uv_light.rb +2 -2
  86. data/lib/tinkerforge/bricklet_voltage.rb +2 -2
  87. data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
  88. data/lib/tinkerforge/version.rb +1 -1
  89. metadata +11 -3
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2017-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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 2017-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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 #
@@ -10,7 +10,7 @@
10
10
  #############################################################
11
11
 
12
12
  module Tinkerforge
13
- # RGB LED Button
13
+ # Push button with built-in RGB LED
14
14
  class BrickletRGBLEDButton < Device
15
15
  DEVICE_IDENTIFIER = 282 # :nodoc:
16
16
  DEVICE_DISPLAY_NAME = 'RGB LED Button Bricklet' # :nodoc:
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2017-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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 2017-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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 #
@@ -0,0 +1,284 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2018-02-28. #
4
+ # #
5
+ # Ruby Bindings Version 2.1.16 #
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
+ # 360° rotary encoder with push-button
14
+ class BrickletRotaryEncoderV2 < Device
15
+ DEVICE_IDENTIFIER = 294 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Rotary Encoder Bricklet 2.0' # :nodoc:
17
+
18
+ # This callback is triggered periodically according to the configuration set by
19
+ # BrickletRotaryEncoderV2#set_count_callback_configuration.
20
+ #
21
+ # The `parameter` is the same as BrickletRotaryEncoderV2#get_count.
22
+ CALLBACK_COUNT = 4
23
+
24
+ # This callback is triggered when the button is pressed.
25
+ CALLBACK_PRESSED = 6
26
+
27
+ # This callback is triggered when the button is released.
28
+ CALLBACK_RELEASED = 7
29
+
30
+ FUNCTION_GET_COUNT = 1 # :nodoc:
31
+ FUNCTION_SET_COUNT_CALLBACK_CONFIGURATION = 2 # :nodoc:
32
+ FUNCTION_GET_COUNT_CALLBACK_CONFIGURATION = 3 # :nodoc:
33
+ FUNCTION_IS_PRESSED = 5 # :nodoc:
34
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
35
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
36
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
37
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
38
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
39
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
40
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
41
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
42
+ FUNCTION_RESET = 243 # :nodoc:
43
+ FUNCTION_WRITE_UID = 248 # :nodoc:
44
+ FUNCTION_READ_UID = 249 # :nodoc:
45
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
46
+
47
+ THRESHOLD_OPTION_OFF = 'x' # :nodoc:
48
+ THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
49
+ THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
50
+ THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
51
+ THRESHOLD_OPTION_GREATER = '>' # :nodoc:
52
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
53
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
54
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
55
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
56
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
57
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
58
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
59
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
60
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
61
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
62
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
63
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
64
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
65
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
66
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
67
+
68
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
69
+ # the IP Connection <tt>ipcon</tt>.
70
+ def initialize(uid, ipcon)
71
+ super uid, ipcon
72
+
73
+ @api_version = [2, 0, 0]
74
+
75
+ @response_expected[FUNCTION_GET_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
76
+ @response_expected[FUNCTION_SET_COUNT_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
77
+ @response_expected[FUNCTION_GET_COUNT_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
78
+ @response_expected[FUNCTION_IS_PRESSED] = RESPONSE_EXPECTED_ALWAYS_TRUE
79
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
80
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
81
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
82
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
83
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
84
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
85
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
86
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
87
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
88
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
89
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
90
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
91
+
92
+ @callback_formats[CALLBACK_COUNT] = 'l'
93
+ @callback_formats[CALLBACK_PRESSED] = ''
94
+ @callback_formats[CALLBACK_RELEASED] = ''
95
+
96
+ end
97
+
98
+ # Returns the current count of the encoder. If you set reset
99
+ # to true, the count is set back to 0 directly after the
100
+ # current count is read.
101
+ #
102
+ # The encoder has 24 steps per rotation.
103
+ #
104
+ # Turning the encoder to the left decrements the counter,
105
+ # so a negative count is possible.
106
+ #
107
+ #
108
+ # If you want to get the value periodically, it is recommended to use the
109
+ # CALLBACK_COUNT callback. You can set the callback configuration
110
+ # with BrickletRotaryEncoderV2#set_count_callback_configuration.
111
+ def get_count(reset)
112
+ send_request FUNCTION_GET_COUNT, [reset], '?', 4, 'l'
113
+ end
114
+
115
+ # The period in ms is the period with which the CALLBACK_COUNT callback is triggered
116
+ # periodically. A value of 0 turns the callback off.
117
+ #
118
+ # If the `value has to change`-parameter is set to true, the callback is only
119
+ # triggered after the value has changed. If the value didn't change
120
+ # within the period, the callback is triggered immediately on change.
121
+ #
122
+ # If it is set to false, the callback is continuously triggered with the period,
123
+ # independent of the value.
124
+ #
125
+ # It is furthermore possible to constrain the callback with thresholds.
126
+ #
127
+ # The `option`-parameter together with min/max sets a threshold for the CALLBACK_COUNT callback.
128
+ #
129
+ # The following options are possible:
130
+ #
131
+ # "Option", "Description"
132
+ #
133
+ # "'x'", "Threshold is turned off"
134
+ # "'o'", "Threshold is triggered when the value is *outside* the min and max values"
135
+ # "'i'", "Threshold is triggered when the value is *inside* the min and max values"
136
+ # "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
137
+ # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
138
+ #
139
+ #
140
+ # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
141
+ #
142
+ # The default value is (0, false, 'x', 0, 0).
143
+ def set_count_callback_configuration(period, value_has_to_change, option, min, max)
144
+ send_request FUNCTION_SET_COUNT_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
145
+ end
146
+
147
+ # Returns the callback configuration as set by BrickletRotaryEncoderV2#set_count_callback_configuration.
148
+ def get_count_callback_configuration
149
+ send_request FUNCTION_GET_COUNT_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
150
+ end
151
+
152
+ # Returns *true* if the button is pressed and *false* otherwise.
153
+ #
154
+ # It is recommended to use the CALLBACK_PRESSED and CALLBACK_RELEASED callbacks
155
+ # to handle the button.
156
+ def is_pressed
157
+ send_request FUNCTION_IS_PRESSED, [], '', 1, '?'
158
+ end
159
+
160
+ # Returns the error count for the communication between Brick and Bricklet.
161
+ #
162
+ # The errors are divided into
163
+ #
164
+ # * ack checksum errors,
165
+ # * message checksum errors,
166
+ # * frameing errors and
167
+ # * overflow errors.
168
+ #
169
+ # The errors counts are for errors that occur on the Bricklet side. All
170
+ # Bricks have a similar function that returns the errors on the Brick side.
171
+ def get_spitfp_error_count
172
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
173
+ end
174
+
175
+ # Sets the bootloader mode and returns the status after the requested
176
+ # mode change was instigated.
177
+ #
178
+ # You can change from bootloader mode to firmware mode and vice versa. A change
179
+ # from bootloader mode to firmware mode will only take place if the entry function,
180
+ # device identifier und crc are present and correct.
181
+ #
182
+ # This function is used by Brick Viewer during flashing. It should not be
183
+ # necessary to call it in a normal user program.
184
+ def set_bootloader_mode(mode)
185
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
186
+ end
187
+
188
+ # Returns the current bootloader mode, see BrickletRotaryEncoderV2#set_bootloader_mode.
189
+ def get_bootloader_mode
190
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
191
+ end
192
+
193
+ # Sets the firmware pointer for BrickletRotaryEncoderV2#write_firmware. The pointer has
194
+ # to be increased by chunks of size 64. The data is written to flash
195
+ # every 4 chunks (which equals to one page of size 256).
196
+ #
197
+ # This function is used by Brick Viewer during flashing. It should not be
198
+ # necessary to call it in a normal user program.
199
+ def set_write_firmware_pointer(pointer)
200
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
201
+ end
202
+
203
+ # Writes 64 Bytes of firmware at the position as written by
204
+ # BrickletRotaryEncoderV2#set_write_firmware_pointer before. The firmware is written
205
+ # to flash every 4 chunks.
206
+ #
207
+ # You can only write firmware in bootloader mode.
208
+ #
209
+ # This function is used by Brick Viewer during flashing. It should not be
210
+ # necessary to call it in a normal user program.
211
+ def write_firmware(data)
212
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
213
+ end
214
+
215
+ # Sets the status LED configuration. By default the LED shows
216
+ # communication traffic between Brick and Bricklet, it flickers once
217
+ # for every 10 received data packets.
218
+ #
219
+ # You can also turn the LED permanently on/off or show a heartbeat.
220
+ #
221
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
222
+ def set_status_led_config(config)
223
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
224
+ end
225
+
226
+ # Returns the configuration as set by BrickletRotaryEncoderV2#set_status_led_config
227
+ def get_status_led_config
228
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
229
+ end
230
+
231
+ # Returns the temperature in °C as measured inside the microcontroller. The
232
+ # value returned is not the ambient temperature!
233
+ #
234
+ # The temperature is only proportional to the real temperature and it has bad
235
+ # accuracy. Practically it is only useful as an indicator for
236
+ # temperature changes.
237
+ def get_chip_temperature
238
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
239
+ end
240
+
241
+ # Calling this function will reset the Bricklet. All configurations
242
+ # will be lost.
243
+ #
244
+ # After a reset you have to create new device objects,
245
+ # calling functions on the existing ones will result in
246
+ # undefined behavior!
247
+ def reset
248
+ send_request FUNCTION_RESET, [], '', 0, ''
249
+ end
250
+
251
+ # Writes a new UID into flash. If you want to set a new UID
252
+ # you have to decode the Base58 encoded UID string into an
253
+ # integer first.
254
+ #
255
+ # We recommend that you use Brick Viewer to change the UID.
256
+ def write_uid(uid)
257
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
258
+ end
259
+
260
+ # Returns the current UID as an integer. Encode as
261
+ # Base58 to get the usual string version.
262
+ def read_uid
263
+ send_request FUNCTION_READ_UID, [], '', 4, 'L'
264
+ end
265
+
266
+ # Returns the UID, the UID where the Bricklet is connected to,
267
+ # the position, the hardware and firmware version as well as the
268
+ # device identifier.
269
+ #
270
+ # The position can be 'a', 'b', 'c' or 'd'.
271
+ #
272
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
273
+ # |device_identifier_constant|
274
+ def get_identity
275
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
276
+ end
277
+
278
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
279
+ def register_callback(id, &block)
280
+ callback = block
281
+ @registered_callbacks[id] = callback
282
+ end
283
+ end
284
+ end
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2017-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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 2017-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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 2017-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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 2017-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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 2017-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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 #
@@ -0,0 +1,247 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2018-02-28. #
4
+ # #
5
+ # Ruby Bindings Version 2.1.16 #
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
+ #
14
+ class BrickletSolidStateRelayV2 < Device
15
+ DEVICE_IDENTIFIER = 296 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Solid State Relay Bricklet 2.0' # :nodoc:
17
+
18
+ # This callback is triggered whenever the monoflop timer reaches 0.
19
+ # The parameter is the current state of the relay
20
+ # (the state after the monoflop).
21
+ CALLBACK_MONOFLOP_DONE = 5
22
+
23
+ FUNCTION_SET_STATE = 1 # :nodoc:
24
+ FUNCTION_GET_STATE = 2 # :nodoc:
25
+ FUNCTION_SET_MONOFLOP = 3 # :nodoc:
26
+ FUNCTION_GET_MONOFLOP = 4 # :nodoc:
27
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
28
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
29
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
30
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
31
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
32
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
33
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
34
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
35
+ FUNCTION_RESET = 243 # :nodoc:
36
+ FUNCTION_WRITE_UID = 248 # :nodoc:
37
+ FUNCTION_READ_UID = 249 # :nodoc:
38
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
39
+
40
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
41
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
42
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
43
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
44
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
45
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
46
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
47
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
48
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
49
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
50
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
51
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
52
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
53
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
54
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
55
+
56
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
57
+ # the IP Connection <tt>ipcon</tt>.
58
+ def initialize(uid, ipcon)
59
+ super uid, ipcon
60
+
61
+ @api_version = [2, 0, 0]
62
+
63
+ @response_expected[FUNCTION_SET_STATE] = RESPONSE_EXPECTED_FALSE
64
+ @response_expected[FUNCTION_GET_STATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
65
+ @response_expected[FUNCTION_SET_MONOFLOP] = RESPONSE_EXPECTED_FALSE
66
+ @response_expected[FUNCTION_GET_MONOFLOP] = RESPONSE_EXPECTED_ALWAYS_TRUE
67
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
68
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
69
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
70
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
71
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
72
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
73
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
74
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
75
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
76
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
77
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
78
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
79
+
80
+ @callback_formats[CALLBACK_MONOFLOP_DONE] = '?'
81
+
82
+ end
83
+
84
+ # Sets the state of the relays *true* means on and *false* means off.
85
+ #
86
+ # Running monoflop timers will be overwritten if this function is called.
87
+ #
88
+ # The default value is *false*.
89
+ def set_state(state)
90
+ send_request FUNCTION_SET_STATE, [state], '?', 0, ''
91
+ end
92
+
93
+ # Returns the state of the relay, *true* means on and *false* means off.
94
+ def get_state
95
+ send_request FUNCTION_GET_STATE, [], '', 1, '?'
96
+ end
97
+
98
+ # The first parameter is the desired state of the relay (*true* means on
99
+ # and *false* means off). The second parameter indicates the time (in ms) that
100
+ # the relay should hold the state.
101
+ #
102
+ # If this function is called with the parameters (true, 1500):
103
+ # The relay will turn on and in 1.5s it will turn off again.
104
+ #
105
+ # A monoflop can be used as a failsafe mechanism. For example: Lets assume you
106
+ # have a RS485 bus and a Solid State Relay Bricklet connected to one of the slave
107
+ # stacks. You can now call this function every second, with a time parameter
108
+ # of two seconds. The relay will be on all the time. If now the RS485
109
+ # connection is lost, the relay will turn off in at most two seconds.
110
+ def set_monoflop(state, time)
111
+ send_request FUNCTION_SET_MONOFLOP, [state, time], '? L', 0, ''
112
+ end
113
+
114
+ # Returns the current state and the time as set by
115
+ # BrickletSolidStateRelayV2#set_monoflop as well as the remaining time until the state flips.
116
+ #
117
+ # If the timer is not running currently, the remaining time will be returned
118
+ # as 0.
119
+ def get_monoflop
120
+ send_request FUNCTION_GET_MONOFLOP, [], '', 9, '? L L'
121
+ end
122
+
123
+ # Returns the error count for the communication between Brick and Bricklet.
124
+ #
125
+ # The errors are divided into
126
+ #
127
+ # * ack checksum errors,
128
+ # * message checksum errors,
129
+ # * frameing errors and
130
+ # * overflow errors.
131
+ #
132
+ # The errors counts are for errors that occur on the Bricklet side. All
133
+ # Bricks have a similar function that returns the errors on the Brick side.
134
+ def get_spitfp_error_count
135
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
136
+ end
137
+
138
+ # Sets the bootloader mode and returns the status after the requested
139
+ # mode change was instigated.
140
+ #
141
+ # You can change from bootloader mode to firmware mode and vice versa. A change
142
+ # from bootloader mode to firmware mode will only take place if the entry function,
143
+ # device identifier und crc are present and correct.
144
+ #
145
+ # This function is used by Brick Viewer during flashing. It should not be
146
+ # necessary to call it in a normal user program.
147
+ def set_bootloader_mode(mode)
148
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
149
+ end
150
+
151
+ # Returns the current bootloader mode, see BrickletSolidStateRelayV2#set_bootloader_mode.
152
+ def get_bootloader_mode
153
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
154
+ end
155
+
156
+ # Sets the firmware pointer for BrickletSolidStateRelayV2#write_firmware. The pointer has
157
+ # to be increased by chunks of size 64. The data is written to flash
158
+ # every 4 chunks (which equals to one page of size 256).
159
+ #
160
+ # This function is used by Brick Viewer during flashing. It should not be
161
+ # necessary to call it in a normal user program.
162
+ def set_write_firmware_pointer(pointer)
163
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
164
+ end
165
+
166
+ # Writes 64 Bytes of firmware at the position as written by
167
+ # BrickletSolidStateRelayV2#set_write_firmware_pointer before. The firmware is written
168
+ # to flash every 4 chunks.
169
+ #
170
+ # You can only write firmware in bootloader mode.
171
+ #
172
+ # This function is used by Brick Viewer during flashing. It should not be
173
+ # necessary to call it in a normal user program.
174
+ def write_firmware(data)
175
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
176
+ end
177
+
178
+ # Sets the status LED configuration. By default the LED shows
179
+ # communication traffic between Brick and Bricklet, it flickers once
180
+ # for every 10 received data packets.
181
+ #
182
+ # You can also turn the LED permanently on/off or show a heartbeat.
183
+ #
184
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
185
+ def set_status_led_config(config)
186
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
187
+ end
188
+
189
+ # Returns the configuration as set by BrickletSolidStateRelayV2#set_status_led_config
190
+ def get_status_led_config
191
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
192
+ end
193
+
194
+ # Returns the temperature in °C as measured inside the microcontroller. The
195
+ # value returned is not the ambient temperature!
196
+ #
197
+ # The temperature is only proportional to the real temperature and it has bad
198
+ # accuracy. Practically it is only useful as an indicator for
199
+ # temperature changes.
200
+ def get_chip_temperature
201
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
202
+ end
203
+
204
+ # Calling this function will reset the Bricklet. All configurations
205
+ # will be lost.
206
+ #
207
+ # After a reset you have to create new device objects,
208
+ # calling functions on the existing ones will result in
209
+ # undefined behavior!
210
+ def reset
211
+ send_request FUNCTION_RESET, [], '', 0, ''
212
+ end
213
+
214
+ # Writes a new UID into flash. If you want to set a new UID
215
+ # you have to decode the Base58 encoded UID string into an
216
+ # integer first.
217
+ #
218
+ # We recommend that you use Brick Viewer to change the UID.
219
+ def write_uid(uid)
220
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
221
+ end
222
+
223
+ # Returns the current UID as an integer. Encode as
224
+ # Base58 to get the usual string version.
225
+ def read_uid
226
+ send_request FUNCTION_READ_UID, [], '', 4, 'L'
227
+ end
228
+
229
+ # Returns the UID, the UID where the Bricklet is connected to,
230
+ # the position, the hardware and firmware version as well as the
231
+ # device identifier.
232
+ #
233
+ # The position can be 'a', 'b', 'c' or 'd'.
234
+ #
235
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
236
+ # |device_identifier_constant|
237
+ def get_identity
238
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
239
+ end
240
+
241
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
242
+ def register_callback(id, &block)
243
+ callback = block
244
+ @registered_callbacks[id] = callback
245
+ end
246
+ end
247
+ end