tinkerforge 2.1.23 → 2.1.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +156 -75
  3. data/lib/tinkerforge/brick_hat.rb +109 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +191 -86
  6. data/lib/tinkerforge/brick_imu_v2.rb +219 -118
  7. data/lib/tinkerforge/brick_master.rb +495 -195
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +186 -102
  10. data/lib/tinkerforge/brick_silent_stepper.rb +248 -168
  11. data/lib/tinkerforge/brick_stepper.rb +212 -100
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +107 -63
  14. data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
  18. data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
  21. data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
  24. data/lib/tinkerforge/bricklet_barometer.rb +108 -58
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
  26. data/lib/tinkerforge/bricklet_can.rb +84 -24
  27. data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
  28. data/lib/tinkerforge/bricklet_co2.rb +36 -25
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
  30. data/lib/tinkerforge/bricklet_color.rb +75 -47
  31. data/lib/tinkerforge/bricklet_color_v2.rb +91 -47
  32. data/lib/tinkerforge/bricklet_compass.rb +81 -40
  33. data/lib/tinkerforge/bricklet_current12.rb +61 -40
  34. data/lib/tinkerforge/bricklet_current25.rb +61 -40
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
  37. data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +68 -33
  39. data/lib/tinkerforge/bricklet_dmx.rb +92 -48
  40. data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +81 -40
  46. data/lib/tinkerforge/bricklet_gps.rb +72 -48
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
  50. data/lib/tinkerforge/bricklet_humidity.rb +54 -38
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
  52. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  53. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
  54. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
  55. data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
  62. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  63. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
  65. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
  66. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
  67. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
  68. data/lib/tinkerforge/bricklet_io16.rb +57 -32
  69. data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
  70. data/lib/tinkerforge/bricklet_io4.rb +56 -31
  71. data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
  72. data/lib/tinkerforge/bricklet_isolator.rb +111 -35
  73. data/lib/tinkerforge/bricklet_joystick.rb +63 -42
  74. data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
  75. data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
  76. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +99 -51
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +219 -131
  78. data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
  79. data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
  80. data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
  81. data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
  82. data/lib/tinkerforge/bricklet_line.rb +35 -22
  83. data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
  84. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
  85. data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
  86. data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
  87. data/lib/tinkerforge/bricklet_moisture.rb +43 -30
  88. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  89. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
  90. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
  91. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
  92. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -39
  93. data/lib/tinkerforge/bricklet_nfc.rb +130 -80
  94. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  95. data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
  96. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +75 -40
  97. data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
  98. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  99. data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
  100. data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
  101. data/lib/tinkerforge/bricklet_performance_dc.rb +676 -0
  102. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
  103. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  104. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  105. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  106. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  107. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  108. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  109. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  110. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  111. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  112. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  113. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  114. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  115. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  116. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  117. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  118. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -26
  119. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  120. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  121. data/lib/tinkerforge/bricklet_rs485.rb +250 -164
  122. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  123. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  124. data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
  125. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  126. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  127. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  128. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  129. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  130. data/lib/tinkerforge/bricklet_temperature_ir.rb +61 -47
  131. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +74 -44
  132. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  133. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  134. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  135. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  136. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  137. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  138. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  139. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  140. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  141. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +92 -77
  142. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +81 -36
  143. data/lib/tinkerforge/device_display_names.rb +167 -0
  144. data/lib/tinkerforge/ip_connection.rb +156 -33
  145. data/lib/tinkerforge/version.rb +1 -1
  146. metadata +8 -3
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-08-23. #
3
+ # This file was automatically generated on 2021-01-15. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.28 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Determine position, velocity and altitude using GPS
14
16
  class BrickletGPS < Device
@@ -87,7 +89,7 @@ module Tinkerforge
87
89
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
88
90
  # the IP Connection <tt>ipcon</tt>.
89
91
  def initialize(uid, ipcon)
90
- super uid, ipcon
92
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
91
93
 
92
94
  @api_version = [2, 0, 1]
93
95
 
