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 #
@@ -74,7 +74,7 @@ module Tinkerforge
74
74
  # It is no problem if you don't know the tag type. You can cycle through
75
75
  # the available tag types until the tag gives an answer to the request.
76
76
  #
77
- # Current the following tag types are supported:
77
+ # Currently the following tag types are supported:
78
78
  #
79
79
  # * Mifare Classic
80
80
  # * NFC Forum Type 1
@@ -138,7 +138,7 @@ module Tinkerforge
138
138
  # a Mifare Classic page you have to authenticate it beforehand.
139
139
  # Each page can be authenticated with two keys: A (``key_number`` = 0) and B
140
140
  # (``key_number`` = 1). A new Mifare Classic
141
- # tag that has not yet been written to can can be accessed with key A
141
+ # tag that has not yet been written to can be accessed with key A
142
142
  # and the default key ``[0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]``.
143
143
  #
144
144
  # The approach to read or write a Mifare Classic page is as follows:
@@ -147,7 +147,7 @@ module Tinkerforge
147
147
  # 2. Wait for state to change to *RequestTagIDReady* (see BrickletNFCRFID#get_state
148
148
  # or CALLBACK_STATE_CHANGED callback)
149
149
  # 3. If looking for a specific tag then call BrickletNFCRFID#get_tag_id and check if the
150
- # expected tag was found, if it was not found got back to step 1
150
+ # expected tag was found, if it was not found go back to step 1
151
151
  # 4. Call BrickletNFCRFID#authenticate_mifare_classic_page with page and key for the page
152
152
  # 5. Wait for state to change to *AuthenticatingMifareClassicPageReady* (see
153
153
  # BrickletNFCRFID#get_state or CALLBACK_STATE_CHANGED callback)
