tinkerforge 2.1.13 → 2.1.14
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tinkerforge/brick_dc.rb +122 -34
- data/lib/tinkerforge/brick_imu.rb +135 -49
- data/lib/tinkerforge/brick_imu_v2.rb +137 -54
- data/lib/tinkerforge/brick_master.rb +206 -120
- data/lib/tinkerforge/brick_red.rb +64 -69
- data/lib/tinkerforge/brick_servo.rb +133 -44
- data/lib/tinkerforge/brick_silent_stepper.rb +151 -65
- data/lib/tinkerforge/brick_stepper.rb +139 -51
- data/lib/tinkerforge/bricklet_accelerometer.rb +17 -18
- data/lib/tinkerforge/bricklet_ambient_light.rb +16 -19
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +13 -14
- data/lib/tinkerforge/bricklet_analog_in.rb +20 -23
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +18 -21
- data/lib/tinkerforge/bricklet_analog_out.rb +8 -7
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +7 -6
- data/lib/tinkerforge/bricklet_barometer.rb +21 -24
- data/lib/tinkerforge/bricklet_can.rb +14 -14
- data/lib/tinkerforge/bricklet_co2.rb +11 -12
- data/lib/tinkerforge/bricklet_color.rb +22 -25
- data/lib/tinkerforge/bricklet_current12.rb +18 -22
- data/lib/tinkerforge/bricklet_current25.rb +18 -22
- data/lib/tinkerforge/bricklet_distance_ir.rb +18 -21
- data/lib/tinkerforge/bricklet_distance_us.rb +13 -14
- data/lib/tinkerforge/bricklet_dual_button.rb +8 -8
- data/lib/tinkerforge/bricklet_dual_relay.rb +9 -9
- data/lib/tinkerforge/bricklet_dust_detector.rb +13 -14
- data/lib/tinkerforge/bricklet_gps.rb +21 -25
- data/lib/tinkerforge/bricklet_gps_v2.rb +56 -41
- data/lib/tinkerforge/bricklet_hall_effect.rb +13 -13
- data/lib/tinkerforge/bricklet_humidity.rb +16 -19
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +13 -12
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +15 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +12 -12
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +13 -14
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +16 -17
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +12 -12
- data/lib/tinkerforge/bricklet_io16.rb +18 -19
- data/lib/tinkerforge/bricklet_io4.rb +18 -19
- data/lib/tinkerforge/bricklet_joystick.rb +18 -23
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +26 -29
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +14 -15
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +18 -19
- data/lib/tinkerforge/bricklet_led_strip.rb +20 -20
- data/lib/tinkerforge/bricklet_line.rb +11 -12
- data/lib/tinkerforge/bricklet_linear_poti.rb +16 -19
- data/lib/tinkerforge/bricklet_load_cell.rb +20 -21
- data/lib/tinkerforge/bricklet_moisture.rb +13 -14
- data/lib/tinkerforge/bricklet_motion_detector.rb +7 -8
- data/lib/tinkerforge/bricklet_multi_touch.rb +10 -10
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +11 -11
- data/lib/tinkerforge/bricklet_oled_128x64.rb +10 -9
- data/lib/tinkerforge/bricklet_oled_64x48.rb +10 -9
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +6 -7
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +7 -8
- data/lib/tinkerforge/bricklet_ptc.rb +23 -26
- data/lib/tinkerforge/bricklet_real_time_clock.rb +13 -14
- data/lib/tinkerforge/bricklet_remote_switch.rb +12 -12
- data/lib/tinkerforge/bricklet_rgb_led.rb +6 -5
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +12 -15
- data/lib/tinkerforge/bricklet_rotary_poti.rb +16 -19
- data/lib/tinkerforge/bricklet_rs232.rb +12 -13
- data/lib/tinkerforge/bricklet_rs485.rb +1373 -0
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +8 -8
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +8 -8
- data/lib/tinkerforge/bricklet_sound_intensity.rb +11 -12
- data/lib/tinkerforge/bricklet_temperature.rb +13 -14
- data/lib/tinkerforge/bricklet_temperature_ir.rb +18 -21
- data/lib/tinkerforge/bricklet_thermocouple.rb +14 -16
- data/lib/tinkerforge/bricklet_tilt.rb +8 -8
- data/lib/tinkerforge/bricklet_uv_light.rb +11 -12
- data/lib/tinkerforge/bricklet_voltage.rb +16 -19
- data/lib/tinkerforge/bricklet_voltage_current.rb +25 -30
- data/lib/tinkerforge/ip_connection.rb +207 -138
- data/lib/tinkerforge/version.rb +1 -1
- metadata +3 -2
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-07-27. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.14 #
|
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 #
|
@@ -93,10 +93,6 @@ module Tinkerforge
|
|
93
93
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
94
94
|
@response_expected[FUNCTION_SET_REFERENCE_AIR_PRESSURE] = RESPONSE_EXPECTED_FALSE
|
95
95
|
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
96
|
-
@response_expected[CALLBACK_AIR_PRESSURE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
97
|
-
@response_expected[CALLBACK_ALTITUDE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
98
|
-
@response_expected[CALLBACK_AIR_PRESSURE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
99
|
-
@response_expected[CALLBACK_ALTITUDE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
100
96
|
@response_expected[FUNCTION_GET_REFERENCE_AIR_PRESSURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
101
97
|
@response_expected[FUNCTION_SET_AVERAGING] = RESPONSE_EXPECTED_FALSE
|
102
98
|
@response_expected[FUNCTION_GET_AVERAGING] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -106,6 +102,7 @@ module Tinkerforge
|
|
106
102
|
@callback_formats[CALLBACK_ALTITUDE] = 'l'
|
107
103
|
@callback_formats[CALLBACK_AIR_PRESSURE_REACHED] = 'l'
|
108
104
|
@callback_formats[CALLBACK_ALTITUDE_REACHED] = 'l'
|
105
|
+
|
109
106
|
end
|
110
107
|
|
111
108
|
# Returns the air pressure of the air pressure sensor. The value
|
@@ -116,7 +113,7 @@ module Tinkerforge
|
|
116
113
|
# CALLBACK_AIR_PRESSURE callback and set the period with
|
117
114
|
# BrickletBarometer#set_air_pressure_callback_period.
|
118
115
|
def get_air_pressure
|
119
|
-
send_request
|
116
|
+
send_request FUNCTION_GET_AIR_PRESSURE, [], '', 4, 'l'
|
120
117
|
end
|
121
118
|
|
122
119
|
# Returns the relative altitude of the air pressure sensor. The value is given in
|
@@ -127,7 +124,7 @@ module Tinkerforge
|
|
127
124
|
# CALLBACK_ALTITUDE callback and set the period with
|
128
125
|
# BrickletBarometer#set_altitude_callback_period.
|
129
126
|
def get_altitude
|
130
|
-
send_request
|
127
|
+
send_request FUNCTION_GET_ALTITUDE, [], '', 4, 'l'
|
131
128
|
end
|
132
129
|
|
133
130
|
# Sets the period in ms with which the CALLBACK_AIR_PRESSURE callback is triggered
|
@@ -138,12 +135,12 @@ module Tinkerforge
|
|
138
135
|
#
|
139
136
|
# The default value is 0.
|
140
137
|
def set_air_pressure_callback_period(period)
|
141
|
-
send_request
|
138
|
+
send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
142
139
|
end
|
143
140
|
|
144
141
|
# Returns the period as set by BrickletBarometer#set_air_pressure_callback_period.
|
145
142
|
def get_air_pressure_callback_period
|
146
|
-
send_request
|
143
|
+
send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_PERIOD, [], '', 4, 'L'
|
147
144
|
end
|
148
145
|
|
149
146
|
# Sets the period in ms with which the CALLBACK_ALTITUDE callback is triggered
|
@@ -154,12 +151,12 @@ module Tinkerforge
|
|
154
151
|
#
|
155
152
|
# The default value is 0.
|
156
153
|
def set_altitude_callback_period(period)
|
157
|
-
send_request
|
154
|
+
send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
158
155
|
end
|
159
156
|
|
160
157
|
# Returns the period as set by BrickletBarometer#set_altitude_callback_period.
|
161
158
|
def get_altitude_callback_period
|
162
|
-
send_request
|
159
|
+
send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 4, 'L'
|
163
160
|
end
|
164
161
|
|
165
162
|
# Sets the thresholds for the CALLBACK_AIR_PRESSURE_REACHED callback.
|
@@ -176,12 +173,12 @@ module Tinkerforge
|
|
176
173
|
#
|
177
174
|
# The default value is ('x', 0, 0).
|
178
175
|
def set_air_pressure_callback_threshold(option, min, max)
|
179
|
-
send_request
|
176
|
+
send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
|
180
177
|
end
|
181
178
|
|
182
179
|
# Returns the threshold as set by BrickletBarometer#set_air_pressure_callback_threshold.
|
183
180
|
def get_air_pressure_callback_threshold
|
184
|
-
send_request
|
181
|
+
send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
|
185
182
|
end
|
186
183
|
|
187
184
|
# Sets the thresholds for the CALLBACK_ALTITUDE_REACHED callback.
|
@@ -198,12 +195,12 @@ module Tinkerforge
|
|
198
195
|
#
|
199
196
|
# The default value is ('x', 0, 0).
|
200
197
|
def set_altitude_callback_threshold(option, min, max)
|
201
|
-
send_request
|
198
|
+
send_request FUNCTION_SET_ALTITUDE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
|
202
199
|
end
|
203
200
|
|
204
201
|
# Returns the threshold as set by BrickletBarometer#set_altitude_callback_threshold.
|
205
202
|
def get_altitude_callback_threshold
|
206
|
-
send_request
|
203
|
+
send_request FUNCTION_GET_ALTITUDE_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
|
207
204
|
end
|
208
205
|
|
209
206
|
# Sets the period in ms with which the threshold callbacks
|
@@ -220,12 +217,12 @@ module Tinkerforge
|
|
220
217
|
#
|
221
218
|
# The default value is 100.
|
222
219
|
def set_debounce_period(debounce)
|
223
|
-
send_request
|
220
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
224
221
|
end
|
225
222
|
|
226
223
|
# Returns the debounce period as set by BrickletBarometer#set_debounce_period.
|
227
224
|
def get_debounce_period
|
228
|
-
send_request
|
225
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
229
226
|
end
|
230
227
|
|
231
228
|
# Sets the reference air pressure in mbar/1000 for the altitude calculation.
|
@@ -241,7 +238,7 @@ module Tinkerforge
|
|
241
238
|
#
|
242
239
|
# The default value is 1013.25mbar.
|
243
240
|
def set_reference_air_pressure(air_pressure)
|
244
|
-
send_request
|
241
|
+
send_request FUNCTION_SET_REFERENCE_AIR_PRESSURE, [air_pressure], 'l', 0, ''
|
245
242
|
end
|
246
243
|
|
247
244
|
# Returns the temperature of the air pressure sensor. The value
|
@@ -252,12 +249,12 @@ module Tinkerforge
|
|
252
249
|
# pressure measurement. It is not as accurate as the temperature measured by the
|
253
250
|
# :ref:`temperature_bricklet` or the :ref:`temperature_ir_bricklet`.
|
254
251
|
def get_chip_temperature
|
255
|
-
send_request
|
252
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
|
256
253
|
end
|
257
254
|
|
258
255
|
# Returns the reference air pressure as set by BrickletBarometer#set_reference_air_pressure.
|
259
256
|
def get_reference_air_pressure
|
260
|
-
send_request
|
257
|
+
send_request FUNCTION_GET_REFERENCE_AIR_PRESSURE, [], '', 4, 'l'
|
261
258
|
end
|
262
259
|
|
263
260
|
# Sets the different averaging parameters. It is possible to set
|
@@ -281,14 +278,14 @@ module Tinkerforge
|
|
281
278
|
#
|
282
279
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
283
280
|
def set_averaging(moving_average_pressure, average_pressure, average_temperature)
|
284
|
-
send_request
|
281
|
+
send_request FUNCTION_SET_AVERAGING, [moving_average_pressure, average_pressure, average_temperature], 'C C C', 0, ''
|
285
282
|
end
|
286
283
|
|
287
284
|
# Returns the averaging configuration as set by BrickletBarometer#set_averaging.
|
288
285
|
#
|
289
286
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
290
287
|
def get_averaging
|
291
|
-
send_request
|
288
|
+
send_request FUNCTION_GET_AVERAGING, [], '', 3, 'C C C'
|
292
289
|
end
|
293
290
|
|
294
291
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -300,7 +297,7 @@ module Tinkerforge
|
|
300
297
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
301
298
|
# |device_identifier_constant|
|
302
299
|
def get_identity
|
303
|
-
send_request
|
300
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
304
301
|
end
|
305
302
|
|
306
303
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-07-27. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.14 #
|
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 #
|
@@ -79,10 +79,10 @@ module Tinkerforge
|
|
79
79
|
@response_expected[FUNCTION_SET_READ_FILTER] = RESPONSE_EXPECTED_FALSE
|
80
80
|
@response_expected[FUNCTION_GET_READ_FILTER] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
81
81
|
@response_expected[FUNCTION_GET_ERROR_LOG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
82
|
-
@response_expected[CALLBACK_FRAME_READ] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
83
82
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
84
83
|
|
85
84
|
@callback_formats[CALLBACK_FRAME_READ] = 'C L C8 C'
|
85
|
+
|
86
86
|
end
|
87
87
|
|
88
88
|
# Writes a data or remote frame to the write buffer to be transmitted over the
|
@@ -107,7 +107,7 @@ module Tinkerforge
|
|
107
107
|
# arbitration or because the CAN transceiver is currently disabled due to a high
|
108
108
|
# write error level (see BrickletCAN#get_error_log).
|
109
109
|
def write_frame(frame_type, identifier, data, length)
|
110
|
-
send_request
|
110
|
+
send_request FUNCTION_WRITE_FRAME, [frame_type, identifier, data, length], 'C L C8 C', 1, '?'
|
111
111
|
end
|
112
112
|
|
113
113
|
# Tries to read the next data or remote frame from the read buffer and return it.
|
@@ -128,26 +128,26 @@ module Tinkerforge
|
|
128
128
|
# Instead of polling with this function, you can also use callbacks. See the
|
129
129
|
# BrickletCAN#enable_frame_read_callback function and the CALLBACK_FRAME_READ callback.
|
130
130
|
def read_frame
|
131
|
-
send_request
|
131
|
+
send_request FUNCTION_READ_FRAME, [], '', 15, '? C L C8 C'
|
132
132
|
end
|
133
133
|
|
134
134
|
# Enables the CALLBACK_FRAME_READ callback.
|
135
135
|
#
|
136
136
|
# By default the callback is disabled.
|
137
137
|
def enable_frame_read_callback
|
138
|
-
send_request
|
138
|
+
send_request FUNCTION_ENABLE_FRAME_READ_CALLBACK, [], '', 0, ''
|
139
139
|
end
|
140
140
|
|
141
141
|
# Disables the CALLBACK_FRAME_READ callback.
|
142
142
|
#
|
143
143
|
# By default the callback is disabled.
|
144
144
|
def disable_frame_read_callback
|
145
|
-
send_request
|
145
|
+
send_request FUNCTION_DISABLE_FRAME_READ_CALLBACK, [], '', 0, ''
|
146
146
|
end
|
147
147
|
|
148
148
|
# Returns *true* if the CALLBACK_FRAME_READ callback is enabled, *false* otherwise.
|
149
149
|
def is_frame_read_callback_enabled
|
150
|
-
send_request
|
150
|
+
send_request FUNCTION_IS_FRAME_READ_CALLBACK_ENABLED, [], '', 1, '?'
|
151
151
|
end
|
152
152
|
|
153
153
|
# Sets the configuration for the CAN bus communication.
|
@@ -177,12 +177,12 @@ module Tinkerforge
|
|
177
177
|
#
|
178
178
|
# The default is: 125 kbit/s, normal transceiver mode and infinite write timeout.
|
179
179
|
def set_configuration(baud_rate, transceiver_mode, write_timeout)
|
180
|
-
send_request
|
180
|
+
send_request FUNCTION_SET_CONFIGURATION, [baud_rate, transceiver_mode, write_timeout], 'C C l', 0, ''
|
181
181
|
end
|
182
182
|
|
183
183
|
# Returns the configuration as set by BrickletCAN#set_configuration.
|
184
184
|
def get_configuration
|
185
|
-
send_request
|
185
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 6, 'C C l'
|
186
186
|
end
|
187
187
|
|
188
188
|
# Set the read filter configuration. This can be used to define which frames
|
@@ -238,12 +238,12 @@ module Tinkerforge
|
|
238
238
|
#
|
239
239
|
# The default mode is accept-all.
|
240
240
|
def set_read_filter(mode, mask, filter1, filter2)
|
241
|
-
send_request
|
241
|
+
send_request FUNCTION_SET_READ_FILTER, [mode, mask, filter1, filter2], 'C L L L', 0, ''
|
242
242
|
end
|
243
243
|
|
244
244
|
# Returns the read filter as set by BrickletCAN#set_read_filter.
|
245
245
|
def get_read_filter
|
246
|
-
send_request
|
246
|
+
send_request FUNCTION_GET_READ_FILTER, [], '', 13, 'C L L L'
|
247
247
|
end
|
248
248
|
|
249
249
|
# Returns information about different kinds of errors.
|
@@ -280,7 +280,7 @@ module Tinkerforge
|
|
280
280
|
# function. Using the CALLBACK_FRAME_READ callback ensures that the read buffer
|
281
281
|
# can not overflow.
|
282
282
|
def get_error_log
|
283
|
-
send_request
|
283
|
+
send_request FUNCTION_GET_ERROR_LOG, [], '', 15, 'C C ? L L L'
|
284
284
|
end
|
285
285
|
|
286
286
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -292,7 +292,7 @@ module Tinkerforge
|
|
292
292
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
293
293
|
# |device_identifier_constant|
|
294
294
|
def get_identity
|
295
|
-
send_request
|
295
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
296
296
|
end
|
297
297
|
|
298
298
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-07-27. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.14 #
|
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 #
|
@@ -60,12 +60,11 @@ module Tinkerforge
|
|
60
60
|
@response_expected[FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
61
61
|
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
62
62
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
63
|
-
@response_expected[CALLBACK_CO2_CONCENTRATION] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
64
|
-
@response_expected[CALLBACK_CO2_CONCENTRATION_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
65
63
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
66
64
|
|
67
65
|
@callback_formats[CALLBACK_CO2_CONCENTRATION] = 'S'
|
68
66
|
@callback_formats[CALLBACK_CO2_CONCENTRATION_REACHED] = 'S'
|
67
|
+
|
69
68
|
end
|
70
69
|
|
71
70
|
# Returns the measured CO2 concentration. The value is in
|
@@ -76,7 +75,7 @@ module Tinkerforge
|
|
76
75
|
# the CALLBACK_CO2_CONCENTRATION callback and set the period with
|
77
76
|
# BrickletCO2#set_co2_concentration_callback_period.
|
78
77
|
def get_co2_concentration
|
79
|
-
send_request
|
78
|
+
send_request FUNCTION_GET_CO2_CONCENTRATION, [], '', 2, 'S'
|
80
79
|
end
|
81
80
|
|
82
81
|
# Sets the period in ms with which the CALLBACK_CO2_CONCENTRATION callback is
|
@@ -87,12 +86,12 @@ module Tinkerforge
|
|
87
86
|
#
|
88
87
|
# The default value is 0.
|
89
88
|
def set_co2_concentration_callback_period(period)
|
90
|
-
send_request
|
89
|
+
send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_PERIOD, [period], 'L', 0, ''
|
91
90
|
end
|
92
91
|
|
93
92
|
# Returns the period as set by BrickletCO2#set_co2_concentration_callback_period.
|
94
93
|
def get_co2_concentration_callback_period
|
95
|
-
send_request
|
94
|
+
send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_PERIOD, [], '', 4, 'L'
|
96
95
|
end
|
97
96
|
|
98
97
|
# Sets the thresholds for the CALLBACK_CO2_CONCENTRATION_REACHED callback.
|
@@ -109,12 +108,12 @@ module Tinkerforge
|
|
109
108
|
#
|
110
109
|
# The default value is ('x', 0, 0).
|
111
110
|
def set_co2_concentration_callback_threshold(option, min, max)
|
112
|
-
send_request
|
111
|
+
send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
|
113
112
|
end
|
114
113
|
|
115
114
|
# Returns the threshold as set by BrickletCO2#set_co2_concentration_callback_threshold.
|
116
115
|
def get_co2_concentration_callback_threshold
|
117
|
-
send_request
|
116
|
+
send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
|
118
117
|
end
|
119
118
|
|
120
119
|
# Sets the period in ms with which the threshold callbacks
|
@@ -129,12 +128,12 @@ module Tinkerforge
|
|
129
128
|
#
|
130
129
|
# The default value is 100.
|
131
130
|
def set_debounce_period(debounce)
|
132
|
-
send_request
|
131
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
133
132
|
end
|
134
133
|
|
135
134
|
# Returns the debounce period as set by BrickletCO2#set_debounce_period.
|
136
135
|
def get_debounce_period
|
137
|
-
send_request
|
136
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
138
137
|
end
|
139
138
|
|
140
139
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -146,7 +145,7 @@ module Tinkerforge
|
|
146
145
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
147
146
|
# |device_identifier_constant|
|
148
147
|
def get_identity
|
149
|
-
send_request
|
148
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
150
149
|
end
|
151
150
|
|
152
151
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-07-27. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.14 #
|
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 #
|
@@ -99,8 +99,6 @@ module Tinkerforge
|
|
99
99
|
@response_expected[FUNCTION_GET_COLOR_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
100
100
|
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
101
101
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
102
|
-
@response_expected[CALLBACK_COLOR] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
103
|
-
@response_expected[CALLBACK_COLOR_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
104
102
|
@response_expected[FUNCTION_LIGHT_ON] = RESPONSE_EXPECTED_FALSE
|
105
103
|
@response_expected[FUNCTION_LIGHT_OFF] = RESPONSE_EXPECTED_FALSE
|
106
104
|
@response_expected[FUNCTION_IS_LIGHT_ON] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -112,14 +110,13 @@ module Tinkerforge
|
|
112
110
|
@response_expected[FUNCTION_GET_ILLUMINANCE_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
113
111
|
@response_expected[FUNCTION_SET_COLOR_TEMPERATURE_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
|
114
112
|
@response_expected[FUNCTION_GET_COLOR_TEMPERATURE_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
115
|
-
@response_expected[CALLBACK_ILLUMINANCE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
116
|
-
@response_expected[CALLBACK_COLOR_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
117
113
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
118
114
|
|
119
115
|
@callback_formats[CALLBACK_COLOR] = 'S S S S'
|
120
116
|
@callback_formats[CALLBACK_COLOR_REACHED] = 'S S S S'
|
121
117
|
@callback_formats[CALLBACK_ILLUMINANCE] = 'L'
|
122
118
|
@callback_formats[CALLBACK_COLOR_TEMPERATURE] = 'S'
|
119
|
+
|
123
120
|
end
|
124
121
|
|
125
122
|
# Returns the measured color of the sensor. The values
|
@@ -139,7 +136,7 @@ module Tinkerforge
|
|
139
136
|
# to use the CALLBACK_COLOR callback and set the period with
|
140
137
|
# BrickletColor#set_color_callback_period.
|
141
138
|
def get_color
|
142
|
-
send_request
|
139
|
+
send_request FUNCTION_GET_COLOR, [], '', 8, 'S S S S'
|
143
140
|
end
|
144
141
|
|
145
142
|
# Sets the period in ms with which the CALLBACK_COLOR callback is triggered
|
@@ -150,12 +147,12 @@ module Tinkerforge
|
|
150
147
|
#
|
151
148
|
# The default value is 0.
|
152
149
|
def set_color_callback_period(period)
|
153
|
-
send_request
|
150
|
+
send_request FUNCTION_SET_COLOR_CALLBACK_PERIOD, [period], 'L', 0, ''
|
154
151
|
end
|
155
152
|
|
156
153
|
# Returns the period as set by BrickletColor#set_color_callback_period.
|
157
154
|
def get_color_callback_period
|
158
|
-
send_request
|
155
|
+
send_request FUNCTION_GET_COLOR_CALLBACK_PERIOD, [], '', 4, 'L'
|
159
156
|
end
|
160
157
|
|
161
158
|
# Sets the thresholds for the CALLBACK_COLOR_REACHED callback.
|
@@ -172,12 +169,12 @@ module Tinkerforge
|
|
172
169
|
#
|
173
170
|
# The default value is ('x', 0, 0, 0, 0, 0, 0, 0, 0).
|
174
171
|
def set_color_callback_threshold(option, min_r, max_r, min_g, max_g, min_b, max_b, min_c, max_c)
|
175
|
-
send_request
|
172
|
+
send_request FUNCTION_SET_COLOR_CALLBACK_THRESHOLD, [option, min_r, max_r, min_g, max_g, min_b, max_b, min_c, max_c], 'k S S S S S S S S', 0, ''
|
176
173
|
end
|
177
174
|
|
178
175
|
# Returns the threshold as set by BrickletColor#set_color_callback_threshold.
|
179
176
|
def get_color_callback_threshold
|
180
|
-
send_request
|
177
|
+
send_request FUNCTION_GET_COLOR_CALLBACK_THRESHOLD, [], '', 17, 'k S S S S S S S S'
|
181
178
|
end
|
182
179
|
|
183
180
|
# Sets the period in ms with which the threshold callback
|
@@ -192,22 +189,22 @@ module Tinkerforge
|
|
192
189
|
#
|
193
190
|
# The default value is 100.
|
194
191
|
def set_debounce_period(debounce)
|
195
|
-
send_request
|
192
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
196
193
|
end
|
197
194
|
|
198
195
|
# Returns the debounce period as set by BrickletColor#set_debounce_period.
|
199
196
|
def get_debounce_period
|
200
|
-
send_request
|
197
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
201
198
|
end
|
202
199
|
|
203
200
|
# Turns the LED on.
|
204
201
|
def light_on
|
205
|
-
send_request
|
202
|
+
send_request FUNCTION_LIGHT_ON, [], '', 0, ''
|
206
203
|
end
|
207
204
|
|
208
205
|
# Turns the LED off.
|
209
206
|
def light_off
|
210
|
-
send_request
|
207
|
+
send_request FUNCTION_LIGHT_OFF, [], '', 0, ''
|
211
208
|
end
|
212
209
|
|
213
210
|
# Returns the state of the LED. Possible values are:
|
@@ -215,7 +212,7 @@ module Tinkerforge
|
|
215
212
|
# * 0: On
|
216
213
|
# * 1: Off
|
217
214
|
def is_light_on
|
218
|
-
send_request
|
215
|
+
send_request FUNCTION_IS_LIGHT_ON, [], '', 1, 'C'
|
219
216
|
end
|
220
217
|
|
221
218
|
# Sets the configuration of the sensor. Gain and integration time
|
@@ -246,12 +243,12 @@ module Tinkerforge
|
|
246
243
|
#
|
247
244
|
# The default values are 60x gain and 154ms integration time.
|
248
245
|
def set_config(gain, integration_time)
|
249
|
-
send_request
|
246
|
+
send_request FUNCTION_SET_CONFIG, [gain, integration_time], 'C C', 0, ''
|
250
247
|
end
|
251
248
|
|
252
249
|
# Returns the configuration as set by BrickletColor#set_config.
|
253
250
|
def get_config
|
254
|
-
send_request
|
251
|
+
send_request FUNCTION_GET_CONFIG, [], '', 2, 'C C'
|
255
252
|
end
|
256
253
|
|
257
254
|
# Returns the illuminance affected by the gain and integration time as
|
@@ -264,7 +261,7 @@ module Tinkerforge
|
|
264
261
|
# is saturated if it is equal to the maximum value of 65535.
|
265
262
|
# In that case you have to reduce the gain, see BrickletColor#set_config.
|
266
263
|
def get_illuminance
|
267
|
-
send_request
|
264
|
+
send_request FUNCTION_GET_ILLUMINANCE, [], '', 4, 'L'
|
268
265
|
end
|
269
266
|
|
270
267
|
# Returns the color temperature in Kelvin.
|
@@ -274,7 +271,7 @@ module Tinkerforge
|
|
274
271
|
# is saturated if it is equal to the maximum value of 65535.
|
275
272
|
# In that case you have to reduce the gain, see BrickletColor#set_config.
|
276
273
|
def get_color_temperature
|
277
|
-
send_request
|
274
|
+
send_request FUNCTION_GET_COLOR_TEMPERATURE, [], '', 2, 'S'
|
278
275
|
end
|
279
276
|
|
280
277
|
# Sets the period in ms with which the CALLBACK_ILLUMINANCE callback is triggered
|
@@ -285,12 +282,12 @@ module Tinkerforge
|
|
285
282
|
#
|
286
283
|
# The default value is 0.
|
287
284
|
def set_illuminance_callback_period(period)
|
288
|
-
send_request
|
285
|
+
send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
289
286
|
end
|
290
287
|
|
291
288
|
# Returns the period as set by BrickletColor#set_illuminance_callback_period.
|
292
289
|
def get_illuminance_callback_period
|
293
|
-
send_request
|
290
|
+
send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_PERIOD, [], '', 4, 'L'
|
294
291
|
end
|
295
292
|
|
296
293
|
# Sets the period in ms with which the CALLBACK_COLOR_TEMPERATURE callback is
|
@@ -301,12 +298,12 @@ module Tinkerforge
|
|
301
298
|
#
|
302
299
|
# The default value is 0.
|
303
300
|
def set_color_temperature_callback_period(period)
|
304
|
-
send_request
|
301
|
+
send_request FUNCTION_SET_COLOR_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
305
302
|
end
|
306
303
|
|
307
304
|
# Returns the period as set by BrickletColor#set_color_temperature_callback_period.
|
308
305
|
def get_color_temperature_callback_period
|
309
|
-
send_request
|
306
|
+
send_request FUNCTION_GET_COLOR_TEMPERATURE_CALLBACK_PERIOD, [], '', 4, 'L'
|
310
307
|
end
|
311
308
|
|
312
309
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -318,7 +315,7 @@ module Tinkerforge
|
|
318
315
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
319
316
|
# |device_identifier_constant|
|
320
317
|
def get_identity
|
321
|
-
send_request
|
318
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
322
319
|
end
|
323
320
|
|
324
321
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|