tinkerforge 2.0.13 → 2.1.0
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.
- data/lib/tinkerforge/brick_dc.rb +4 -11
- data/lib/tinkerforge/brick_imu.rb +17 -16
- data/lib/tinkerforge/brick_master.rb +96 -86
- data/lib/tinkerforge/brick_servo.rb +5 -12
- data/lib/tinkerforge/brick_stepper.rb +4 -29
- data/lib/tinkerforge/bricklet_ambient_light.rb +4 -5
- data/lib/tinkerforge/bricklet_analog_in.rb +4 -5
- data/lib/tinkerforge/bricklet_analog_out.rb +4 -5
- data/lib/tinkerforge/bricklet_barometer.rb +4 -9
- data/lib/tinkerforge/bricklet_current12.rb +4 -5
- data/lib/tinkerforge/bricklet_current25.rb +4 -5
- data/lib/tinkerforge/bricklet_distance_ir.rb +4 -5
- data/lib/tinkerforge/bricklet_distance_us.rb +4 -5
- data/lib/tinkerforge/bricklet_dual_button.rb +4 -7
- data/lib/tinkerforge/bricklet_dual_relay.rb +4 -13
- data/lib/tinkerforge/bricklet_gps.rb +4 -5
- data/lib/tinkerforge/bricklet_hall_effect.rb +6 -5
- data/lib/tinkerforge/bricklet_humidity.rb +4 -5
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +8 -6
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +7 -11
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +4 -5
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +9 -13
- data/lib/tinkerforge/bricklet_io16.rb +15 -21
- data/lib/tinkerforge/bricklet_io4.rb +11 -17
- data/lib/tinkerforge/bricklet_joystick.rb +4 -5
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +4 -5
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +4 -5
- data/lib/tinkerforge/bricklet_led_strip.rb +6 -5
- data/lib/tinkerforge/bricklet_line.rb +4 -5
- data/lib/tinkerforge/bricklet_linear_poti.rb +4 -5
- data/lib/tinkerforge/bricklet_moisture.rb +4 -5
- data/lib/tinkerforge/bricklet_motion_detector.rb +4 -5
- data/lib/tinkerforge/bricklet_multi_touch.rb +4 -5
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +4 -5
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +4 -5
- data/lib/tinkerforge/bricklet_ptc.rb +4 -5
- data/lib/tinkerforge/bricklet_remote_switch.rb +4 -5
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +4 -5
- data/lib/tinkerforge/bricklet_rotary_poti.rb +4 -5
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +5 -6
- data/lib/tinkerforge/bricklet_sound_intensity.rb +4 -5
- data/lib/tinkerforge/bricklet_temperature.rb +4 -5
- data/lib/tinkerforge/bricklet_temperature_ir.rb +4 -5
- data/lib/tinkerforge/bricklet_tilt.rb +4 -5
- data/lib/tinkerforge/bricklet_voltage.rb +4 -5
- data/lib/tinkerforge/bricklet_voltage_current.rb +4 -5
- data/lib/tinkerforge/ip_connection.rb +73 -6
- data/lib/tinkerforge/version.rb +1 -1
- metadata +2 -2
data/lib/tinkerforge/brick_dc.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2014-04-08. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0
|
5
|
+
# Bindings Version 2.1.0 #
|
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 #
|
@@ -309,8 +309,6 @@ module Tinkerforge
|
|
309
309
|
#
|
310
310
|
# This functions sole purpose is to allow automatic flashing of v1.x.y Bricklet
|
311
311
|
# plugins.
|
312
|
-
#
|
313
|
-
# .. versionadded:: 2.0.0~(Firmware)
|
314
312
|
def get_protocol1_bricklet_name(port)
|
315
313
|
send_request(FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'k', 44, 'C C3 Z40')
|
316
314
|
end
|
@@ -321,8 +319,6 @@ module Tinkerforge
|
|
321
319
|
# The temperature is only proportional to the real temperature and it has an
|
322
320
|
# accuracy of +-15%. Practically it is only useful as an indicator for
|
323
321
|
# temperature changes.
|
324
|
-
#
|
325
|
-
# .. versionadded:: 1.1.3~(Firmware)
|
326
322
|
def get_chip_temperature
|
327
323
|
send_request(FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's')
|
328
324
|
end
|
@@ -333,8 +329,6 @@ module Tinkerforge
|
|
333
329
|
# After a reset you have to create new device objects,
|
334
330
|
# calling functions on the existing ones will result in
|
335
331
|
# undefined behavior!
|
336
|
-
#
|
337
|
-
# .. versionadded:: 1.1.3~(Firmware)
|
338
332
|
def reset
|
339
333
|
send_request(FUNCTION_RESET, [], '', 0, '')
|
340
334
|
end
|
@@ -345,9 +339,8 @@ module Tinkerforge
|
|
345
339
|
#
|
346
340
|
# The position can be '0'-'8' (stack position).
|
347
341
|
#
|
348
|
-
# The device
|
349
|
-
#
|
350
|
-
# .. versionadded:: 2.0.0~(Firmware)
|
342
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
343
|
+
# |device_identifier_constant|
|
351
344
|
def get_identity
|
352
345
|
send_request(FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S')
|
353
346
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2014-04-08. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0
|
5
|
+
# Bindings Version 2.1.0 #
|
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 #
|
@@ -172,7 +172,7 @@ module Tinkerforge
|
|
172
172
|
end
|
173
173
|
|
174
174
|
# Returns the calibrated angular velocity from the gyroscope for the
|
175
|
-
# x, y and z axis in °/
|
175
|
+
# x, y and z axis in °/14.375s (you have to divide by 14.375 to
|
176
176
|
# get the value in °/s).
|
177
177
|
#
|
178
178
|
# If you want to get the angular velocity periodically, it is recommended
|
@@ -215,13 +215,21 @@ module Tinkerforge
|
|
215
215
|
#
|
216
216
|
# You can go from quaternions to Euler angles with the following formula::
|
217
217
|
#
|
218
|
-
#
|
219
|
-
#
|
220
|
-
#
|
218
|
+
# xAngle = atan2(2*y*w - 2*x*z, 1 - 2*y*y - 2*z*z)
|
219
|
+
# yAngle = atan2(2*x*w - 2*y*z, 1 - 2*x*x - 2*z*z)
|
220
|
+
# zAngle = asin(2*x*y + 2*z*w)
|
221
221
|
#
|
222
222
|
# This process is not reversible, because of the
|
223
223
|
# `gimbal lock <http://en.wikipedia.org/wiki/Gimbal_lock>`__.
|
224
224
|
#
|
225
|
+
# It is also possible to calculate independent angles. You can calculate
|
226
|
+
# yaw, pitch and roll in a right-handed vehicle coordinate system according to DIN70000
|
227
|
+
# with::
|
228
|
+
#
|
229
|
+
# yaw = atan2(2*x*y + 2*w*z, w*w + x*x - y*y - z*z)
|
230
|
+
# pitch = -asin(2*w*y - 2*x*z)
|
231
|
+
# roll = -atan2(2*y*z + 2*w*x, -w*w + x*x + y*y - z*z))
|
232
|
+
#
|
225
233
|
# Converting the quaternions to an OpenGL transformation matrix is
|
226
234
|
# possible with the following formula::
|
227
235
|
#
|
@@ -337,7 +345,7 @@ module Tinkerforge
|
|
337
345
|
#
|
338
346
|
# The gyroscope bias is highly dependent on the temperature, so you have to
|
339
347
|
# calibrate the bias two times with different temperatures. The values ``xl``,
|
340
|
-
# ``yl``, ``zl
|
348
|
+
# ``yl``, ``zl`` and ``temp l`` are the bias for ``x``, ``y``, ``z`` and the
|
341
349
|
# corresponding temperature for a low temperature. The values ``xh``, ``yh``,
|
342
350
|
# ``zh`` and ``temp h`` are the same for a high temperatures. The temperature
|
343
351
|
# difference should be at least 5°C. If you have a temperature where the
|
@@ -463,8 +471,6 @@ module Tinkerforge
|
|
463
471
|
#
|
464
472
|
# This functions sole purpose is to allow automatic flashing of v1.x.y Bricklet
|
465
473
|
# plugins.
|
466
|
-
#
|
467
|
-
# .. versionadded:: 2.0.0~(Firmware)
|
468
474
|
def get_protocol1_bricklet_name(port)
|
469
475
|
send_request(FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'k', 44, 'C C3 Z40')
|
470
476
|
end
|
@@ -475,8 +481,6 @@ module Tinkerforge
|
|
475
481
|
# The temperature is only proportional to the real temperature and it has an
|
476
482
|
# accuracy of +-15%. Practically it is only useful as an indicator for
|
477
483
|
# temperature changes.
|
478
|
-
#
|
479
|
-
# .. versionadded:: 1.0.7~(Firmware)
|
480
484
|
def get_chip_temperature
|
481
485
|
send_request(FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's')
|
482
486
|
end
|
@@ -487,8 +491,6 @@ module Tinkerforge
|
|
487
491
|
# After a reset you have to create new device objects,
|
488
492
|
# calling functions on the existing ones will result in
|
489
493
|
# undefined behavior!
|
490
|
-
#
|
491
|
-
# .. versionadded:: 1.0.7~(Firmware)
|
492
494
|
def reset
|
493
495
|
send_request(FUNCTION_RESET, [], '', 0, '')
|
494
496
|
end
|
@@ -499,9 +501,8 @@ module Tinkerforge
|
|
499
501
|
#
|
500
502
|
# The position can be '0'-'8' (stack position).
|
501
503
|
#
|
502
|
-
# The device
|
503
|
-
#
|
504
|
-
# .. versionadded:: 2.0.0~(Firmware)
|
504
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
505
|
+
# |device_identifier_constant|
|
505
506
|
def get_identity
|
506
507
|
send_request(FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S')
|
507
508
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2014-04-08. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0
|
5
|
+
# Bindings Version 2.1.0 #
|
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 #
|
@@ -138,6 +138,12 @@ module Tinkerforge
|
|
138
138
|
FUNCTION_GET_ETHERNET_STATUS = 68 # :nodoc:
|
139
139
|
FUNCTION_SET_ETHERNET_HOSTNAME = 69 # :nodoc:
|
140
140
|
FUNCTION_SET_ETHERNET_MAC_ADDRESS = 70 # :nodoc:
|
141
|
+
FUNCTION_SET_ETHERNET_WEBSOCKET_CONFIGURATION = 71 # :nodoc:
|
142
|
+
FUNCTION_GET_ETHERNET_WEBSOCKET_CONFIGURATION = 72 # :nodoc:
|
143
|
+
FUNCTION_SET_ETHERNET_AUTHENTICATION_SECRET = 73 # :nodoc:
|
144
|
+
FUNCTION_GET_ETHERNET_AUTHENTICATION_SECRET = 74 # :nodoc:
|
145
|
+
FUNCTION_SET_WIFI_AUTHENTICATION_SECRET = 75 # :nodoc:
|
146
|
+
FUNCTION_GET_WIFI_AUTHENTICATION_SECRET = 76 # :nodoc:
|
141
147
|
FUNCTION_GET_PROTOCOL1_BRICKLET_NAME = 241 # :nodoc:
|
142
148
|
FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
|
143
149
|
FUNCTION_RESET = 243 # :nodoc:
|
@@ -196,7 +202,7 @@ module Tinkerforge
|
|
196
202
|
def initialize(uid, ipcon)
|
197
203
|
super uid, ipcon
|
198
204
|
|
199
|
-
@api_version = [2, 0,
|
205
|
+
@api_version = [2, 0, 3]
|
200
206
|
|
201
207
|
@response_expected[FUNCTION_GET_STACK_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
202
208
|
@response_expected[FUNCTION_GET_STACK_CURRENT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -268,6 +274,12 @@ module Tinkerforge
|
|
268
274
|
@response_expected[FUNCTION_GET_ETHERNET_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
269
275
|
@response_expected[FUNCTION_SET_ETHERNET_HOSTNAME] = RESPONSE_EXPECTED_FALSE
|
270
276
|
@response_expected[FUNCTION_SET_ETHERNET_MAC_ADDRESS] = RESPONSE_EXPECTED_FALSE
|
277
|
+
@response_expected[FUNCTION_SET_ETHERNET_WEBSOCKET_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
|
278
|
+
@response_expected[FUNCTION_GET_ETHERNET_WEBSOCKET_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
279
|
+
@response_expected[FUNCTION_SET_ETHERNET_AUTHENTICATION_SECRET] = RESPONSE_EXPECTED_FALSE
|
280
|
+
@response_expected[FUNCTION_GET_ETHERNET_AUTHENTICATION_SECRET] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
281
|
+
@response_expected[FUNCTION_SET_WIFI_AUTHENTICATION_SECRET] = RESPONSE_EXPECTED_FALSE
|
282
|
+
@response_expected[FUNCTION_GET_WIFI_AUTHENTICATION_SECRET] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
271
283
|
@response_expected[FUNCTION_GET_PROTOCOL1_BRICKLET_NAME] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
272
284
|
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
273
285
|
@response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
|
@@ -320,8 +332,6 @@ module Tinkerforge
|
|
320
332
|
end
|
321
333
|
|
322
334
|
# Returns *true* if a Chibi Extension is available to be used by the Master Brick.
|
323
|
-
#
|
324
|
-
# .. versionadded:: 1.1.0~(Firmware)
|
325
335
|
def is_chibi_present
|
326
336
|
send_request(FUNCTION_IS_CHIBI_PRESENT, [], '', 1, '?')
|
327
337
|
end
|
@@ -331,15 +341,11 @@ module Tinkerforge
|
|
331
341
|
# It is possible to set the address with the Brick Viewer and it will be
|
332
342
|
# saved in the EEPROM of the Chibi Extension, it does not
|
333
343
|
# have to be set on every startup.
|
334
|
-
#
|
335
|
-
# .. versionadded:: 1.1.0~(Firmware)
|
336
344
|
def set_chibi_address(address)
|
337
345
|
send_request(FUNCTION_SET_CHIBI_ADDRESS, [address], 'C', 0, '')
|
338
346
|
end
|
339
347
|
|
340
348
|
# Returns the address as set by BrickMaster#set_chibi_address.
|
341
|
-
#
|
342
|
-
# .. versionadded:: 1.1.0~(Firmware)
|
343
349
|
def get_chibi_address
|
344
350
|
send_request(FUNCTION_GET_CHIBI_ADDRESS, [], '', 1, 'C')
|
345
351
|
end
|
@@ -350,22 +356,18 @@ module Tinkerforge
|
|
350
356
|
# It is possible to set the address with the Brick Viewer and it will be
|
351
357
|
# saved in the EEPROM of the Chibi Extension, it does not
|
352
358
|
# have to be set on every startup.
|
353
|
-
#
|
354
|
-
# .. versionadded:: 1.1.0~(Firmware)
|
355
359
|
def set_chibi_master_address(address)
|
356
360
|
send_request(FUNCTION_SET_CHIBI_MASTER_ADDRESS, [address], 'C', 0, '')
|
357
361
|
end
|
358
362
|
|
359
363
|
# Returns the address as set by BrickMaster#set_chibi_master_address.
|
360
|
-
#
|
361
|
-
# .. versionadded:: 1.1.0~(Firmware)
|
362
364
|
def get_chibi_master_address
|
363
365
|
send_request(FUNCTION_GET_CHIBI_MASTER_ADDRESS, [], '', 1, 'C')
|
364
366
|
end
|
365
367
|
|
366
368
|
# Sets up to 254 slave addresses. Valid addresses are in range 1-255. 0 has a
|
367
369
|
# special meaning, it is used as list terminator and not allowed as normal slave
|
368
|
-
# address. The address numeration (via
|
370
|
+
# address. The address numeration (via num parameter) has to be used
|
369
371
|
# ascending from 0. For example: If you use the Chibi Extension in Master mode
|
370
372
|
# (i.e. the stack has an USB connection) and you want to talk to three other
|
371
373
|
# Chibi stacks with the slave addresses 17, 23, and 42, you should call with
|
@@ -378,24 +380,18 @@ module Tinkerforge
|
|
378
380
|
#
|
379
381
|
# The slave addresses will be saved in the EEPROM of the Chibi Extension, they
|
380
382
|
# don't have to be set on every startup.
|
381
|
-
#
|
382
|
-
# .. versionadded:: 1.1.0~(Firmware)
|
383
383
|
def set_chibi_slave_address(num, address)
|
384
384
|
send_request(FUNCTION_SET_CHIBI_SLAVE_ADDRESS, [num, address], 'C C', 0, '')
|
385
385
|
end
|
386
386
|
|
387
|
-
# Returns the slave address for a given
|
387
|
+
# Returns the slave address for a given num as set by
|
388
388
|
# BrickMaster#set_chibi_slave_address.
|
389
|
-
#
|
390
|
-
# .. versionadded:: 1.1.0~(Firmware)
|
391
389
|
def get_chibi_slave_address(num)
|
392
390
|
send_request(FUNCTION_GET_CHIBI_SLAVE_ADDRESS, [num], 'C', 1, 'C')
|
393
391
|
end
|
394
392
|
|
395
393
|
# Returns the signal strength in dBm. The signal strength updates every time a
|
396
394
|
# packet is received.
|
397
|
-
#
|
398
|
-
# .. versionadded:: 1.1.0~(Firmware)
|
399
395
|
def get_chibi_signal_strength
|
400
396
|
send_request(FUNCTION_GET_CHIBI_SIGNAL_STRENGTH, [], '', 1, 'C')
|
401
397
|
end
|
@@ -404,8 +400,6 @@ module Tinkerforge
|
|
404
400
|
# communication. If these errors start rising, it is likely that either the
|
405
401
|
# distance between two Chibi stacks is becoming too big or there are
|
406
402
|
# interferences.
|
407
|
-
#
|
408
|
-
# .. versionadded:: 1.1.0~(Firmware)
|
409
403
|
def get_chibi_error_log
|
410
404
|
send_request(FUNCTION_GET_CHIBI_ERROR_LOG, [], '', 8, 'S S S S')
|
411
405
|
end
|
@@ -422,15 +416,11 @@ module Tinkerforge
|
|
422
416
|
# It is possible to set the frequency with the Brick Viewer and it will be
|
423
417
|
# saved in the EEPROM of the Chibi Extension, it does not
|
424
418
|
# have to be set on every startup.
|
425
|
-
#
|
426
|
-
# .. versionadded:: 1.1.0~(Firmware)
|
427
419
|
def set_chibi_frequency(frequency)
|
428
420
|
send_request(FUNCTION_SET_CHIBI_FREQUENCY, [frequency], 'C', 0, '')
|
429
421
|
end
|
430
422
|
|
431
423
|
# Returns the frequency value as set by BrickMaster#set_chibi_frequency.
|
432
|
-
#
|
433
|
-
# .. versionadded:: 1.1.0~(Firmware)
|
434
424
|
def get_chibi_frequency
|
435
425
|
send_request(FUNCTION_GET_CHIBI_FREQUENCY, [], '', 1, 'C')
|
436
426
|
end
|
@@ -448,22 +438,16 @@ module Tinkerforge
|
|
448
438
|
# It is possible to set the channel with the Brick Viewer and it will be
|
449
439
|
# saved in the EEPROM of the Chibi Extension, it does not
|
450
440
|
# have to be set on every startup.
|
451
|
-
#
|
452
|
-
# .. versionadded:: 1.1.0~(Firmware)
|
453
441
|
def set_chibi_channel(channel)
|
454
442
|
send_request(FUNCTION_SET_CHIBI_CHANNEL, [channel], 'C', 0, '')
|
455
443
|
end
|
456
444
|
|
457
445
|
# Returns the channel as set by BrickMaster#set_chibi_channel.
|
458
|
-
#
|
459
|
-
# .. versionadded:: 1.1.0~(Firmware)
|
460
446
|
def get_chibi_channel
|
461
447
|
send_request(FUNCTION_GET_CHIBI_CHANNEL, [], '', 1, 'C')
|
462
448
|
end
|
463
449
|
|
464
450
|
# Returns *true* if a RS485 Extension is available to be used by the Master Brick.
|
465
|
-
#
|
466
|
-
# .. versionadded:: 1.2.0~(Firmware)
|
467
451
|
def is_rs485_present
|
468
452
|
send_request(FUNCTION_IS_RS485_PRESENT, [], '', 1, '?')
|
469
453
|
end
|
@@ -476,15 +460,11 @@ module Tinkerforge
|
|
476
460
|
# It is possible to set the address with the Brick Viewer and it will be
|
477
461
|
# saved in the EEPROM of the RS485 Extension, it does not
|
478
462
|
# have to be set on every startup.
|
479
|
-
#
|
480
|
-
# .. versionadded:: 1.2.0~(Firmware)
|
481
463
|
def set_rs485_address(address)
|
482
464
|
send_request(FUNCTION_SET_RS485_ADDRESS, [address], 'C', 0, '')
|
483
465
|
end
|
484
466
|
|
485
467
|
# Returns the address as set by BrickMaster#set_rs485_address.
|
486
|
-
#
|
487
|
-
# .. versionadded:: 1.2.0~(Firmware)
|
488
468
|
def get_rs485_address
|
489
469
|
send_request(FUNCTION_GET_RS485_ADDRESS, [], '', 1, 'C')
|
490
470
|
end
|
@@ -504,16 +484,12 @@ module Tinkerforge
|
|
504
484
|
#
|
505
485
|
# The slave addresses will be saved in the EEPROM of the Chibi Extension, they
|
506
486
|
# don't have to be set on every startup.
|
507
|
-
#
|
508
|
-
# .. versionadded:: 1.2.0~(Firmware)
|
509
487
|
def set_rs485_slave_address(num, address)
|
510
488
|
send_request(FUNCTION_SET_RS485_SLAVE_ADDRESS, [num, address], 'C C', 0, '')
|
511
489
|
end
|
512
490
|
|
513
491
|
# Returns the slave address for a given ``num`` as set by
|
514
492
|
# BrickMaster#set_rs485_slave_address.
|
515
|
-
#
|
516
|
-
# .. versionadded:: 1.2.0~(Firmware)
|
517
493
|
def get_rs485_slave_address(num)
|
518
494
|
send_request(FUNCTION_GET_RS485_SLAVE_ADDRESS, [num], 'C', 1, 'C')
|
519
495
|
end
|
@@ -522,8 +498,6 @@ module Tinkerforge
|
|
522
498
|
# If this counter starts rising, it is likely that the distance
|
523
499
|
# between the RS485 nodes is too big or there is some kind of
|
524
500
|
# interference.
|
525
|
-
#
|
526
|
-
# .. versionadded:: 1.2.0~(Firmware)
|
527
501
|
def get_rs485_error_log
|
528
502
|
send_request(FUNCTION_GET_RS485_ERROR_LOG, [], '', 2, 'S')
|
529
503
|
end
|
@@ -540,22 +514,16 @@ module Tinkerforge
|
|
540
514
|
#
|
541
515
|
# The values are stored in the EEPROM and only applied on startup. That means
|
542
516
|
# you have to restart the Master Brick after configuration.
|
543
|
-
#
|
544
|
-
# .. versionadded:: 1.2.0~(Firmware)
|
545
517
|
def set_rs485_configuration(speed, parity, stopbits)
|
546
518
|
send_request(FUNCTION_SET_RS485_CONFIGURATION, [speed, parity, stopbits], 'L k C', 0, '')
|
547
519
|
end
|
548
520
|
|
549
521
|
# Returns the configuration as set by BrickMaster#set_rs485_configuration.
|
550
|
-
#
|
551
|
-
# .. versionadded:: 1.2.0~(Firmware)
|
552
522
|
def get_rs485_configuration
|
553
523
|
send_request(FUNCTION_GET_RS485_CONFIGURATION, [], '', 6, 'L k C')
|
554
524
|
end
|
555
525
|
|
556
526
|
# Returns *true* if a WIFI Extension is available to be used by the Master Brick.
|
557
|
-
#
|
558
|
-
# .. versionadded:: 1.2.0~(Firmware)
|
559
527
|
def is_wifi_present
|
560
528
|
send_request(FUNCTION_IS_WIFI_PRESENT, [], '', 1, '?')
|
561
529
|
end
|
@@ -585,15 +553,11 @@ module Tinkerforge
|
|
585
553
|
# you have to restart the Master Brick after configuration.
|
586
554
|
#
|
587
555
|
# It is recommended to use the Brick Viewer to set the WIFI configuration.
|
588
|
-
#
|
589
|
-
# .. versionadded:: 1.3.0~(Firmware)
|
590
556
|
def set_wifi_configuration(ssid, connection, ip, subnet_mask, gateway, port)
|
591
557
|
send_request(FUNCTION_SET_WIFI_CONFIGURATION, [ssid, connection, ip, subnet_mask, gateway, port], 'Z32 C C4 C4 C4 S', 0, '')
|
592
558
|
end
|
593
559
|
|
594
560
|
# Returns the configuration as set by BrickMaster#set_wifi_configuration.
|
595
|
-
#
|
596
|
-
# .. versionadded:: 1.3.0~(Firmware)
|
597
561
|
def get_wifi_configuration
|
598
562
|
send_request(FUNCTION_GET_WIFI_CONFIGURATION, [], '', 47, 'Z32 C C4 C4 C4 S')
|
599
563
|
end
|
@@ -637,15 +601,11 @@ module Tinkerforge
|
|
637
601
|
# you have to restart the Master Brick after configuration.
|
638
602
|
#
|
639
603
|
# It is recommended to use the Brick Viewer to set the WIFI encryption.
|
640
|
-
#
|
641
|
-
# .. versionadded:: 1.3.0~(Firmware)
|
642
604
|
def set_wifi_encryption(encryption, key, key_index, eap_options, ca_certificate_length, client_certificate_length, private_key_length)
|
643
605
|
send_request(FUNCTION_SET_WIFI_ENCRYPTION, [encryption, key, key_index, eap_options, ca_certificate_length, client_certificate_length, private_key_length], 'C Z50 C C S S S', 0, '')
|
644
606
|
end
|
645
607
|
|
646
608
|
# Returns the encryption as set by BrickMaster#set_wifi_encryption.
|
647
|
-
#
|
648
|
-
# .. versionadded:: 1.3.0~(Firmware)
|
649
609
|
def get_wifi_encryption
|
650
610
|
send_request(FUNCTION_GET_WIFI_ENCRYPTION, [], '', 59, 'C Z50 C C S S S')
|
651
611
|
end
|
@@ -663,8 +623,6 @@ module Tinkerforge
|
|
663
623
|
# "2", "Associating"
|
664
624
|
# "3", "Error"
|
665
625
|
# "255", "Not initialized yet"
|
666
|
-
#
|
667
|
-
# .. versionadded:: 1.3.0~(Firmware)
|
668
626
|
def get_wifi_status
|
669
627
|
send_request(FUNCTION_GET_WIFI_STATUS, [], '', 36, 'C6 C6 C s C4 C4 C4 L L C')
|
670
628
|
end
|
@@ -675,8 +633,6 @@ module Tinkerforge
|
|
675
633
|
# unfortunately time consuming. This means, that it might take some ms
|
676
634
|
# until the stack with attached WIFI Extension reacts again after this
|
677
635
|
# function is called.
|
678
|
-
#
|
679
|
-
# .. versionadded:: 1.3.0~(Firmware)
|
680
636
|
def refresh_wifi_status
|
681
637
|
send_request(FUNCTION_REFRESH_WIFI_STATUS, [], '', 0, '')
|
682
638
|
end
|
@@ -699,15 +655,11 @@ module Tinkerforge
|
|
699
655
|
#
|
700
656
|
# It is recommended to use the Brick Viewer to set the certificate, username
|
701
657
|
# and password.
|
702
|
-
#
|
703
|
-
# .. versionadded:: 1.3.0~(Firmware)
|
704
658
|
def set_wifi_certificate(index, data, data_length)
|
705
659
|
send_request(FUNCTION_SET_WIFI_CERTIFICATE, [index, data, data_length], 'S C32 C', 0, '')
|
706
660
|
end
|
707
661
|
|
708
662
|
# Returns the certificate for a given index as set by BrickMaster#set_wifi_certificate.
|
709
|
-
#
|
710
|
-
# .. versionadded:: 1.3.0~(Firmware)
|
711
663
|
def get_wifi_certificate(index)
|
712
664
|
send_request(FUNCTION_GET_WIFI_CERTIFICATE, [index], 'S', 33, 'C32 C')
|
713
665
|
end
|
@@ -720,15 +672,11 @@ module Tinkerforge
|
|
720
672
|
# "1", "Low Power (low power consumption, low throughput)"
|
721
673
|
#
|
722
674
|
# The default value is 0 (Full Speed).
|
723
|
-
#
|
724
|
-
# .. versionadded:: 1.3.0~(Firmware)
|
725
675
|
def set_wifi_power_mode(mode)
|
726
676
|
send_request(FUNCTION_SET_WIFI_POWER_MODE, [mode], 'C', 0, '')
|
727
677
|
end
|
728
678
|
|
729
679
|
# Returns the power mode as set by BrickMaster#set_wifi_power_mode.
|
730
|
-
#
|
731
|
-
# .. versionadded:: 1.3.0~(Firmware)
|
732
680
|
def get_wifi_power_mode
|
733
681
|
send_request(FUNCTION_GET_WIFI_POWER_MODE, [], '', 1, 'C')
|
734
682
|
end
|
@@ -747,8 +695,6 @@ module Tinkerforge
|
|
747
695
|
#
|
748
696
|
# Try to not send more then 50 messages at a time without any kind of
|
749
697
|
# break between them.
|
750
|
-
#
|
751
|
-
# .. versionadded:: 1.3.2~(Firmware)
|
752
698
|
def get_wifi_buffer_info
|
753
699
|
send_request(FUNCTION_GET_WIFI_BUFFER_INFO, [], '', 8, 'L S S')
|
754
700
|
end
|
@@ -762,22 +708,16 @@ module Tinkerforge
|
|
762
708
|
# "2", "TELEC: Channel 1-14 (Japan)"
|
763
709
|
#
|
764
710
|
# The default value is 1 (ETSI).
|
765
|
-
#
|
766
|
-
# .. versionadded:: 1.3.4~(Firmware)
|
767
711
|
def set_wifi_regulatory_domain(domain)
|
768
712
|
send_request(FUNCTION_SET_WIFI_REGULATORY_DOMAIN, [domain], 'C', 0, '')
|
769
713
|
end
|
770
714
|
|
771
715
|
# Returns the regulatory domain as set by BrickMaster#set_wifi_regulatory_domain.
|
772
|
-
#
|
773
|
-
# .. versionadded:: 1.3.4~(Firmware)
|
774
716
|
def get_wifi_regulatory_domain
|
775
717
|
send_request(FUNCTION_GET_WIFI_REGULATORY_DOMAIN, [], '', 1, 'C')
|
776
718
|
end
|
777
719
|
|
778
720
|
# Returns the USB voltage in mV.
|
779
|
-
#
|
780
|
-
# .. versionadded:: 1.3.5~(Firmware)
|
781
721
|
def get_usb_voltage
|
782
722
|
send_request(FUNCTION_GET_USB_VOLTAGE, [], '', 2, 'S')
|
783
723
|
end
|
@@ -1067,13 +1007,88 @@ module Tinkerforge
|
|
1067
1007
|
send_request(FUNCTION_SET_ETHERNET_MAC_ADDRESS, [mac_address], 'C6', 0, '')
|
1068
1008
|
end
|
1069
1009
|
|
1010
|
+
# Sets the Ethernet WebSocket configuration. The first parameter sets the number of socket
|
1011
|
+
# connections that are reserved for WebSockets. The range is 0-7. The connections
|
1012
|
+
# are shared with the plain sockets. Example: If you set the connections to 3,
|
1013
|
+
# there will be 3 WebSocket and 4 plain socket connections available.
|
1014
|
+
#
|
1015
|
+
# The second parameter is the port for the WebSocket connections. The port can
|
1016
|
+
# not be the same as the port for the plain socket connections.
|
1017
|
+
#
|
1018
|
+
# The values are stored in the EEPROM and only applied on startup. That means
|
1019
|
+
# you have to restart the Master Brick after configuration.
|
1020
|
+
#
|
1021
|
+
# It is recommended to use the Brick Viewer to set the Ethernet configuration.
|
1022
|
+
#
|
1023
|
+
# The default values are 3 for the socket connections and 4280 for the port.
|
1024
|
+
#
|
1025
|
+
# .. versionadded:: 2.2.0~(Firmware)
|
1026
|
+
def set_ethernet_websocket_configuration(sockets, port)
|
1027
|
+
send_request(FUNCTION_SET_ETHERNET_WEBSOCKET_CONFIGURATION, [sockets, port], 'C S', 0, '')
|
1028
|
+
end
|
1029
|
+
|
1030
|
+
# Returns the configuration as set by BrickMaster#set_ethernet_configuration.
|
1031
|
+
#
|
1032
|
+
# .. versionadded:: 2.2.0~(Firmware)
|
1033
|
+
def get_ethernet_websocket_configuration
|
1034
|
+
send_request(FUNCTION_GET_ETHERNET_WEBSOCKET_CONFIGURATION, [], '', 3, 'C S')
|
1035
|
+
end
|
1036
|
+
|
1037
|
+
# Sets the Ethernet authentication secret. The secret can be a string of up to 64
|
1038
|
+
# characters. An empty string disables the authentication.
|
1039
|
+
#
|
1040
|
+
# See the :ref:`authentication tutorial <tutorial_authentication>` for more
|
1041
|
+
# information.
|
1042
|
+
#
|
1043
|
+
# The secret is stored in the EEPROM and only applied on startup. That means
|
1044
|
+
# you have to restart the Master Brick after configuration.
|
1045
|
+
#
|
1046
|
+
# It is recommended to use the Brick Viewer to set the Ethernet authentication secret.
|
1047
|
+
#
|
1048
|
+
# The default value is an empty string (authentication disabled).
|
1049
|
+
#
|
1050
|
+
# .. versionadded:: 2.2.0~(Firmware)
|
1051
|
+
def set_ethernet_authentication_secret(secret)
|
1052
|
+
send_request(FUNCTION_SET_ETHERNET_AUTHENTICATION_SECRET, [secret], 'Z64', 0, '')
|
1053
|
+
end
|
1054
|
+
|
1055
|
+
# Returns the authentication secret as set by BrickMaster#set_ethernet_authentication_secret.
|
1056
|
+
#
|
1057
|
+
# .. versionadded:: 2.2.0~(Firmware)
|
1058
|
+
def get_ethernet_authentication_secret
|
1059
|
+
send_request(FUNCTION_GET_ETHERNET_AUTHENTICATION_SECRET, [], '', 64, 'Z64')
|
1060
|
+
end
|
1061
|
+
|
1062
|
+
# Sets the WIFI authentication secret. The secret can be a string of up to 64
|
1063
|
+
# characters. An empty string disables the authentication.
|
1064
|
+
#
|
1065
|
+
# See the :ref:`authentication tutorial <tutorial_authentication>` for more
|
1066
|
+
# information.
|
1067
|
+
#
|
1068
|
+
# The secret is stored in the EEPROM and only applied on startup. That means
|
1069
|
+
# you have to restart the Master Brick after configuration.
|
1070
|
+
#
|
1071
|
+
# It is recommended to use the Brick Viewer to set the WIFI authentication secret.
|
1072
|
+
#
|
1073
|
+
# The default value is an empty string (authentication disabled).
|
1074
|
+
#
|
1075
|
+
# .. versionadded:: 2.2.0~(Firmware)
|
1076
|
+
def set_wifi_authentication_secret(secret)
|
1077
|
+
send_request(FUNCTION_SET_WIFI_AUTHENTICATION_SECRET, [secret], 'Z64', 0, '')
|
1078
|
+
end
|
1079
|
+
|
1080
|
+
# Returns the authentication secret as set by BrickMaster#set_wifi_authentication_secret.
|
1081
|
+
#
|
1082
|
+
# .. versionadded:: 2.2.0~(Firmware)
|
1083
|
+
def get_wifi_authentication_secret
|
1084
|
+
send_request(FUNCTION_GET_WIFI_AUTHENTICATION_SECRET, [], '', 64, 'Z64')
|
1085
|
+
end
|
1086
|
+
|
1070
1087
|
# Returns the firmware and protocol version and the name of the Bricklet for a
|
1071
1088
|
# given port.
|
1072
1089
|
#
|
1073
1090
|
# This functions sole purpose is to allow automatic flashing of v1.x.y Bricklet
|
1074
1091
|
# plugins.
|
1075
|
-
#
|
1076
|
-
# .. versionadded:: 2.0.0~(Firmware)
|
1077
1092
|
def get_protocol1_bricklet_name(port)
|
1078
1093
|
send_request(FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'k', 44, 'C C3 Z40')
|
1079
1094
|
end
|
@@ -1084,8 +1099,6 @@ module Tinkerforge
|
|
1084
1099
|
# The temperature is only proportional to the real temperature and it has an
|
1085
1100
|
# accuracy of +-15%. Practically it is only useful as an indicator for
|
1086
1101
|
# temperature changes.
|
1087
|
-
#
|
1088
|
-
# .. versionadded:: 1.2.1~(Firmware)
|
1089
1102
|
def get_chip_temperature
|
1090
1103
|
send_request(FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's')
|
1091
1104
|
end
|
@@ -1096,8 +1109,6 @@ module Tinkerforge
|
|
1096
1109
|
# After a reset you have to create new device objects,
|
1097
1110
|
# calling functions on the existing ones will result in
|
1098
1111
|
# undefined behavior!
|
1099
|
-
#
|
1100
|
-
# .. versionadded:: 1.2.1~(Firmware)
|
1101
1112
|
def reset
|
1102
1113
|
send_request(FUNCTION_RESET, [], '', 0, '')
|
1103
1114
|
end
|
@@ -1108,9 +1119,8 @@ module Tinkerforge
|
|
1108
1119
|
#
|
1109
1120
|
# The position can be '0'-'8' (stack position).
|
1110
1121
|
#
|
1111
|
-
# The device
|
1112
|
-
#
|
1113
|
-
# .. versionadded:: 2.0.0~(Firmware)
|
1122
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
1123
|
+
# |device_identifier_constant|
|
1114
1124
|
def get_identity
|
1115
1125
|
send_request(FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S')
|
1116
1126
|
end
|