@@ -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,390 @@
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
+ # 433MHz receiver for outdoor weather station
14
+ class BrickletOutdoorWeather < Device
15
+ DEVICE_IDENTIFIER = 288 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Outdoor Weather Bricklet' # :nodoc:
17
+
18
+ # Reports the station data every time a new data packet is received.
19
+ # See BrickletOutdoorWeather#get_station_data for information about the data.
20
+ #
21
+ # For each station the callback will be triggered about every 45 seconds.
22
+ #
23
+ # Turn the callback on/off with BrickletOutdoorWeather#set_station_callback_configuration
24
+ # (by default it is turned off).
25
+ CALLBACK_STATION_DATA = 9
26
+
27
+ # Reports the sensor data every time a new data packet is received.
28
+ # See BrickletOutdoorWeather#get_sensor_data for information about the data.
29
+ #
30
+ # For each station the callback will be called about every 45 seconds.
31
+ #
32
+ # Turn the callback on/off with BrickletOutdoorWeather#set_sensor_callback_configuration
33
+ # (by default it is turned off).
34
+ CALLBACK_SENSOR_DATA = 10
35
+
36
+ FUNCTION_GET_STATION_IDENTIFIERS_LOW_LEVEL = 1 # :nodoc:
37
+ FUNCTION_GET_SENSOR_IDENTIFIERS_LOW_LEVEL = 2 # :nodoc:
38
+ FUNCTION_GET_STATION_DATA = 3 # :nodoc:
39
+ FUNCTION_GET_SENSOR_DATA = 4 # :nodoc:
40
+ FUNCTION_SET_STATION_CALLBACK_CONFIGURATION = 5 # :nodoc:
41
+ FUNCTION_GET_STATION_CALLBACK_CONFIGURATION = 6 # :nodoc:
42
+ FUNCTION_SET_SENSOR_CALLBACK_CONFIGURATION = 7 # :nodoc:
43
+ FUNCTION_GET_SENSOR_CALLBACK_CONFIGURATION = 8 # :nodoc:
44
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
45
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
46
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
47
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
48
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
49
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
50
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
51
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
52
+ FUNCTION_RESET = 243 # :nodoc:
53
+ FUNCTION_WRITE_UID = 248 # :nodoc:
54
+ FUNCTION_READ_UID = 249 # :nodoc:
55
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
56
+
57
+ WIND_DIRECTION_N = 0 # :nodoc:
58
+ WIND_DIRECTION_NNE = 1 # :nodoc:
59
+ WIND_DIRECTION_NE = 2 # :nodoc:
60
+ WIND_DIRECTION_ENE = 3 # :nodoc:
61
+ WIND_DIRECTION_E = 4 # :nodoc:
62
+ WIND_DIRECTION_ESE = 5 # :nodoc:
63
+ WIND_DIRECTION_SE = 6 # :nodoc:
64
+ WIND_DIRECTION_SSE = 7 # :nodoc:
65
+ WIND_DIRECTION_S = 8 # :nodoc:
66
+ WIND_DIRECTION_SSW = 9 # :nodoc:
67
+ WIND_DIRECTION_SW = 10 # :nodoc:
68
+ WIND_DIRECTION_WSW = 11 # :nodoc:
69
+ WIND_DIRECTION_W = 12 # :nodoc:
70
+ WIND_DIRECTION_WNW = 13 # :nodoc:
71
+ WIND_DIRECTION_NW = 14 # :nodoc:
72
+ WIND_DIRECTION_NNW = 15 # :nodoc:
73
+ WIND_DIRECTION_ERROR = 255 # :nodoc:
74
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
75
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
76
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
77
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
78
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
79
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
80
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
81
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
82
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
83
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
84
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
85
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
86
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
87
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
88
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
89
+
90
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
91
+ # the IP Connection <tt>ipcon</tt>.
92
+ def initialize(uid, ipcon)
93
+ super uid, ipcon
94
+
95
+ @api_version = [2, 0, 0]
96
+
97
+ @response_expected[FUNCTION_GET_STATION_IDENTIFIERS_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
98
+ @response_expected[FUNCTION_GET_SENSOR_IDENTIFIERS_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
99
+ @response_expected[FUNCTION_GET_STATION_DATA] = RESPONSE_EXPECTED_ALWAYS_TRUE
100
+ @response_expected[FUNCTION_GET_SENSOR_DATA] = RESPONSE_EXPECTED_ALWAYS_TRUE
101
+ @response_expected[FUNCTION_SET_STATION_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
102
+ @response_expected[FUNCTION_GET_STATION_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
103
+ @response_expected[FUNCTION_SET_SENSOR_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
104
+ @response_expected[FUNCTION_GET_SENSOR_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
105
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
106
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
107
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
108
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
109
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
110
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
111
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
112
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
113
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
114
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
115
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
116
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
117
+
118
+ @callback_formats[CALLBACK_STATION_DATA] = 'C s C L L L C ?'
119
+ @callback_formats[CALLBACK_SENSOR_DATA] = 'C s C'
120
+
121
+ end
122
+
123
+ # Returns the identifiers (number between 0 and 255) of all `stations
124
+ # <https://www.tinkerforge.com/en/shop/accessories/sensors/outdoor-weather-station-ws-6147.html>`__
125
+ # that have been seen since the startup of the Bricklet.
126
+ #
127
+ # Each station gives itself a random identifier on first startup.
128
+ def get_station_identifiers_low_level
129
+ send_request FUNCTION_GET_STATION_IDENTIFIERS_LOW_LEVEL, [], '', 64, 'S S C60'
130
+ end
131
+
132
+ # Returns the identifiers (number between 0 and 255) of all `sensors
133
+ # <https://www.tinkerforge.com/en/shop/accessories/sensors/temperature-humidity-sensor-th-6148.html>`__
134
+ # that have been seen since the startup of the Bricklet.
135
+ #
136
+ # Each sensor gives itself a random identifier on first startup.
137
+ def get_sensor_identifiers_low_level
138
+ send_request FUNCTION_GET_SENSOR_IDENTIFIERS_LOW_LEVEL, [], '', 64, 'S S C60'
139
+ end
140
+
141
+ # Returns the last received data for a station with the given identifier.
142
+ # Call BrickletOutdoorWeather#get_station_identifiers for a list of all available identifiers.
143
+ #
144
+ # The return values are:
145
+ #
146
+ # * Temperature in °C/10,
147
+ # * Humidity in %RH,
148
+ # * Wind Speed in m/10s,
149
+ # * Gust Speed in m/10s,
150
+ # * Rain Fall in mm/10,
151
+ # * Wind Direction (N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW),
152
+ # * Battery Low (true or false) and
153
+ # * Last Change (time in seconds since the reception of this data).
154
+ def get_station_data(identifier)
155
+ send_request FUNCTION_GET_STATION_DATA, [identifier], 'C', 19, 's C L L L C ? S'
156
+ end
157
+
158
+ # Returns the last measured data for a sensor with the given identifier.
159
+ # Call BrickletOutdoorWeather#get_sensor_identifiers for a list of all available identifiers.
160
+ #
161
+ # The return values are:
162
+ #
163
+ # * Temperature in °C/10,
164
+ # * Humidity in %RH and
165
+ # * Last Change (time in seconds since the last reception of data).
166
+ def get_sensor_data(identifier)
167
+ send_request FUNCTION_GET_SENSOR_DATA, [identifier], 'C', 5, 's C S'
168
+ end
169
+
170
+ # Turns callback for station data on or off. Default is off.
171
+ def set_station_callback_configuration(enable_callback)
172
+ send_request FUNCTION_SET_STATION_CALLBACK_CONFIGURATION, [enable_callback], '?', 0, ''
173
+ end
174
+
175
+ # Returns the configuration as set by BrickletOutdoorWeather#set_station_callback_configuration.
176
+ def get_station_callback_configuration
177
+ send_request FUNCTION_GET_STATION_CALLBACK_CONFIGURATION, [], '', 1, '?'
178
+ end
179
+
180
+ # Turns callback for sensor data on or off. Default is off.
181
+ def set_sensor_callback_configuration(enable_callback)
182
+ send_request FUNCTION_SET_SENSOR_CALLBACK_CONFIGURATION, [enable_callback], '?', 0, ''
183
+ end
184
+
185
+ # Returns the configuration as set by BrickletOutdoorWeather#set_sensor_callback_configuration.
186
+ def get_sensor_callback_configuration
187
+ send_request FUNCTION_GET_SENSOR_CALLBACK_CONFIGURATION, [], '', 1, '?'
188
+ end
189
+
190
+ # Returns the error count for the communication between Brick and Bricklet.
191
+ #
192
+ # The errors are divided into
193
+ #
194
+ # * ack checksum errors,
195
+ # * message checksum errors,
196
+ # * frameing errors and
197
+ # * overflow errors.
198
+ #
199
+ # The errors counts are for errors that occur on the Bricklet side. All
200
+ # Bricks have a similar function that returns the errors on the Brick side.
201
+ def get_spitfp_error_count
202
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
203
+ end
204
+
205
+ # Sets the bootloader mode and returns the status after the requested
206
+ # mode change was instigated.
207
+ #
208
+ # You can change from bootloader mode to firmware mode and vice versa. A change
209
+ # from bootloader mode to firmware mode will only take place if the entry function,
210
+ # device identifier und crc are present and correct.
211
+ #
212
+ # This function is used by Brick Viewer during flashing. It should not be
213
+ # necessary to call it in a normal user program.
214
+ def set_bootloader_mode(mode)
215
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
216
+ end
217
+
218
+ # Returns the current bootloader mode, see BrickletOutdoorWeather#set_bootloader_mode.
219
+ def get_bootloader_mode
220
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
221
+ end
222
+
223
+ # Sets the firmware pointer for BrickletOutdoorWeather#write_firmware. The pointer has
224
+ # to be increased by chunks of size 64. The data is written to flash
225
+ # every 4 chunks (which equals to one page of size 256).
226
+ #
227
+ # This function is used by Brick Viewer during flashing. It should not be
228
+ # necessary to call it in a normal user program.
229
+ def set_write_firmware_pointer(pointer)
230
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
231
+ end
232
+
233
+ # Writes 64 Bytes of firmware at the position as written by
234
+ # BrickletOutdoorWeather#set_write_firmware_pointer before. The firmware is written
235
+ # to flash every 4 chunks.
236
+ #
237
+ # You can only write firmware in bootloader mode.
238
+ #
239
+ # This function is used by Brick Viewer during flashing. It should not be
240
+ # necessary to call it in a normal user program.
241
+ def write_firmware(data)
242
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
243
+ end
244
+
245
+ # Sets the status LED configuration. By default the LED shows
246
+ # communication traffic between Brick and Bricklet, it flickers once
247
+ # for every 10 received data packets.
248
+ #
249
+ # You can also turn the LED permanently on/off or show a heartbeat.
250
+ #
251
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
252
+ def set_status_led_config(config)
253
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
254
+ end
255
+
256
+ # Returns the configuration as set by BrickletOutdoorWeather#set_status_led_config
257
+ def get_status_led_config
258
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
259
+ end
260
+
261
+ # Returns the temperature in °C as measured inside the microcontroller. The
262
+ # value returned is not the ambient temperature!
263
+ #
264
+ # The temperature is only proportional to the real temperature and it has bad
265
+ # accuracy. Practically it is only useful as an indicator for
266
+ # temperature changes.
267
+ def get_chip_temperature
268
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
269
+ end
270
+
271
+ # Calling this function will reset the Bricklet. All configurations
272
+ # will be lost.
273
+ #
274
+ # After a reset you have to create new device objects,
275
+ # calling functions on the existing ones will result in
276
+ # undefined behavior!
277
+ def reset
278
+ send_request FUNCTION_RESET, [], '', 0, ''
279
+ end
280
+
281
+ # Writes a new UID into flash. If you want to set a new UID
282
+ # you have to decode the Base58 encoded UID string into an
283
+ # integer first.
284
+ #
285
+ # We recommend that you use Brick Viewer to change the UID.
286
+ def write_uid(uid)
287
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
288
+ end
289
+
290
+ # Returns the current UID as an integer. Encode as
291
+ # Base58 to get the usual string version.
292
+ def read_uid
293
+ send_request FUNCTION_READ_UID, [], '', 4, 'L'
294
+ end
295
+
296
+ # Returns the UID, the UID where the Bricklet is connected to,
297
+ # the position, the hardware and firmware version as well as the
298
+ # device identifier.
299
+ #
300
+ # The position can be 'a', 'b', 'c' or 'd'.
301
+ #
302
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
303
+ # |device_identifier_constant|
304
+ def get_identity
305
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
306
+ end
307
+
308
+ # Returns the identifiers (number between 0 and 255) of all `stations
309
+ # <https://www.tinkerforge.com/en/shop/accessories/sensors/outdoor-weather-station-ws-6147.html>`__
310
+ # that have been seen since the startup of the Bricklet.
311
+ #
312
+ # Each station gives itself a random identifier on first startup.
313
+ def get_station_identifiers
314
+ identifiers_length = nil # assigned in block
315
+ identifiers_data = nil # assigned in block
316
+
317
+ @stream_mutex.synchronize {
318
+ ret = get_station_identifiers_low_level
319
+ identifiers_length = ret[0]
320
+ identifiers_chunk_offset = ret[1]
321
+ identifiers_out_of_sync = identifiers_chunk_offset != 0
322
+ identifiers_data = ret[2]
323
+
324
+ while not identifiers_out_of_sync and identifiers_data.length < identifiers_length
325
+ ret = get_station_identifiers_low_level
326
+ identifiers_length = ret[0]
327
+ identifiers_chunk_offset = ret[1]
328
+ identifiers_out_of_sync = identifiers_chunk_offset != identifiers_data.length
329
+ identifiers_data += ret[2]
330
+ end
331
+
332
+ if identifiers_out_of_sync # discard remaining stream to bring it back in-sync
333
+ while identifiers_chunk_offset + 60 < identifiers_length
334
+ ret = get_station_identifiers_low_level
335
+ identifiers_length = ret[0]
336
+ identifiers_chunk_offset = ret[1]
337
+ end
338
+
339
+ raise StreamOutOfSyncException, 'Identifiers stream is out-of-sync'
340
+ end
341
+ }
342
+
343
+ identifiers_data[0, identifiers_length]
344
+ end
345
+
346
+ # Returns the identifiers (number between 0 and 255) of all `sensors
347
+ # <https://www.tinkerforge.com/en/shop/accessories/sensors/temperature-humidity-sensor-th-6148.html>`__
348
+ # that have been seen since the startup of the Bricklet.
349
+ #
350
+ # Each sensor gives itself a random identifier on first startup.
351
+ def get_sensor_identifiers
352
+ identifiers_length = nil # assigned in block
353
+ identifiers_data = nil # assigned in block
354
+
355
+ @stream_mutex.synchronize {
356
+ ret = get_sensor_identifiers_low_level
357
+ identifiers_length = ret[0]
358
+ identifiers_chunk_offset = ret[1]
359
+ identifiers_out_of_sync = identifiers_chunk_offset != 0
360
+ identifiers_data = ret[2]
361
+
362
+ while not identifiers_out_of_sync and identifiers_data.length < identifiers_length
363
+ ret = get_sensor_identifiers_low_level
364
+ identifiers_length = ret[0]
365
+ identifiers_chunk_offset = ret[1]
366
+ identifiers_out_of_sync = identifiers_chunk_offset != identifiers_data.length
367
+ identifiers_data += ret[2]
368
+ end
369
+
370
+ if identifiers_out_of_sync # discard remaining stream to bring it back in-sync
371
+ while identifiers_chunk_offset + 60 < identifiers_length
372
+ ret = get_sensor_identifiers_low_level
373
+ identifiers_length = ret[0]
374
+ identifiers_chunk_offset = ret[1]
375
+ end
376
+
377
+ raise StreamOutOfSyncException, 'Identifiers stream is out-of-sync'
378
+ end
379
+ }
380
+
381
+ identifiers_data[0, identifiers_length]
382
+ end
383
+
384
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
385
+ def register_callback(id, &block)
386
+ callback = block
387
+ @registered_callbacks[id] = callback
388
+ end
389
+ end
390
+ 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 #