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