@@ -109,12 +111,13 @@ module Tinkerforge
109
111
  @response_expected[FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
110
112
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
111
113
 
112
- @callback_formats[CALLBACK_COORDINATES] = 'L k L k S S S S'
113
- @callback_formats[CALLBACK_STATUS] = 'C C C'
114
- @callback_formats[CALLBACK_ALTITUDE] = 'l l'
115
- @callback_formats[CALLBACK_MOTION] = 'L L'
116
- @callback_formats[CALLBACK_DATE_TIME] = 'L L'
114
+ @callback_formats[CALLBACK_COORDINATES] = [26, 'L k L k S S S S']
115
+ @callback_formats[CALLBACK_STATUS] = [11, 'C C C']
116
+ @callback_formats[CALLBACK_ALTITUDE] = [16, 'l l']
117
+ @callback_formats[CALLBACK_MOTION] = [16, 'L L']
118
+ @callback_formats[CALLBACK_DATE_TIME] = [16, 'L L']
117
119
 
120
+ @ipcon.add_device self
118
121
  end
119
122
 
120
123
  # Returns the GPS coordinates. Latitude and longitude are given in the
@@ -127,16 +130,18 @@ module Tinkerforge
127
130
  # the additional multiplicative effect of GPS satellite geometry on GPS
128
131
  # precision. See
129
132
  # `here <https://en.wikipedia.org/wiki/Dilution_of_precision_(GPS)>`__
130
- # for more information. The values are give in hundredths.
133
+ # for more information.
131
134
  #
132
- # EPE is the "Estimated Position Error". The EPE is given in cm. This is not the
135
+ # EPE is the "Estimated Position Error". This is not the
133
136
  # absolute maximum error, it is the error with a specific confidence. See
134
137
  # `here <https://www.nps.gov/gis/gps/WhatisEPE.html>`__ for more information.
135
138
  #
136
139
  # This data is only valid if there is currently a fix as indicated by
137
140
  # BrickletGPS#get_status.
138
141
  def get_coordinates
139
- send_request FUNCTION_GET_COORDINATES, [], '', 18, 'L k L k S S S S'
142
+ check_validity
143
+
144
+ send_request FUNCTION_GET_COORDINATES, [], '', 26, 'L k L k S S S S'
140
145
  end
141
146
 
142
147
  # Returns the current fix status, the number of satellites that are in view and
@@ -153,21 +158,22 @@ module Tinkerforge
153
158
  # There is also a :ref:`blue LED <gps_bricklet_fix_led>` on the Bricklet that
154
159
  # indicates the fix status.
155
160
  def get_status
156
- send_request FUNCTION_GET_STATUS, [], '', 3, 'C C C'
161
+ check_validity
162
+
163
+ send_request FUNCTION_GET_STATUS, [], '', 11, 'C C C'
157
164
  end
158
165
 
159
166
  # Returns the current altitude and corresponding geoidal separation.
160
167
  #
161
- # Both values are given in cm.
162
- #
163
168
  # This data is only valid if there is currently a fix as indicated by
164
169
  # BrickletGPS#get_status.
165
170
  def get_altitude
166
- send_request FUNCTION_GET_ALTITUDE, [], '', 8, 'l l'
171
+ check_validity
172
+
173
+ send_request FUNCTION_GET_ALTITUDE, [], '', 16, 'l l'
167
174
  end
168
175
 
169
- # Returns the current course and speed. Course is given in hundredths degree
170
- # and speed is given in hundredths km/h. A course of 0° means the Bricklet is
176
+ # Returns the current course and speed. A course of means the Bricklet is
171
177
  # traveling north bound and 90° means it is traveling east bound.
172
178
  #
173
179
  # Please note that this only returns useful values if an actual movement
@@ -176,15 +182,19 @@ module Tinkerforge
176
182
  # This data is only valid if there is currently a fix as indicated by
177
183
  # BrickletGPS#get_status.
178
184
  def get_motion
179
- send_request FUNCTION_GET_MOTION, [], '', 8, 'L L'
185
+ check_validity
186
+
187
+ send_request FUNCTION_GET_MOTION, [], '', 16, 'L L'
180
188
  end
181
189
 
182
190
  # Returns the current date and time. The date is
183
191
  # given in the format ``ddmmyy`` and the time is given
184
192
  # in the format ``hhmmss.sss``. For example, 140713 means
185
- # 14.05.13 as date and 195923568 means 19:59:23.568 as time.
193
+ # 14.07.13 as date and 195923568 means 19:59:23.568 as time.
186
194
  def get_date_time
187
- send_request FUNCTION_GET_DATE_TIME, [], '', 8, 'L L'
195
+ check_validity
196
+
197
+ send_request FUNCTION_GET_DATE_TIME, [], '', 16, 'L L'
188
198
  end
189
199
 
190
200
  # Restarts the GPS Bricklet, the following restart types are available:
@@ -196,99 +206,113 @@ module Tinkerforge
196
206
  # "2", "Cold start (don't use time, position, almanacs and ephemeris at restart)"
197
207
  # "3", "Factory reset (clear all system/user configurations at restart)"
198
208
  def restart(restart_type)
199
- send_request FUNCTION_RESTART, [restart_type], 'C', 0, ''
209
+ check_validity
210
+
211
+ send_request FUNCTION_RESTART, [restart_type], 'C', 8, ''
200
212
  end
201
213
 
202
- # Sets the period in ms with which the CALLBACK_COORDINATES callback is triggered
214
+ # Sets the period with which the CALLBACK_COORDINATES callback is triggered
203
215
  # periodically. A value of 0 turns the callback off.
204
216
  #
205
217
  # The CALLBACK_COORDINATES callback is only triggered if the coordinates changed
206
218
  # since the last triggering.
207
- #
208
- # The default value is 0.
209
219
  def set_coordinates_callback_period(period)
210
- send_request FUNCTION_SET_COORDINATES_CALLBACK_PERIOD, [period], 'L', 0, ''
220
+ check_validity
221
+
222
+ send_request FUNCTION_SET_COORDINATES_CALLBACK_PERIOD, [period], 'L', 8, ''
211
223
  end
212
224
 
213
225
  # Returns the period as set by BrickletGPS#set_coordinates_callback_period.
214
226
  def get_coordinates_callback_period
215
- send_request FUNCTION_GET_COORDINATES_CALLBACK_PERIOD, [], '', 4, 'L'
227
+ check_validity
228
+
229
+ send_request FUNCTION_GET_COORDINATES_CALLBACK_PERIOD, [], '', 12, 'L'
216
230
  end
217
231
 
218
- # Sets the period in ms with which the CALLBACK_STATUS callback is triggered
232
+ # Sets the period with which the CALLBACK_STATUS callback is triggered
219
233
  # periodically. A value of 0 turns the callback off.
220
234
  #
221
235
  # The CALLBACK_STATUS callback is only triggered if the status changed since the
222
236
  # last triggering.
223
- #
224
- # The default value is 0.
225
237
  def set_status_callback_period(period)
226
- send_request FUNCTION_SET_STATUS_CALLBACK_PERIOD, [period], 'L', 0, ''
238
+ check_validity
239
+
240
+ send_request FUNCTION_SET_STATUS_CALLBACK_PERIOD, [period], 'L', 8, ''
227
241
  end
228
242
 
229
243
  # Returns the period as set by BrickletGPS#set_status_callback_period.
230
244
  def get_status_callback_period
231
- send_request FUNCTION_GET_STATUS_CALLBACK_PERIOD, [], '', 4, 'L'
245
+ check_validity
246
+
247
+ send_request FUNCTION_GET_STATUS_CALLBACK_PERIOD, [], '', 12, 'L'
232
248
  end
233
249
 
234
- # Sets the period in ms with which the CALLBACK_ALTITUDE callback is triggered
250
+ # Sets the period with which the CALLBACK_ALTITUDE callback is triggered
235
251
  # periodically. A value of 0 turns the callback off.
236
252
  #
237
253
  # The CALLBACK_ALTITUDE callback is only triggered if the altitude changed since
238
254
  # the last triggering.
239
- #
240
- # The default value is 0.
241
255
  def set_altitude_callback_period(period)
242
- send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 0, ''
256
+ check_validity
257
+
258
+ send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 8, ''
243
259
  end
244
260
 
245
261
  # Returns the period as set by BrickletGPS#set_altitude_callback_period.
246
262
  def get_altitude_callback_period
247
- send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 4, 'L'
263
+ check_validity
264
+
265
+ send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 12, 'L'
248
266
  end
249
267
 
250
- # Sets the period in ms with which the CALLBACK_MOTION callback is triggered
268
+ # Sets the period with which the CALLBACK_MOTION callback is triggered
251
269
  # periodically. A value of 0 turns the callback off.
252
270
  #
253
271
  # The CALLBACK_MOTION callback is only triggered if the motion changed since the
254
272
  # last triggering.
255
- #
256
- # The default value is 0.
257
273
  def set_motion_callback_period(period)
258
- send_request FUNCTION_SET_MOTION_CALLBACK_PERIOD, [period], 'L', 0, ''
274
+ check_validity
275
+
276
+ send_request FUNCTION_SET_MOTION_CALLBACK_PERIOD, [period], 'L', 8, ''
259
277
  end
260
278
 
261
279
  # Returns the period as set by BrickletGPS#set_motion_callback_period.
262
280
  def get_motion_callback_period
263
- send_request FUNCTION_GET_MOTION_CALLBACK_PERIOD, [], '', 4, 'L'
281
+ check_validity
282
+
283
+ send_request FUNCTION_GET_MOTION_CALLBACK_PERIOD, [], '', 12, 'L'
264
284
  end
265
285
 
266
- # Sets the period in ms with which the CALLBACK_DATE_TIME callback is triggered
286
+ # Sets the period with which the CALLBACK_DATE_TIME callback is triggered
267
287
  # periodically. A value of 0 turns the callback off.
268
288
  #
269
289
  # The CALLBACK_DATE_TIME callback is only triggered if the date or time changed
270
290
  # since the last triggering.
271
- #
272
- # The default value is 0.
273
291
  def set_date_time_callback_period(period)
274
- send_request FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD, [period], 'L', 0, ''
292
+ check_validity
293
+
294
+ send_request FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD, [period], 'L', 8, ''
275
295
  end
276
296
 
277
297
  # Returns the period as set by BrickletGPS#set_date_time_callback_period.
278
298
  def get_date_time_callback_period
279
- send_request FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD, [], '', 4, 'L'
299
+ check_validity
300
+
301
+ send_request FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD, [], '', 12, 'L'
280
302
  end
281
303
 
282
304
  # Returns the UID, the UID where the Bricklet is connected to,
283
305
  # the position, the hardware and firmware version as well as the
284
306
  # device identifier.
285
307
  #
286
- # The position can be 'a', 'b', 'c' or 'd'.
308
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
309
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
310
+ # position 'z'.
287
311
  #
288
312
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
289
313
  # |device_identifier_constant|
290
314
  def get_identity
291
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
315
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
292
316
  end
293
317
 
294
318
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-08-23. #
3
+ # This file was automatically generated on 2021-01-15. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.28 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Determine position, velocity and altitude using GPS
14
16
  class BrickletGPSV2 < Device
@@ -138,7 +140,7 @@ module Tinkerforge
138
140
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
139
141
  # the IP Connection <tt>ipcon</tt>.
140
142
  def initialize(uid, ipcon)
141
- super uid, ipcon
143
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
142
144
 
143
145
  @api_version = [2, 0, 1]
144
146
 
@@ -177,13 +179,14 @@ module Tinkerforge
177
179
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
178
180
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
179
181
 
180
- @callback_formats[CALLBACK_PULSE_PER_SECOND] = ''
181
- @callback_formats[CALLBACK_COORDINATES] = 'L k L k'
182
- @callback_formats[CALLBACK_STATUS] = '? C'
183
- @callback_formats[CALLBACK_ALTITUDE] = 'l l'
184
- @callback_formats[CALLBACK_MOTION] = 'L L'
185
- @callback_formats[CALLBACK_DATE_TIME] = 'L L'
182
+ @callback_formats[CALLBACK_PULSE_PER_SECOND] = [8, '']
183
+ @callback_formats[CALLBACK_COORDINATES] = [18, 'L k L k']
184
+ @callback_formats[CALLBACK_STATUS] = [10, '? C']
185
+ @callback_formats[CALLBACK_ALTITUDE] = [16, 'l l']
186
+ @callback_formats[CALLBACK_MOTION] = [16, 'L L']
187
+ @callback_formats[CALLBACK_DATE_TIME] = [16, 'L L']
186
188
 
189
+ @ipcon.add_device self
187
190
  end
188
191
 
189
192
  # Returns the GPS coordinates. Latitude and longitude are given in the
@@ -195,7 +198,9 @@ module Tinkerforge
195
198
  # This data is only valid if there is currently a fix as indicated by
196
199
  # BrickletGPSV2#get_status.
197
200
  def get_coordinates
198
- send_request FUNCTION_GET_COORDINATES, [], '', 10, 'L k L k'
201
+ check_validity
202
+
203
+ send_request FUNCTION_GET_COORDINATES, [], '', 18, 'L k L k'
199
204
  end
200
205
 
201
206
  # Returns if a fix is currently available as well as the, the number of
@@ -204,21 +209,22 @@ module Tinkerforge
204
209
  # There is also a :ref:`green LED <gps_v2_bricklet_fix_led>` on the Bricklet that
205
210
  # indicates the fix status.
206
211
  def get_status
207
- send_request FUNCTION_GET_STATUS, [], '', 2, '? C'
212
+ check_validity
213
+
214
+ send_request FUNCTION_GET_STATUS, [], '', 10, '? C'
208
215
  end
209
216
 
210
217
  # Returns the current altitude and corresponding geoidal separation.
211
218
  #
212
- # Both values are given in cm.
213
- #
214
219
  # This data is only valid if there is currently a fix as indicated by
215
220
  # BrickletGPSV2#get_status.
216
221
  def get_altitude
217
- send_request FUNCTION_GET_ALTITUDE, [], '', 8, 'l l'
222
+ check_validity
223
+
224
+ send_request FUNCTION_GET_ALTITUDE, [], '', 16, 'l l'
218
225
  end
219
226
 
220
- # Returns the current course and speed. Course is given in hundredths degree
221
- # and speed is given in hundredths km/h. A course of 0° means the Bricklet is
227
+ # Returns the current course and speed. A course of means the Bricklet is
222
228
  # traveling north bound and 90° means it is traveling east bound.
223
229
  #
224
230
  # Please note that this only returns useful values if an actual movement
@@ -227,15 +233,19 @@ module Tinkerforge
227
233
  # This data is only valid if there is currently a fix as indicated by
228
234
  # BrickletGPSV2#get_status.
229
235
  def get_motion
230
- send_request FUNCTION_GET_MOTION, [], '', 8, 'L L'
236
+ check_validity
237
+
238
+ send_request FUNCTION_GET_MOTION, [], '', 16, 'L L'
231
239
  end
232
240
 
233
241
  # Returns the current date and time. The date is
234
242
  # given in the format ``ddmmyy`` and the time is given
235
243
  # in the format ``hhmmss.sss``. For example, 140713 means
236
- # 14.05.13 as date and 195923568 means 19:59:23.568 as time.
244
+ # 14.07.13 as date and 195923568 means 19:59:23.568 as time.
237
245
  def get_date_time
238
- send_request FUNCTION_GET_DATE_TIME, [], '', 8, 'L L'
246
+ check_validity
247
+
248
+ send_request FUNCTION_GET_DATE_TIME, [], '', 16, 'L L'
239
249
  end
240
250
 
241
251
  # Restarts the GPS Bricklet, the following restart types are available:
@@ -247,7 +257,9 @@ module Tinkerforge
247
257
  # "2", "Cold start (don't use time, position, almanacs and ephemeris at restart)"
248
258
  # "3", "Factory reset (clear all system/user configurations at restart)"
249
259
  def restart(restart_type)
250
- send_request FUNCTION_RESTART, [restart_type], 'C', 0, ''
260
+ check_validity
261
+
262
+ send_request FUNCTION_RESTART, [restart_type], 'C', 8, ''
251
263
  end
252
264
 
253
265
  # Returns the
@@ -265,15 +277,12 @@ module Tinkerforge
265
277
  # the numbers of the satellites that are currently utilized. The number 0 is not
266
278
  # a valid satellite number and can be ignored in the list.
267
279
  def get_satellite_system_status_low_level(satellite_system)
268
- send_request FUNCTION_GET_SATELLITE_SYSTEM_STATUS_LOW_LEVEL, [satellite_system], 'C', 20, 'C C12 C S S S'
280
+ check_validity
281
+
282
+ send_request FUNCTION_GET_SATELLITE_SYSTEM_STATUS_LOW_LEVEL, [satellite_system], 'C', 28, 'C C12 C S S S'
269
283
  end
270
284
 
271
- # Returns the current
272
- #
273
- # * elevation (0° - 90°),
274
- # * azimuth (0° - 359°) and
275
- # * SNR (0dB - 99dB)
276
- #
285
+ # Returns the current elevation, azimuth and SNR
277
286
  # for a given satellite and satellite system.
278
287
  #
279
288
  # The satellite number here always goes from 1 to 32. For GLONASS it corresponds to
@@ -281,7 +290,9 @@ module Tinkerforge
281
290
  #
282
291
  # Galileo is not yet supported.
283
292
  def get_satellite_status(satellite_system, satellite_number)
284
- send_request FUNCTION_GET_SATELLITE_STATUS, [satellite_system, satellite_number], 'C C', 6, 's s s'
293
+ check_validity
294
+
295
+ send_request FUNCTION_GET_SATELLITE_STATUS, [satellite_system, satellite_number], 'C C', 14, 's s s'
285
296
  end
286
297
 
287
298
  # Sets the fix LED configuration. By default the LED shows if
@@ -293,110 +304,126 @@ module Tinkerforge
293
304
  #
294
305
  # If the Bricklet is in bootloader mode, the LED is off.
295
306
  def set_fix_led_config(config)
296
- send_request FUNCTION_SET_FIX_LED_CONFIG, [config], 'C', 0, ''
307
+ check_validity
308
+
309
+ send_request FUNCTION_SET_FIX_LED_CONFIG, [config], 'C', 8, ''
297
310
  end
298
311
 
299
312
  # Returns the configuration as set by BrickletGPSV2#set_fix_led_config
300
313
  def get_fix_led_config
301
- send_request FUNCTION_GET_FIX_LED_CONFIG, [], '', 1, 'C'
314
+ check_validity
315
+
316
+ send_request FUNCTION_GET_FIX_LED_CONFIG, [], '', 9, 'C'
302
317
  end
303
318
 
304
- # Sets the period in ms with which the CALLBACK_COORDINATES callback is triggered
319
+ # Sets the period with which the CALLBACK_COORDINATES callback is triggered
305
320
  # periodically. A value of 0 turns the callback off.
306
321
  #
307
322
  # The CALLBACK_COORDINATES callback is only triggered if the coordinates changed
308
323
  # since the last triggering.
309
- #
310
- # The default value is 0.
311
324
  def set_coordinates_callback_period(period)
312
- send_request FUNCTION_SET_COORDINATES_CALLBACK_PERIOD, [period], 'L', 0, ''
325
+ check_validity
326
+
327
+ send_request FUNCTION_SET_COORDINATES_CALLBACK_PERIOD, [period], 'L', 8, ''
313
328
  end
314
329
 
315
330
  # Returns the period as set by BrickletGPSV2#set_coordinates_callback_period.
316
331
  def get_coordinates_callback_period
317
- send_request FUNCTION_GET_COORDINATES_CALLBACK_PERIOD, [], '', 4, 'L'
332
+ check_validity
333
+
334
+ send_request FUNCTION_GET_COORDINATES_CALLBACK_PERIOD, [], '', 12, 'L'
318
335
  end
319
336
 
320
- # Sets the period in ms with which the CALLBACK_STATUS callback is triggered
337
+ # Sets the period with which the CALLBACK_STATUS callback is triggered
321
338
  # periodically. A value of 0 turns the callback off.
322
339
  #
323
340
  # The CALLBACK_STATUS callback is only triggered if the status changed since the
324
341
  # last triggering.
325
- #
326
- # The default value is 0.
327
342
  def set_status_callback_period(period)
328
- send_request FUNCTION_SET_STATUS_CALLBACK_PERIOD, [period], 'L', 0, ''
343
+ check_validity
344
+
345
+ send_request FUNCTION_SET_STATUS_CALLBACK_PERIOD, [period], 'L', 8, ''
329
346
  end
330
347
 
331
348
  # Returns the period as set by BrickletGPSV2#set_status_callback_period.
332
349
  def get_status_callback_period
333
- send_request FUNCTION_GET_STATUS_CALLBACK_PERIOD, [], '', 4, 'L'
350
+ check_validity
351
+
352
+ send_request FUNCTION_GET_STATUS_CALLBACK_PERIOD, [], '', 12, 'L'
334
353
  end
335
354
 
336
- # Sets the period in ms with which the CALLBACK_ALTITUDE callback is triggered
355
+ # Sets the period with which the CALLBACK_ALTITUDE callback is triggered
337
356
  # periodically. A value of 0 turns the callback off.
338
357
  #
339
358
  # The CALLBACK_ALTITUDE callback is only triggered if the altitude changed since the
340
359
  # last triggering.
341
- #
342
- # The default value is 0.
343
360
  def set_altitude_callback_period(period)
344
- send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 0, ''
361
+ check_validity
362
+
363
+ send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 8, ''
345
364
  end
346
365
 
347
366
  # Returns the period as set by BrickletGPSV2#set_altitude_callback_period.
348
367
  def get_altitude_callback_period
349
- send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 4, 'L'
368
+ check_validity
369
+
370
+ send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 12, 'L'
350
371
  end
351
372
 
352
- # Sets the period in ms with which the CALLBACK_MOTION callback is triggered
373
+ # Sets the period with which the CALLBACK_MOTION callback is triggered
353
374
  # periodically. A value of 0 turns the callback off.
354
375
  #
355
376
  # The CALLBACK_MOTION callback is only triggered if the motion changed since the
356
377
  # last triggering.
357
- #
358
- # The default value is 0.
359
378
  def set_motion_callback_period(period)
360
- send_request FUNCTION_SET_MOTION_CALLBACK_PERIOD, [period], 'L', 0, ''
379
+ check_validity
380
+
381
+ send_request FUNCTION_SET_MOTION_CALLBACK_PERIOD, [period], 'L', 8, ''
361
382
  end
362
383
 
363
384
  # Returns the period as set by BrickletGPSV2#set_motion_callback_period.
364
385
  def get_motion_callback_period
365
- send_request FUNCTION_GET_MOTION_CALLBACK_PERIOD, [], '', 4, 'L'
386
+ check_validity
387
+
388
+ send_request FUNCTION_GET_MOTION_CALLBACK_PERIOD, [], '', 12, 'L'
366
389
  end
367
390
 
368
- # Sets the period in ms with which the CALLBACK_DATE_TIME callback is triggered
391
+ # Sets the period with which the CALLBACK_DATE_TIME callback is triggered
369
392
  # periodically. A value of 0 turns the callback off.
370
393
  #
371
394
  # The CALLBACK_DATE_TIME callback is only triggered if the date or time changed
372
395
  # since the last triggering.
373
- #
374
- # The default value is 0.
375
396
  def set_date_time_callback_period(period)
376
- send_request FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD, [period], 'L', 0, ''
397
+ check_validity
398
+
399
+ send_request FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD, [period], 'L', 8, ''
377
400
  end
378
401
 
379
402
  # Returns the period as set by BrickletGPSV2#set_date_time_callback_period.
380
403
  def get_date_time_callback_period
381
- send_request FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD, [], '', 4, 'L'
404
+ check_validity
405
+
406
+ send_request FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD, [], '', 12, 'L'
382
407
  end
383
408
 
384
409
  # If `SBAS <https://en.wikipedia.org/wiki/GNSS_augmentation#Satellite-based_augmentation_system>`__ is enabled,
385
410
  # the position accuracy increases (if SBAS satellites are in view),
386
411
  # but the update rate is limited to 5Hz. With SBAS disabled the update rate is increased to 10Hz.
387
412
  #
388
- # By default SBAS is enabled and the update rate is 5Hz.
389
- #
390
413
  # .. versionadded:: 2.0.2$nbsp;(Plugin)
391
414
  def set_sbas_config(sbas_config)
392
- send_request FUNCTION_SET_SBAS_CONFIG, [sbas_config], 'C', 0, ''
415
+ check_validity
416
+
417
+ send_request FUNCTION_SET_SBAS_CONFIG, [sbas_config], 'C', 8, ''
393
418
  end
394
419
 
395
420
  # Returns the SBAS configuration as set by BrickletGPSV2#set_sbas_config
396
421
  #
397
422
  # .. versionadded:: 2.0.2$nbsp;(Plugin)
398
423
  def get_sbas_config
399
- send_request FUNCTION_GET_SBAS_CONFIG, [], '', 1, 'C'
424
+ check_validity
425
+
426
+ send_request FUNCTION_GET_SBAS_CONFIG, [], '', 9, 'C'
400
427
  end
401
428
 
402
429
  # Returns the error count for the communication between Brick and Bricklet.
@@ -411,7 +438,9 @@ module Tinkerforge
411
438
  # The errors counts are for errors that occur on the Bricklet side. All
412
439
  # Bricks have a similar function that returns the errors on the Brick side.
413
440
  def get_spitfp_error_count
414
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
441
+ check_validity
442
+
443
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
415
444
  end
416
445
 
417
446
  # Sets the bootloader mode and returns the status after the requested
@@ -424,12 +453,16 @@ module Tinkerforge
424
453
  # This function is used by Brick Viewer during flashing. It should not be
425
454
  # necessary to call it in a normal user program.
426
455
  def set_bootloader_mode(mode)
427
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
456
+ check_validity
457
+
458
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
428
459
  end
429
460
 
430
461
  # Returns the current bootloader mode, see BrickletGPSV2#set_bootloader_mode.
431
462
  def get_bootloader_mode
432
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
463
+ check_validity
464
+
465
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
433
466
  end
434
467
 
435
468
  # Sets the firmware pointer for BrickletGPSV2#write_firmware. The pointer has
@@ -439,7 +472,9 @@ module Tinkerforge
439
472
  # This function is used by Brick Viewer during flashing. It should not be
440
473
  # necessary to call it in a normal user program.
441
474
  def set_write_firmware_pointer(pointer)
442
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
475
+ check_validity
476
+
477
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
443
478
  end
444
479
 
445
480
  # Writes 64 Bytes of firmware at the position as written by
@@ -451,7 +486,9 @@ module Tinkerforge
451
486
  # This function is used by Brick Viewer during flashing. It should not be
452
487
  # necessary to call it in a normal user program.
453
488
  def write_firmware(data)
454
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
489
+ check_validity
490
+
491
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
455
492
  end
456
493
 
457
494
  # Sets the status LED configuration. By default the LED shows
@@ -462,22 +499,28 @@ module Tinkerforge
462
499
  #
463
500
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
464
501
  def set_status_led_config(config)
465
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
502
+ check_validity
503
+
504
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
466
505
  end
467
506
 
468
507
  # Returns the configuration as set by BrickletGPSV2#set_status_led_config
469
508
  def get_status_led_config
470
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
509
+ check_validity
510
+
511
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
471
512
  end
472
513
 
473
- # Returns the temperature in °C as measured inside the microcontroller. The
514
+ # Returns the temperature as measured inside the microcontroller. The
474
515
  # value returned is not the ambient temperature!
475
516
  #
476
517
  # The temperature is only proportional to the real temperature and it has bad
477
518
  # accuracy. Practically it is only useful as an indicator for
478
519
  # temperature changes.
479
520
  def get_chip_temperature
480
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
521
+ check_validity
522
+
523
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
481
524
  end
482
525
 
483
526
  # Calling this function will reset the Bricklet. All configurations
@@ -487,7 +530,9 @@ module Tinkerforge
487
530
  # calling functions on the existing ones will result in
488
531
  # undefined behavior!
489
532
  def reset
490
- send_request FUNCTION_RESET, [], '', 0, ''
533
+ check_validity
534
+
535
+ send_request FUNCTION_RESET, [], '', 8, ''
491
536
  end
492
537
 
493
538
  # Writes a new UID into flash. If you want to set a new UID
@@ -496,25 +541,31 @@ module Tinkerforge
496
541
  #
497
542
  # We recommend that you use Brick Viewer to change the UID.
498
543
  def write_uid(uid)
499
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
544
+ check_validity
545
+
546
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
500
547
  end
501
548
 
502
549
  # Returns the current UID as an integer. Encode as
503
550
  # Base58 to get the usual string version.
504
551
  def read_uid
505
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
552
+ check_validity
553
+
554
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
506
555
  end
507
556
 
508
557
  # Returns the UID, the UID where the Bricklet is connected to,
509
558
  # the position, the hardware and firmware version as well as the
510
559
  # device identifier.
511
560
  #
512
- # The position can be 'a', 'b', 'c' or 'd'.
561
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
562
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
563
+ # position 'z'.
513
564
  #
514
565
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
515
566
  # |device_identifier_constant|
516
567
  def get_identity
517
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
568
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
518
569
  end
519
570
 
520
571
  # Returns the