tinkerforge 2.1.24 → 2.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +155 -74
  3. data/lib/tinkerforge/brick_hat.rb +70 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +56 -22
  5. data/lib/tinkerforge/brick_imu.rb +184 -77
  6. data/lib/tinkerforge/brick_imu_v2.rb +208 -105
  7. data/lib/tinkerforge/brick_master.rb +484 -182
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +185 -101
  10. data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
  11. data/lib/tinkerforge/brick_stepper.rb +210 -98
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
  18. data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +66 -26
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -18
  27. data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +34 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
  30. data/lib/tinkerforge/bricklet_color.rb +69 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +78 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +58 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +58 -24
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
  37. data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
  39. data/lib/tinkerforge/bricklet_dmx.rb +88 -34
  40. data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
  46. data/lib/tinkerforge/bricklet_gps.rb +64 -26
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
  50. data/lib/tinkerforge/bricklet_humidity.rb +51 -21
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
  52. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
  53. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
  54. data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
  55. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
  57. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
  59. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
  62. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
  64. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
  65. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
  66. data/lib/tinkerforge/bricklet_io16.rb +55 -21
  67. data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
  68. data/lib/tinkerforge/bricklet_io4.rb +55 -23
  69. data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
  70. data/lib/tinkerforge/bricklet_isolator.rb +72 -28
  71. data/lib/tinkerforge/bricklet_joystick.rb +59 -25
  72. data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
  73. data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
  74. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
  75. data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
  76. data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
  77. data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
  78. data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
  79. data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
  80. data/lib/tinkerforge/bricklet_line.rb +34 -14
  81. data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
  82. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
  83. data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
  84. data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
  85. data/lib/tinkerforge/bricklet_moisture.rb +40 -16
  86. data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
  87. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
  88. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
  89. data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
  90. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
  91. data/lib/tinkerforge/bricklet_nfc.rb +123 -58
  92. data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
  93. data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
  94. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
  95. data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
  96. data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
  97. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
  98. data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
  99. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
  100. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
  101. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
  102. data/lib/tinkerforge/bricklet_ptc.rb +74 -42
  103. data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
  104. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
  105. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
  106. data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
  107. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
  108. data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
  109. data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
  110. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
  111. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
  112. data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
  113. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
  114. data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
  115. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
  116. data/lib/tinkerforge/bricklet_rs232.rb +90 -28
  117. data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
  118. data/lib/tinkerforge/bricklet_rs485.rb +223 -95
  119. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
  120. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
  121. data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
  122. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
  123. data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
  124. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
  125. data/lib/tinkerforge/bricklet_temperature.rb +40 -16
  126. data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
  127. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
  128. data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
  129. data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
  130. data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
  131. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
  132. data/lib/tinkerforge/bricklet_tilt.rb +24 -10
  133. data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
  134. data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
  135. data/lib/tinkerforge/bricklet_voltage.rb +52 -28
  136. data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
  137. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
  138. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
  139. data/lib/tinkerforge/device_display_names.rb +163 -0
  140. data/lib/tinkerforge/ip_connection.rb +151 -32
  141. data/lib/tinkerforge/version.rb +1 -1
  142. metadata +3 -2
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
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
  # Basis to build stacks and has 4 Bricklet ports
14
16
  class BrickMaster < Device
@@ -37,7 +39,7 @@ module Tinkerforge
37
39
 
38
40
  # This callback is triggered periodically with the period that is set by
39
41
  # BrickMaster#set_usb_voltage_callback_period. The parameter is the USB
40
- # voltage in mV.
42
+ # voltage.
41
43
  #
42
44
  # The CALLBACK_USB_VOLTAGE callback is only triggered if the USB voltage has changed
43
45
  # since the last triggering.
@@ -49,7 +51,7 @@ module Tinkerforge
49
51
 
50
52
  # This callback is triggered when the threshold as set by
51
53
  # BrickMaster#set_stack_current_callback_threshold is reached.
52
- # The parameter is the stack current in mA.
54
+ # The parameter is the stack current.
53
55
  #
54
56
  # If the threshold keeps being reached, the callback is triggered periodically
55
57
  # with the period as set by BrickMaster#set_debounce_period.
@@ -59,7 +61,7 @@ module Tinkerforge
59
61
 
60
62
  # This callback is triggered when the threshold as set by
61
63
  # BrickMaster#set_stack_voltage_callback_threshold is reached.
62
- # The parameter is the stack voltage in mV.
64
+ # The parameter is the stack voltage.
63
65
  #
64
66
  # If the threshold keeps being reached, the callback is triggered periodically
65
67
  # with the period as set by BrickMaster#set_debounce_period.
@@ -181,6 +183,10 @@ module Tinkerforge
181
183
  FUNCTION_GET_WIFI2_MESH_COMMON_STATUS = 108 # :nodoc:
182
184
  FUNCTION_GET_WIFI2_MESH_CLIENT_STATUS = 109 # :nodoc:
183
185
  FUNCTION_GET_WIFI2_MESH_AP_STATUS = 110 # :nodoc:
186
+ FUNCTION_SET_BRICKLET_XMC_FLASH_CONFIG = 111 # :nodoc:
187
+ FUNCTION_SET_BRICKLET_XMC_FLASH_DATA = 112 # :nodoc:
188
+ FUNCTION_SET_BRICKLETS_ENABLED = 113 # :nodoc:
189
+ FUNCTION_GET_BRICKLETS_ENABLED = 114 # :nodoc:
184
190
  FUNCTION_SET_SPITFP_BAUDRATE_CONFIG = 231 # :nodoc:
185
191
  FUNCTION_GET_SPITFP_BAUDRATE_CONFIG = 232 # :nodoc:
186
192
  FUNCTION_GET_SEND_TIMEOUT_COUNT = 233 # :nodoc:
@@ -193,6 +199,8 @@ module Tinkerforge
193
199
  FUNCTION_GET_PROTOCOL1_BRICKLET_NAME = 241 # :nodoc:
194
200
  FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
195
201
  FUNCTION_RESET = 243 # :nodoc:
202
+ FUNCTION_WRITE_BRICKLET_PLUGIN = 246 # :nodoc:
203
+ FUNCTION_READ_BRICKLET_PLUGIN = 247 # :nodoc:
196
204
  FUNCTION_GET_IDENTITY = 255 # :nodoc:
197
205
 
198
206
  EXTENSION_TYPE_CHIBI = 1 # :nodoc:
@@ -286,9 +294,9 @@ module Tinkerforge
286
294
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
287
295
  # the IP Connection <tt>ipcon</tt>.
288
296
  def initialize(uid, ipcon)
289
- super uid, ipcon
297
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
290
298
 
291
- @api_version = [2, 0, 9]
299
+ @api_version = [2, 0, 10]
292
300
 
293
301
  @response_expected[FUNCTION_GET_STACK_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
294
302
  @response_expected[FUNCTION_GET_STACK_CURRENT] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -394,6 +402,10 @@ module Tinkerforge
394
402
  @response_expected[FUNCTION_GET_WIFI2_MESH_COMMON_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
395
403
  @response_expected[FUNCTION_GET_WIFI2_MESH_CLIENT_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
396
404
  @response_expected[FUNCTION_GET_WIFI2_MESH_AP_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
405
+ @response_expected[FUNCTION_SET_BRICKLET_XMC_FLASH_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
406
+ @response_expected[FUNCTION_SET_BRICKLET_XMC_FLASH_DATA] = RESPONSE_EXPECTED_ALWAYS_TRUE
407
+ @response_expected[FUNCTION_SET_BRICKLETS_ENABLED] = RESPONSE_EXPECTED_FALSE
408
+ @response_expected[FUNCTION_GET_BRICKLETS_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
397
409
  @response_expected[FUNCTION_SET_SPITFP_BAUDRATE_CONFIG] = RESPONSE_EXPECTED_FALSE
398
410
  @response_expected[FUNCTION_GET_SPITFP_BAUDRATE_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
399
411
  @response_expected[FUNCTION_GET_SEND_TIMEOUT_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -406,33 +418,40 @@ module Tinkerforge
406
418
  @response_expected[FUNCTION_GET_PROTOCOL1_BRICKLET_NAME] = RESPONSE_EXPECTED_ALWAYS_TRUE
407
419
  @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
408
420
  @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
421
+ @response_expected[FUNCTION_WRITE_BRICKLET_PLUGIN] = RESPONSE_EXPECTED_FALSE
422
+ @response_expected[FUNCTION_READ_BRICKLET_PLUGIN] = RESPONSE_EXPECTED_ALWAYS_TRUE
409
423
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
410
424
 
411
- @callback_formats[CALLBACK_STACK_CURRENT] = 'S'
412
- @callback_formats[CALLBACK_STACK_VOLTAGE] = 'S'
413
- @callback_formats[CALLBACK_USB_VOLTAGE] = 'S'
414
- @callback_formats[CALLBACK_STACK_CURRENT_REACHED] = 'S'
415
- @callback_formats[CALLBACK_STACK_VOLTAGE_REACHED] = 'S'
416
- @callback_formats[CALLBACK_USB_VOLTAGE_REACHED] = 'S'
425
+ @callback_formats[CALLBACK_STACK_CURRENT] = [10, 'S']
426
+ @callback_formats[CALLBACK_STACK_VOLTAGE] = [10, 'S']
427
+ @callback_formats[CALLBACK_USB_VOLTAGE] = [10, 'S']
428
+ @callback_formats[CALLBACK_STACK_CURRENT_REACHED] = [10, 'S']
429
+ @callback_formats[CALLBACK_STACK_VOLTAGE_REACHED] = [10, 'S']
430
+ @callback_formats[CALLBACK_USB_VOLTAGE_REACHED] = [10, 'S']
417
431
 
432
+ @ipcon.add_device self
418
433
  end
419
434
 
420
- # Returns the stack voltage in mV. The stack voltage is the
435
+ # Returns the stack voltage. The stack voltage is the
421
436
  # voltage that is supplied via the stack, i.e. it is given by a
422
437
  # Step-Down or Step-Up Power Supply.
423
438
  def get_stack_voltage
424
- send_request FUNCTION_GET_STACK_VOLTAGE, [], '', 2, 'S'
439
+ check_validity
440
+
441
+ send_request FUNCTION_GET_STACK_VOLTAGE, [], '', 10, 'S'
425
442
  end
426
443
 
427
- # Returns the stack current in mA. The stack current is the
444
+ # Returns the stack current. The stack current is the
428
445
  # current that is drawn via the stack, i.e. it is given by a
429
446
  # Step-Down or Step-Up Power Supply.
430
447
  def get_stack_current
431
- send_request FUNCTION_GET_STACK_CURRENT, [], '', 2, 'S'
448
+ check_validity
449
+
450
+ send_request FUNCTION_GET_STACK_CURRENT, [], '', 10, 'S'
432
451
  end
433
452
 
434
453
  # Writes the extension type to the EEPROM of a specified extension.
435
- # The extension is either 0 or 1 (0 is the on the bottom, 1 is the one on top,
454
+ # The extension is either 0 or 1 (0 is the lower one, 1 is the upper one,
436
455
  # if only one extension is present use 0).
437
456
  #
438
457
  # Possible extension types:
@@ -448,50 +467,64 @@ module Tinkerforge
448
467
  # The extension type is already set when bought and it can be set with the
449
468
  # Brick Viewer, it is unlikely that you need this function.
450
469
  def set_extension_type(extension, exttype)
451
- send_request FUNCTION_SET_EXTENSION_TYPE, [extension, exttype], 'C L', 0, ''
470
+ check_validity
471
+
472
+ send_request FUNCTION_SET_EXTENSION_TYPE, [extension, exttype], 'C L', 8, ''
452
473
  end
453
474
 
454
475
  # Returns the type for a given extension as set by BrickMaster#set_extension_type.
455
476
  def get_extension_type(extension)
456
- send_request FUNCTION_GET_EXTENSION_TYPE, [extension], 'C', 4, 'L'
477
+ check_validity
478
+
479
+ send_request FUNCTION_GET_EXTENSION_TYPE, [extension], 'C', 12, 'L'
457
480
  end
458
481
 
459
482
  # Returns *true* if the Master Brick is at position 0 in the stack and a Chibi
460
483
  # Extension is available.
461
484
  def is_chibi_present
462
- send_request FUNCTION_IS_CHIBI_PRESENT, [], '', 1, '?'
485
+ check_validity
486
+
487
+ send_request FUNCTION_IS_CHIBI_PRESENT, [], '', 9, '?'
463
488
  end
464
489
 
465
- # Sets the address (1-255) belonging to the Chibi Extension.
490
+ # Sets the address belonging to the Chibi Extension.
466
491
  #
467
492
  # It is possible to set the address with the Brick Viewer and it will be
468
493
  # saved in the EEPROM of the Chibi Extension, it does not
469
494
  # have to be set on every startup.
470
495
  def set_chibi_address(address)
471
- send_request FUNCTION_SET_CHIBI_ADDRESS, [address], 'C', 0, ''
496
+ check_validity
497
+
498
+ send_request FUNCTION_SET_CHIBI_ADDRESS, [address], 'C', 8, ''
472
499
  end
473
500
 
474
501
  # Returns the address as set by BrickMaster#set_chibi_address.
475
502
  def get_chibi_address
476
- send_request FUNCTION_GET_CHIBI_ADDRESS, [], '', 1, 'C'
503
+ check_validity
504
+
505
+ send_request FUNCTION_GET_CHIBI_ADDRESS, [], '', 9, 'C'
477
506
  end
478
507
 
479
- # Sets the address (1-255) of the Chibi Master. This address is used if the
508
+ # Sets the address of the Chibi Master. This address is used if the
480
509
  # Chibi Extension is used as slave (i.e. it does not have a USB connection).
481
510
  #
482
511
  # It is possible to set the address with the Brick Viewer and it will be
483
512
  # saved in the EEPROM of the Chibi Extension, it does not
484
513
  # have to be set on every startup.
485
514
  def set_chibi_master_address(address)
486
- send_request FUNCTION_SET_CHIBI_MASTER_ADDRESS, [address], 'C', 0, ''
515
+ check_validity
516
+
517
+ send_request FUNCTION_SET_CHIBI_MASTER_ADDRESS, [address], 'C', 8, ''
487
518
  end
488
519
 
489
520
  # Returns the address as set by BrickMaster#set_chibi_master_address.
490
521
  def get_chibi_master_address
491
- send_request FUNCTION_GET_CHIBI_MASTER_ADDRESS, [], '', 1, 'C'
522
+ check_validity
523
+
524
+ send_request FUNCTION_GET_CHIBI_MASTER_ADDRESS, [], '', 9, 'C'
492
525
  end
493
526
 
494
- # Sets up to 254 slave addresses. Valid addresses are in range 1-255. 0 has a
527
+ # Sets up to 254 slave addresses. 0 has a
495
528
  # special meaning, it is used as list terminator and not allowed as normal slave
496
529
  # address. The address numeration (via num parameter) has to be used
497
530
  # ascending from 0. For example: If you use the Chibi Extension in Master mode
@@ -507,19 +540,25 @@ module Tinkerforge
507
540
  # The slave addresses will be saved in the EEPROM of the Chibi Extension, they
508
541
  # don't have to be set on every startup.
509
542
  def set_chibi_slave_address(num, address)
510
- send_request FUNCTION_SET_CHIBI_SLAVE_ADDRESS, [num, address], 'C C', 0, ''
543
+ check_validity
544
+
545
+ send_request FUNCTION_SET_CHIBI_SLAVE_ADDRESS, [num, address], 'C C', 8, ''
511
546
  end
512
547
 
513
548
  # Returns the slave address for a given num as set by
514
549
  # BrickMaster#set_chibi_slave_address.
515
550
  def get_chibi_slave_address(num)
516
- send_request FUNCTION_GET_CHIBI_SLAVE_ADDRESS, [num], 'C', 1, 'C'
551
+ check_validity
552
+
553
+ send_request FUNCTION_GET_CHIBI_SLAVE_ADDRESS, [num], 'C', 9, 'C'
517
554
  end
518
555
 
519
556
  # Returns the signal strength in dBm. The signal strength updates every time a
520
557
  # packet is received.
521
558
  def get_chibi_signal_strength
522
- send_request FUNCTION_GET_CHIBI_SIGNAL_STRENGTH, [], '', 1, 'C'
559
+ check_validity
560
+
561
+ send_request FUNCTION_GET_CHIBI_SIGNAL_STRENGTH, [], '', 9, 'C'
523
562
  end
524
563
 
525
564
  # Returns underrun, CRC error, no ACK and overflow error counts of the Chibi
@@ -527,7 +566,9 @@ module Tinkerforge
527
566
  # distance between two Chibi stacks is becoming too big or there are
528
567
  # interferences.
529
568
  def get_chibi_error_log
530
- send_request FUNCTION_GET_CHIBI_ERROR_LOG, [], '', 8, 'S S S S'
569
+ check_validity
570
+
571
+ send_request FUNCTION_GET_CHIBI_ERROR_LOG, [], '', 16, 'S S S S'
531
572
  end
532
573
 
533
574
  # Sets the Chibi frequency range for the Chibi Extension. Possible values are:
@@ -543,12 +584,16 @@ module Tinkerforge
543
584
  # saved in the EEPROM of the Chibi Extension, it does not
544
585
  # have to be set on every startup.
545
586
  def set_chibi_frequency(frequency)
546
- send_request FUNCTION_SET_CHIBI_FREQUENCY, [frequency], 'C', 0, ''
587
+ check_validity
588
+
589
+ send_request FUNCTION_SET_CHIBI_FREQUENCY, [frequency], 'C', 8, ''
547
590
  end
548
591
 
549
592
  # Returns the frequency value as set by BrickMaster#set_chibi_frequency.
550
593
  def get_chibi_frequency
551
- send_request FUNCTION_GET_CHIBI_FREQUENCY, [], '', 1, 'C'
594
+ check_validity
595
+
596
+ send_request FUNCTION_GET_CHIBI_FREQUENCY, [], '', 9, 'C'
552
597
  end
553
598
 
554
599
  # Sets the channel used by the Chibi Extension. Possible channels are
@@ -565,18 +610,24 @@ module Tinkerforge
565
610
  # saved in the EEPROM of the Chibi Extension, it does not
566
611
  # have to be set on every startup.
567
612
  def set_chibi_channel(channel)
568
- send_request FUNCTION_SET_CHIBI_CHANNEL, [channel], 'C', 0, ''
613
+ check_validity
614
+
615
+ send_request FUNCTION_SET_CHIBI_CHANNEL, [channel], 'C', 8, ''
569
616
  end
570
617
 
571
618
  # Returns the channel as set by BrickMaster#set_chibi_channel.
572
619
  def get_chibi_channel
573
- send_request FUNCTION_GET_CHIBI_CHANNEL, [], '', 1, 'C'
620
+ check_validity
621
+
622
+ send_request FUNCTION_GET_CHIBI_CHANNEL, [], '', 9, 'C'
574
623
  end
575
624
 
576
625
  # Returns *true* if the Master Brick is at position 0 in the stack and a RS485
577
626
  # Extension is available.
578
627
  def is_rs485_present
579
- send_request FUNCTION_IS_RS485_PRESENT, [], '', 1, '?'
628
+ check_validity
629
+
630
+ send_request FUNCTION_IS_RS485_PRESENT, [], '', 9, '?'
580
631
  end
581
632
 
582
633
  # Sets the address (0-255) belonging to the RS485 Extension.
@@ -588,12 +639,16 @@ module Tinkerforge
588
639
  # saved in the EEPROM of the RS485 Extension, it does not
589
640
  # have to be set on every startup.
590
641
  def set_rs485_address(address)
591
- send_request FUNCTION_SET_RS485_ADDRESS, [address], 'C', 0, ''
642
+ check_validity
643
+
644
+ send_request FUNCTION_SET_RS485_ADDRESS, [address], 'C', 8, ''
592
645
  end
593
646
 
594
647
  # Returns the address as set by BrickMaster#set_rs485_address.
595
648
  def get_rs485_address
596
- send_request FUNCTION_GET_RS485_ADDRESS, [], '', 1, 'C'
649
+ check_validity
650
+
651
+ send_request FUNCTION_GET_RS485_ADDRESS, [], '', 9, 'C'
597
652
  end
598
653
 
599
654
  # Sets up to 255 slave addresses. Valid addresses are in range 1-255. 0 has a
@@ -612,13 +667,17 @@ module Tinkerforge
612
667
  # The slave addresses will be saved in the EEPROM of the Chibi Extension, they
613
668
  # don't have to be set on every startup.
614
669
  def set_rs485_slave_address(num, address)
615
- send_request FUNCTION_SET_RS485_SLAVE_ADDRESS, [num, address], 'C C', 0, ''
670
+ check_validity
671
+
672
+ send_request FUNCTION_SET_RS485_SLAVE_ADDRESS, [num, address], 'C C', 8, ''
616
673
  end
617
674
 
618
675
  # Returns the slave address for a given ``num`` as set by
619
676
  # BrickMaster#set_rs485_slave_address.
620
677
  def get_rs485_slave_address(num)
621
- send_request FUNCTION_GET_RS485_SLAVE_ADDRESS, [num], 'C', 1, 'C'
678
+ check_validity
679
+
680
+ send_request FUNCTION_GET_RS485_SLAVE_ADDRESS, [num], 'C', 9, 'C'
622
681
  end
623
682
 
624
683
  # Returns CRC error counts of the RS485 communication.
@@ -626,34 +685,41 @@ module Tinkerforge
626
685
  # between the RS485 nodes is too big or there is some kind of
627
686
  # interference.
628
687
  def get_rs485_error_log
629
- send_request FUNCTION_GET_RS485_ERROR_LOG, [], '', 2, 'S'
688
+ check_validity
689
+
690
+ send_request FUNCTION_GET_RS485_ERROR_LOG, [], '', 10, 'S'
630
691
  end
631
692
 
632
- # Sets the configuration of the RS485 Extension. Speed is given in baud. The
693
+ # Sets the configuration of the RS485 Extension. The
633
694
  # Master Brick will try to match the given baud rate as exactly as possible.
634
- # The maximum recommended baud rate is 2000000 (2Mbit/s).
695
+ # The maximum recommended baud rate is 2000000 (2MBd).
635
696
  # Possible values for parity are 'n' (none), 'e' (even) and 'o' (odd).
636
- # Possible values for stop bits are 1 and 2.
637
697
  #
638
698
  # If your RS485 is unstable (lost messages etc.), the first thing you should
639
699
  # try is to decrease the speed. On very large bus (e.g. 1km), you probably
640
- # should use a value in the range of 100000 (100kbit/s).
700
+ # should use a value in the range of 100000 (100kBd).
641
701
  #
642
702
  # The values are stored in the EEPROM and only applied on startup. That means
643
703
  # you have to restart the Master Brick after configuration.
644
704
  def set_rs485_configuration(speed, parity, stopbits)
645
- send_request FUNCTION_SET_RS485_CONFIGURATION, [speed, parity, stopbits], 'L k C', 0, ''
705
+ check_validity
706
+
707
+ send_request FUNCTION_SET_RS485_CONFIGURATION, [speed, parity, stopbits], 'L k C', 8, ''
646
708
  end
647
709
 
648
710
  # Returns the configuration as set by BrickMaster#set_rs485_configuration.
649
711
  def get_rs485_configuration
650
- send_request FUNCTION_GET_RS485_CONFIGURATION, [], '', 6, 'L k C'
712
+ check_validity
713
+
714
+ send_request FUNCTION_GET_RS485_CONFIGURATION, [], '', 14, 'L k C'
651
715
  end
652
716
 
653
717
  # Returns *true* if the Master Brick is at position 0 in the stack and a WIFI
654
718
  # Extension is available.
655
719
  def is_wifi_present
656
- send_request FUNCTION_IS_WIFI_PRESENT, [], '', 1, '?'
720
+ check_validity
721
+
722
+ send_request FUNCTION_IS_WIFI_PRESENT, [], '', 9, '?'
657
723
  end
658
724
 
659
725
  # Sets the configuration of the WIFI Extension. The ``ssid`` can have a max length
@@ -674,20 +740,23 @@ module Tinkerforge
674
740
  # ``connection`` is set to one of the DHCP options then ``ip``, ``subnet_mask``
675
741
  # and ``gateway`` are ignored, you can set them to 0.
676
742
  #
677
- # The last parameter is the port that your program will connect to. The
678
- # default port, that is used by brickd, is 4223.
743
+ # The last parameter is the port that your program will connect to.
679
744
  #
680
745
  # The values are stored in the EEPROM and only applied on startup. That means
681
746
  # you have to restart the Master Brick after configuration.
682
747
  #
683
748
  # It is recommended to use the Brick Viewer to set the WIFI configuration.
684
749
  def set_wifi_configuration(ssid, connection, ip, subnet_mask, gateway, port)
685
- send_request FUNCTION_SET_WIFI_CONFIGURATION, [ssid, connection, ip, subnet_mask, gateway, port], 'Z32 C C4 C4 C4 S', 0, ''
750
+ check_validity
751
+
752
+ send_request FUNCTION_SET_WIFI_CONFIGURATION, [ssid, connection, ip, subnet_mask, gateway, port], 'Z32 C C4 C4 C4 S', 8, ''
686
753
  end
687
754
 
688
755
  # Returns the configuration as set by BrickMaster#set_wifi_configuration.
689
756
  def get_wifi_configuration
690
- send_request FUNCTION_GET_WIFI_CONFIGURATION, [], '', 47, 'Z32 C C4 C4 C4 S'
757
+ check_validity
758
+
759
+ send_request FUNCTION_GET_WIFI_CONFIGURATION, [], '', 55, 'Z32 C C4 C4 C4 S'
691
760
  end
692
761
 
693
762
  # Sets the encryption of the WIFI Extension. The first parameter is the
@@ -712,7 +781,7 @@ module Tinkerforge
712
781
  #
713
782
  # If you choose WPA Enterprise as encryption, you have to set ``eap_options`` and
714
783
  # the length of the certificates (for other encryption types these parameters
715
- # are ignored). The certificate length are given in byte and the certificates
784
+ # are ignored). The certificates
716
785
  # themselves can be set with BrickMaster#set_wifi_certificate. ``eap_options`` consist
717
786
  # of the outer authentication (bits 1-2), inner authentication (bit 3) and
718
787
  # certificate type (bits 4-5):
@@ -730,7 +799,9 @@ module Tinkerforge
730
799
  #
731
800
  # It is recommended to use the Brick Viewer to set the Wi-Fi encryption.
732
801
  def set_wifi_encryption(encryption, key, key_index, eap_options, ca_certificate_length, client_certificate_length, private_key_length)
733
- 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, ''
802
+ check_validity
803
+
804
+ 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', 8, ''
734
805
  end
735
806
 
736
807
  # Returns the encryption as set by BrickMaster#set_wifi_encryption.
@@ -738,7 +809,9 @@ module Tinkerforge
738
809
  # .. note::
739
810
  # Since Master Brick Firmware version 2.4.4 the key is not returned anymore.
740
811
  def get_wifi_encryption
741
- send_request FUNCTION_GET_WIFI_ENCRYPTION, [], '', 59, 'C Z50 C C S S S'
812
+ check_validity
813
+
814
+ send_request FUNCTION_GET_WIFI_ENCRYPTION, [], '', 67, 'C Z50 C C S S S'
742
815
  end
743
816
 
744
817
  # Returns the status of the WIFI Extension. The ``state`` is updated automatically,
@@ -755,7 +828,9 @@ module Tinkerforge
755
828
  # "3", "Error"
756
829
  # "255", "Not initialized yet"
757
830
  def get_wifi_status
758
- send_request FUNCTION_GET_WIFI_STATUS, [], '', 36, 'C6 C6 C s C4 C4 C4 L L C'
831
+ check_validity
832
+
833
+ send_request FUNCTION_GET_WIFI_STATUS, [], '', 44, 'C6 C6 C s C4 C4 C4 L L C'
759
834
  end
760
835
 
761
836
  # Refreshes the Wi-Fi status (see BrickMaster#get_wifi_status). To read the status
@@ -765,7 +840,9 @@ module Tinkerforge
765
840
  # until the stack with attached WIFI Extension reacts again after this
766
841
  # function is called.
767
842
  def refresh_wifi_status
768
- send_request FUNCTION_REFRESH_WIFI_STATUS, [], '', 0, ''
843
+ check_validity
844
+
845
+ send_request FUNCTION_REFRESH_WIFI_STATUS, [], '', 8, ''
769
846
  end
770
847
 
771
848
  # This function is used to set the certificate as well as password and username
@@ -787,12 +864,16 @@ module Tinkerforge
787
864
  # It is recommended to use the Brick Viewer to set the certificate, username
788
865
  # and password.
789
866
  def set_wifi_certificate(index, data, data_length)
790
- send_request FUNCTION_SET_WIFI_CERTIFICATE, [index, data, data_length], 'S C32 C', 0, ''
867
+ check_validity
868
+
869
+ send_request FUNCTION_SET_WIFI_CERTIFICATE, [index, data, data_length], 'S C32 C', 8, ''
791
870
  end
792
871
 
793
872
  # Returns the certificate for a given index as set by BrickMaster#set_wifi_certificate.
794
873
  def get_wifi_certificate(index)
795
- send_request FUNCTION_GET_WIFI_CERTIFICATE, [index], 'S', 33, 'C32 C'
874
+ check_validity
875
+
876
+ send_request FUNCTION_GET_WIFI_CERTIFICATE, [index], 'S', 41, 'C32 C'
796
877
  end
797
878
 
798
879
  # Sets the power mode of the WIFI Extension. Possible modes are:
@@ -801,15 +882,17 @@ module Tinkerforge
801
882
  #
802
883
  # "0", "Full Speed (high power consumption, high throughput)"
803
884
  # "1", "Low Power (low power consumption, low throughput)"
804
- #
805
- # The default value is 0 (Full Speed).
806
885
  def set_wifi_power_mode(mode)
807
- send_request FUNCTION_SET_WIFI_POWER_MODE, [mode], 'C', 0, ''
886
+ check_validity
887
+
888
+ send_request FUNCTION_SET_WIFI_POWER_MODE, [mode], 'C', 8, ''
808
889
  end
809
890
 
810
891
  # Returns the power mode as set by BrickMaster#set_wifi_power_mode.
811
892
  def get_wifi_power_mode
812
- send_request FUNCTION_GET_WIFI_POWER_MODE, [], '', 1, 'C'
893
+ check_validity
894
+
895
+ send_request FUNCTION_GET_WIFI_POWER_MODE, [], '', 9, 'C'
813
896
  end
814
897
 
815
898
  # Returns informations about the Wi-Fi receive buffer. The Wi-Fi
@@ -827,7 +910,9 @@ module Tinkerforge
827
910
  # Try to not send more then 50 messages at a time without any kind of
828
911
  # break between them.
829
912
  def get_wifi_buffer_info
830
- send_request FUNCTION_GET_WIFI_BUFFER_INFO, [], '', 8, 'L S S'
913
+ check_validity
914
+
915
+ send_request FUNCTION_GET_WIFI_BUFFER_INFO, [], '', 16, 'L S S'
831
916
  end
832
917
 
833
918
  # Sets the regulatory domain of the WIFI Extension. Possible domains are:
@@ -837,20 +922,24 @@ module Tinkerforge
837
922
  # "0", "FCC: Channel 1-11 (N/S America, Australia, New Zealand)"
838
923
  # "1", "ETSI: Channel 1-13 (Europe, Middle East, Africa)"
839
924
  # "2", "TELEC: Channel 1-14 (Japan)"
840
- #
841
- # The default value is 1 (ETSI).
842
925
  def set_wifi_regulatory_domain(domain)
843
- send_request FUNCTION_SET_WIFI_REGULATORY_DOMAIN, [domain], 'C', 0, ''
926
+ check_validity
927
+
928
+ send_request FUNCTION_SET_WIFI_REGULATORY_DOMAIN, [domain], 'C', 8, ''
844
929
  end
845
930
 
846
931
  # Returns the regulatory domain as set by BrickMaster#set_wifi_regulatory_domain.
847
932
  def get_wifi_regulatory_domain
848
- send_request FUNCTION_GET_WIFI_REGULATORY_DOMAIN, [], '', 1, 'C'
933
+ check_validity
934
+
935
+ send_request FUNCTION_GET_WIFI_REGULATORY_DOMAIN, [], '', 9, 'C'
849
936
  end
850
937
 
851
- # Returns the USB voltage in mV. Does not work with hardware version 2.1.
938
+ # Returns the USB voltage. Does not work with hardware version 2.1.
852
939
  def get_usb_voltage
853
- send_request FUNCTION_GET_USB_VOLTAGE, [], '', 2, 'S'
940
+ check_validity
941
+
942
+ send_request FUNCTION_GET_USB_VOLTAGE, [], '', 10, 'S'
854
943
  end
855
944
 
856
945
  # Sets a long Wi-Fi key (up to 63 chars, at least 8 chars) for WPA encryption.
@@ -863,7 +952,9 @@ module Tinkerforge
863
952
  #
864
953
  # .. versionadded:: 2.0.2$nbsp;(Firmware)
865
954
  def set_long_wifi_key(key)
866
- send_request FUNCTION_SET_LONG_WIFI_KEY, [key], 'Z64', 0, ''
955
+ check_validity
956
+
957
+ send_request FUNCTION_SET_LONG_WIFI_KEY, [key], 'Z64', 8, ''
867
958
  end
868
959
 
869
960
  # Returns the encryption key as set by BrickMaster#set_long_wifi_key.
@@ -873,7 +964,9 @@ module Tinkerforge
873
964
  #
874
965
  # .. versionadded:: 2.0.2$nbsp;(Firmware)
875
966
  def get_long_wifi_key
876
- send_request FUNCTION_GET_LONG_WIFI_KEY, [], '', 64, 'Z64'
967
+ check_validity
968
+
969
+ send_request FUNCTION_GET_LONG_WIFI_KEY, [], '', 72, 'Z64'
877
970
  end
878
971
 
879
972
  # Sets the hostname of the WIFI Extension. The hostname will be displayed
@@ -883,7 +976,9 @@ module Tinkerforge
883
976
  #
884
977
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
885
978
  def set_wifi_hostname(hostname)
886
- send_request FUNCTION_SET_WIFI_HOSTNAME, [hostname], 'Z16', 0, ''
979
+ check_validity
980
+
981
+ send_request FUNCTION_SET_WIFI_HOSTNAME, [hostname], 'Z16', 8, ''
887
982
  end
888
983
 
889
984
  # Returns the hostname as set by BrickMaster#set_wifi_hostname.
@@ -892,7 +987,9 @@ module Tinkerforge
892
987
  #
893
988
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
894
989
  def get_wifi_hostname
895
- send_request FUNCTION_GET_WIFI_HOSTNAME, [], '', 16, 'Z16'
990
+ check_validity
991
+
992
+ send_request FUNCTION_GET_WIFI_HOSTNAME, [], '', 24, 'Z16'
896
993
  end
897
994
 
898
995
  # Sets the period with which the CALLBACK_STACK_CURRENT callback is triggered
@@ -903,14 +1000,18 @@ module Tinkerforge
903
1000
  #
904
1001
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
905
1002
  def set_stack_current_callback_period(period)
906
- send_request FUNCTION_SET_STACK_CURRENT_CALLBACK_PERIOD, [period], 'L', 0, ''
1003
+ check_validity
1004
+
1005
+ send_request FUNCTION_SET_STACK_CURRENT_CALLBACK_PERIOD, [period], 'L', 8, ''
907
1006
  end
908
1007
 
909
1008
  # Returns the period as set by BrickMaster#set_stack_current_callback_period.
910
1009
  #
911
1010
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
912
1011
  def get_stack_current_callback_period
913
- send_request FUNCTION_GET_STACK_CURRENT_CALLBACK_PERIOD, [], '', 4, 'L'
1012
+ check_validity
1013
+
1014
+ send_request FUNCTION_GET_STACK_CURRENT_CALLBACK_PERIOD, [], '', 12, 'L'
914
1015
  end
915
1016
 
916
1017
  # Sets the period with which the CALLBACK_STACK_VOLTAGE callback is triggered
@@ -921,14 +1022,18 @@ module Tinkerforge
921
1022
  #
922
1023
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
923
1024
  def set_stack_voltage_callback_period(period)
924
- send_request FUNCTION_SET_STACK_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 0, ''
1025
+ check_validity
1026
+
1027
+ send_request FUNCTION_SET_STACK_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 8, ''
925
1028
  end
926
1029
 
927
1030
  # Returns the period as set by BrickMaster#set_stack_voltage_callback_period.
928
1031
  #
929
1032
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
930
1033
  def get_stack_voltage_callback_period
931
- send_request FUNCTION_GET_STACK_VOLTAGE_CALLBACK_PERIOD, [], '', 4, 'L'
1034
+ check_validity
1035
+
1036
+ send_request FUNCTION_GET_STACK_VOLTAGE_CALLBACK_PERIOD, [], '', 12, 'L'
932
1037
  end
933
1038
 
934
1039
  # Sets the period with which the CALLBACK_USB_VOLTAGE callback is triggered
@@ -939,14 +1044,18 @@ module Tinkerforge
939
1044
  #
940
1045
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
941
1046
  def set_usb_voltage_callback_period(period)
942
- send_request FUNCTION_SET_USB_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 0, ''
1047
+ check_validity
1048
+
1049
+ send_request FUNCTION_SET_USB_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 8, ''
943
1050
  end
944
1051
 
945
1052
  # Returns the period as set by BrickMaster#set_usb_voltage_callback_period.
946
1053
  #
947
1054
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
948
1055
  def get_usb_voltage_callback_period
949
- send_request FUNCTION_GET_USB_VOLTAGE_CALLBACK_PERIOD, [], '', 4, 'L'
1056
+ check_validity
1057
+
1058
+ send_request FUNCTION_GET_USB_VOLTAGE_CALLBACK_PERIOD, [], '', 12, 'L'
950
1059
  end
951
1060
 
952
1061
  # Sets the thresholds for the CALLBACK_STACK_CURRENT_REACHED callback.
@@ -961,18 +1070,20 @@ module Tinkerforge
961
1070
  # "'<'", "Callback is triggered when the current is smaller than the min value (max is ignored)"
962
1071
  # "'>'", "Callback is triggered when the current is greater than the min value (max is ignored)"
963
1072
  #
964
- # The default value is ('x', 0, 0).
965
- #
966
1073
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
967
1074
  def set_stack_current_callback_threshold(option, min, max)
968
- send_request FUNCTION_SET_STACK_CURRENT_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
1075
+ check_validity
1076
+
1077
+ send_request FUNCTION_SET_STACK_CURRENT_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
969
1078
  end
970
1079
 
971
1080
  # Returns the threshold as set by BrickMaster#set_stack_current_callback_threshold.
972
1081
  #
973
1082
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
974
1083
  def get_stack_current_callback_threshold
975
- send_request FUNCTION_GET_STACK_CURRENT_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
1084
+ check_validity
1085
+
1086
+ send_request FUNCTION_GET_STACK_CURRENT_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
976
1087
  end
977
1088
 
978
1089
  # Sets the thresholds for the CALLBACK_STACK_VOLTAGE_REACHED callback.
@@ -987,18 +1098,20 @@ module Tinkerforge
987
1098
  # "'<'", "Callback is triggered when the voltage is smaller than the min value (max is ignored)"
988
1099
  # "'>'", "Callback is triggered when the voltage is greater than the min value (max is ignored)"
989
1100
  #
990
- # The default value is ('x', 0, 0).
991
- #
992
1101
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
993
1102
  def set_stack_voltage_callback_threshold(option, min, max)
994
- send_request FUNCTION_SET_STACK_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
1103
+ check_validity
1104
+
1105
+ send_request FUNCTION_SET_STACK_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
995
1106
  end
996
1107
 
997
1108
  # Returns the threshold as set by BrickMaster#set_stack_voltage_callback_threshold.
998
1109
  #
999
1110
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
1000
1111
  def get_stack_voltage_callback_threshold
1001
- send_request FUNCTION_GET_STACK_VOLTAGE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
1112
+ check_validity
1113
+
1114
+ send_request FUNCTION_GET_STACK_VOLTAGE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
1002
1115
  end
1003
1116
 
1004
1117
  # Sets the thresholds for the CALLBACK_USB_VOLTAGE_REACHED callback.
@@ -1013,18 +1126,20 @@ module Tinkerforge
1013
1126
  # "'<'", "Callback is triggered when the voltage is smaller than the min value (max is ignored)"
1014
1127
  # "'>'", "Callback is triggered when the voltage is greater than the min value (max is ignored)"
1015
1128
  #
1016
- # The default value is ('x', 0, 0).
1017
- #
1018
1129
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
1019
1130
  def set_usb_voltage_callback_threshold(option, min, max)
1020
- send_request FUNCTION_SET_USB_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
1131
+ check_validity
1132
+
1133
+ send_request FUNCTION_SET_USB_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
1021
1134
  end
1022
1135
 
1023
1136
  # Returns the threshold as set by BrickMaster#set_usb_voltage_callback_threshold.
1024
1137
  #
1025
1138
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
1026
1139
  def get_usb_voltage_callback_threshold
1027
- send_request FUNCTION_GET_USB_VOLTAGE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
1140
+ check_validity
1141
+
1142
+ send_request FUNCTION_GET_USB_VOLTAGE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
1028
1143
  end
1029
1144
 
1030
1145
  # Sets the period with which the threshold callbacks
@@ -1043,14 +1158,18 @@ module Tinkerforge
1043
1158
  #
1044
1159
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
1045
1160
  def set_debounce_period(debounce)
1046
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
1161
+ check_validity
1162
+
1163
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
1047
1164
  end
1048
1165
 
1049
1166
  # Returns the debounce period as set by BrickMaster#set_debounce_period.
1050
1167
  #
1051
1168
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
1052
1169
  def get_debounce_period
1053
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
1170
+ check_validity
1171
+
1172
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
1054
1173
  end
1055
1174
 
1056
1175
  # Returns *true* if the Master Brick is at position 0 in the stack and an Ethernet
@@ -1058,7 +1177,9 @@ module Tinkerforge
1058
1177
  #
1059
1178
  # .. versionadded:: 2.1.0$nbsp;(Firmware)
1060
1179
  def is_ethernet_present
1061
- send_request FUNCTION_IS_ETHERNET_PRESENT, [], '', 1, '?'
1180
+ check_validity
1181
+
1182
+ send_request FUNCTION_IS_ETHERNET_PRESENT, [], '', 9, '?'
1062
1183
  end
1063
1184
 
1064
1185
  # Sets the configuration of the Ethernet Extension. Possible values for
@@ -1075,8 +1196,7 @@ module Tinkerforge
1075
1196
  # to the DHCP options then ``ip``, ``subnet_mask`` and ``gateway`` are ignored,
1076
1197
  # you can set them to 0.
1077
1198
  #
1078
- # The last parameter is the port that your program will connect to. The
1079
- # default port, that is used by brickd, is 4223.
1199
+ # The last parameter is the port that your program will connect to.
1080
1200
  #
1081
1201
  # The values are stored in the EEPROM and only applied on startup. That means
1082
1202
  # you have to restart the Master Brick after configuration.
@@ -1085,14 +1205,18 @@ module Tinkerforge
1085
1205
  #
1086
1206
  # .. versionadded:: 2.1.0$nbsp;(Firmware)
1087
1207
  def set_ethernet_configuration(connection, ip, subnet_mask, gateway, port)
1088
- send_request FUNCTION_SET_ETHERNET_CONFIGURATION, [connection, ip, subnet_mask, gateway, port], 'C C4 C4 C4 S', 0, ''
1208
+ check_validity
1209
+
1210
+ send_request FUNCTION_SET_ETHERNET_CONFIGURATION, [connection, ip, subnet_mask, gateway, port], 'C C4 C4 C4 S', 8, ''
1089
1211
  end
1090
1212
 
1091
1213
  # Returns the configuration as set by BrickMaster#set_ethernet_configuration.
1092
1214
  #
1093
1215
  # .. versionadded:: 2.1.0$nbsp;(Firmware)
1094
1216
  def get_ethernet_configuration
1095
- send_request FUNCTION_GET_ETHERNET_CONFIGURATION, [], '', 15, 'C C4 C4 C4 S'
1217
+ check_validity
1218
+
1219
+ send_request FUNCTION_GET_ETHERNET_CONFIGURATION, [], '', 23, 'C C4 C4 C4 S'
1096
1220
  end
1097
1221
 
1098
1222
  # Returns the status of the Ethernet Extension.
@@ -1107,7 +1231,9 @@ module Tinkerforge
1107
1231
  #
1108
1232
  # .. versionadded:: 2.1.0$nbsp;(Firmware)
1109
1233
  def get_ethernet_status
1110
- send_request FUNCTION_GET_ETHERNET_STATUS, [], '', 58, 'C6 C4 C4 C4 L L Z32'
1234
+ check_validity
1235
+
1236
+ send_request FUNCTION_GET_ETHERNET_STATUS, [], '', 66, 'C6 C4 C4 C4 L L Z32'
1111
1237
  end
1112
1238
 
1113
1239
  # Sets the hostname of the Ethernet Extension. The hostname will be displayed
@@ -1119,7 +1245,9 @@ module Tinkerforge
1119
1245
  #
1120
1246
  # .. versionadded:: 2.1.0$nbsp;(Firmware)
1121
1247
  def set_ethernet_hostname(hostname)
1122
- send_request FUNCTION_SET_ETHERNET_HOSTNAME, [hostname], 'Z32', 0, ''
1248
+ check_validity
1249
+
1250
+ send_request FUNCTION_SET_ETHERNET_HOSTNAME, [hostname], 'Z32', 8, ''
1123
1251
  end
1124
1252
 
1125
1253
  # Sets the MAC address of the Ethernet Extension. The Ethernet Extension should
@@ -1130,7 +1258,9 @@ module Tinkerforge
1130
1258
  #
1131
1259
  # .. versionadded:: 2.1.0$nbsp;(Firmware)
1132
1260
  def set_ethernet_mac_address(mac_address)
1133
- send_request FUNCTION_SET_ETHERNET_MAC_ADDRESS, [mac_address], 'C6', 0, ''
1261
+ check_validity
1262
+
1263
+ send_request FUNCTION_SET_ETHERNET_MAC_ADDRESS, [mac_address], 'C6', 8, ''
1134
1264
  end
1135
1265
 
1136
1266
  # Sets the Ethernet WebSocket configuration. The first parameter sets the number of socket
@@ -1146,18 +1276,20 @@ module Tinkerforge
1146
1276
  #
1147
1277
  # It is recommended to use the Brick Viewer to set the Ethernet configuration.
1148
1278
  #
1149
- # The default values are 3 for the socket connections and 4280 for the port.
1150
- #
1151
1279
  # .. versionadded:: 2.2.0$nbsp;(Firmware)
1152
1280
  def set_ethernet_websocket_configuration(sockets, port)
1153
- send_request FUNCTION_SET_ETHERNET_WEBSOCKET_CONFIGURATION, [sockets, port], 'C S', 0, ''
1281
+ check_validity
1282
+
1283
+ send_request FUNCTION_SET_ETHERNET_WEBSOCKET_CONFIGURATION, [sockets, port], 'C S', 8, ''
1154
1284
  end
1155
1285
 
1156
1286
  # Returns the configuration as set by BrickMaster#set_ethernet_configuration.
1157
1287
  #
1158
1288
  # .. versionadded:: 2.2.0$nbsp;(Firmware)
1159
1289
  def get_ethernet_websocket_configuration
1160
- send_request FUNCTION_GET_ETHERNET_WEBSOCKET_CONFIGURATION, [], '', 3, 'C S'
1290
+ check_validity
1291
+
1292
+ send_request FUNCTION_GET_ETHERNET_WEBSOCKET_CONFIGURATION, [], '', 11, 'C S'
1161
1293
  end
1162
1294
 
1163
1295
  # Sets the Ethernet authentication secret. The secret can be a string of up to 64
@@ -1175,7 +1307,9 @@ module Tinkerforge
1175
1307
  #
1176
1308
  # .. versionadded:: 2.2.0$nbsp;(Firmware)
1177
1309
  def set_ethernet_authentication_secret(secret)
1178
- send_request FUNCTION_SET_ETHERNET_AUTHENTICATION_SECRET, [secret], 'Z64', 0, ''
1310
+ check_validity
1311
+
1312
+ send_request FUNCTION_SET_ETHERNET_AUTHENTICATION_SECRET, [secret], 'Z64', 8, ''
1179
1313
  end
1180
1314
 
1181
1315
  # Returns the authentication secret as set by
@@ -1183,7 +1317,9 @@ module Tinkerforge
1183
1317
  #
1184
1318
  # .. versionadded:: 2.2.0$nbsp;(Firmware)
1185
1319
  def get_ethernet_authentication_secret
1186
- send_request FUNCTION_GET_ETHERNET_AUTHENTICATION_SECRET, [], '', 64, 'Z64'
1320
+ check_validity
1321
+
1322
+ send_request FUNCTION_GET_ETHERNET_AUTHENTICATION_SECRET, [], '', 72, 'Z64'
1187
1323
  end
1188
1324
 
1189
1325
  # Sets the WIFI authentication secret. The secret can be a string of up to 64
@@ -1201,7 +1337,9 @@ module Tinkerforge
1201
1337
  #
1202
1338
  # .. versionadded:: 2.2.0$nbsp;(Firmware)
1203
1339
  def set_wifi_authentication_secret(secret)
1204
- send_request FUNCTION_SET_WIFI_AUTHENTICATION_SECRET, [secret], 'Z64', 0, ''
1340
+ check_validity
1341
+
1342
+ send_request FUNCTION_SET_WIFI_AUTHENTICATION_SECRET, [secret], 'Z64', 8, ''
1205
1343
  end
1206
1344
 
1207
1345
  # Returns the authentication secret as set by
@@ -1209,14 +1347,18 @@ module Tinkerforge
1209
1347
  #
1210
1348
  # .. versionadded:: 2.2.0$nbsp;(Firmware)
1211
1349
  def get_wifi_authentication_secret
1212
- send_request FUNCTION_GET_WIFI_AUTHENTICATION_SECRET, [], '', 64, 'Z64'
1350
+ check_validity
1351
+
1352
+ send_request FUNCTION_GET_WIFI_AUTHENTICATION_SECRET, [], '', 72, 'Z64'
1213
1353
  end
1214
1354
 
1215
1355
  # Returns the type of the connection over which this function was called.
1216
1356
  #
1217
1357
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1218
1358
  def get_connection_type
1219
- send_request FUNCTION_GET_CONNECTION_TYPE, [], '', 1, 'C'
1359
+ check_validity
1360
+
1361
+ send_request FUNCTION_GET_CONNECTION_TYPE, [], '', 9, 'C'
1220
1362
  end
1221
1363
 
1222
1364
  # Returns *true* if the Master Brick is at position 0 in the stack and a WIFI
@@ -1224,7 +1366,9 @@ module Tinkerforge
1224
1366
  #
1225
1367
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1226
1368
  def is_wifi2_present
1227
- send_request FUNCTION_IS_WIFI2_PRESENT, [], '', 1, '?'
1369
+ check_validity
1370
+
1371
+ send_request FUNCTION_IS_WIFI2_PRESENT, [], '', 9, '?'
1228
1372
  end
1229
1373
 
1230
1374
  # Starts the bootloader of the WIFI Extension 2.0. Returns 0 on success.
@@ -1240,7 +1384,9 @@ module Tinkerforge
1240
1384
  #
1241
1385
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1242
1386
  def start_wifi2_bootloader
1243
- send_request FUNCTION_START_WIFI2_BOOTLOADER, [], '', 1, 'c'
1387
+ check_validity
1388
+
1389
+ send_request FUNCTION_START_WIFI2_BOOTLOADER, [], '', 9, 'c'
1244
1390
  end
1245
1391
 
1246
1392
  # Writes up to 60 bytes (number of bytes to be written specified by ``length``)
@@ -1255,7 +1401,9 @@ module Tinkerforge
1255
1401
  #
1256
1402
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1257
1403
  def write_wifi2_serial_port(data, length)
1258
- send_request FUNCTION_WRITE_WIFI2_SERIAL_PORT, [data, length], 'C60 C', 1, 'c'
1404
+ check_validity
1405
+
1406
+ send_request FUNCTION_WRITE_WIFI2_SERIAL_PORT, [data, length], 'C60 C', 9, 'c'
1259
1407
  end
1260
1408
 
1261
1409
  # Reads up to 60 bytes (number of bytes to be read specified by ``length``)
@@ -1270,7 +1418,9 @@ module Tinkerforge
1270
1418
  #
1271
1419
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1272
1420
  def read_wifi2_serial_port(length)
1273
- send_request FUNCTION_READ_WIFI2_SERIAL_PORT, [length], 'C', 61, 'C60 C'
1421
+ check_validity
1422
+
1423
+ send_request FUNCTION_READ_WIFI2_SERIAL_PORT, [length], 'C', 69, 'C60 C'
1274
1424
  end
1275
1425
 
1276
1426
  # Sets the WIFI authentication secret. The secret can be a string of up to 64
@@ -1288,7 +1438,9 @@ module Tinkerforge
1288
1438
  #
1289
1439
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1290
1440
  def set_wifi2_authentication_secret(secret)
1291
- send_request FUNCTION_SET_WIFI2_AUTHENTICATION_SECRET, [secret], 'Z64', 0, ''
1441
+ check_validity
1442
+
1443
+ send_request FUNCTION_SET_WIFI2_AUTHENTICATION_SECRET, [secret], 'Z64', 8, ''
1292
1444
  end
1293
1445
 
1294
1446
  # Returns the WIFI authentication secret as set by
@@ -1296,22 +1448,24 @@ module Tinkerforge
1296
1448
  #
1297
1449
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1298
1450
  def get_wifi2_authentication_secret
1299
- send_request FUNCTION_GET_WIFI2_AUTHENTICATION_SECRET, [], '', 64, 'Z64'
1451
+ check_validity
1452
+
1453
+ send_request FUNCTION_GET_WIFI2_AUTHENTICATION_SECRET, [], '', 72, 'Z64'
1300
1454
  end
1301
1455
 
1302
1456
  # Sets the general configuration of the WIFI Extension 2.0.
1303
1457
  #
1304
1458
  # The ``port`` parameter sets the port number that your programm will connect
1305
- # to. The default value is 4223.
1459
+ # to.
1306
1460
  #
1307
1461
  # The ``websocket_port`` parameter sets the WebSocket port number that your
1308
- # JavaScript programm will connect to. The default value is 4280.
1462
+ # JavaScript programm will connect to.
1309
1463
  #
1310
1464
  # The ``website_port`` parameter sets the port number for the website of the
1311
- # WIFI Extension 2.0. The default value is 80.
1465
+ # WIFI Extension 2.0.
1312
1466
  #
1313
1467
  # The ``phy_mode`` parameter sets the specific wireless network mode to be used.
1314
- # Possible values are B, G and N. The default value is G.
1468
+ # Possible values are B, G and N.
1315
1469
  #
1316
1470
  # The ``sleep_mode`` parameter is currently unused.
1317
1471
  #
@@ -1331,27 +1485,33 @@ module Tinkerforge
1331
1485
  #
1332
1486
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1333
1487
  def set_wifi2_configuration(port, websocket_port, website_port, phy_mode, sleep_mode, website)
1334
- send_request FUNCTION_SET_WIFI2_CONFIGURATION, [port, websocket_port, website_port, phy_mode, sleep_mode, website], 'S S S C C C', 0, ''
1488
+ check_validity
1489
+
1490
+ send_request FUNCTION_SET_WIFI2_CONFIGURATION, [port, websocket_port, website_port, phy_mode, sleep_mode, website], 'S S S C C C', 8, ''
1335
1491
  end
1336
1492
 
1337
1493
  # Returns the general configuration as set by BrickMaster#set_wifi2_configuration.
1338
1494
  #
1339
1495
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1340
1496
  def get_wifi2_configuration
1341
- send_request FUNCTION_GET_WIFI2_CONFIGURATION, [], '', 9, 'S S S C C C'
1497
+ check_validity
1498
+
1499
+ send_request FUNCTION_GET_WIFI2_CONFIGURATION, [], '', 17, 'S S S C C C'
1342
1500
  end
1343
1501
 
1344
1502
  # Returns the client and access point status of the WIFI Extension 2.0.
1345
1503
  #
1346
1504
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1347
1505
  def get_wifi2_status
1348
- send_request FUNCTION_GET_WIFI2_STATUS, [], '', 57, '? C C4 C4 C4 C6 L L c ? C4 C4 C4 C6 L L C'
1506
+ check_validity
1507
+
1508
+ send_request FUNCTION_GET_WIFI2_STATUS, [], '', 65, '? C C4 C4 C4 C6 L L c ? C4 C4 C4 C6 L L C'
1349
1509
  end
1350
1510
 
1351
1511
  # Sets the client specific configuration of the WIFI Extension 2.0.
1352
1512
  #
1353
1513
  # The ``enable`` parameter enables or disables the client part of the
1354
- # WIFI Extension 2.0. The default value is *true*.
1514
+ # WIFI Extension 2.0.
1355
1515
  #
1356
1516
  # The ``ssid`` parameter sets the SSID (up to 32 characters) of the access point
1357
1517
  # to connect to.
@@ -1378,14 +1538,18 @@ module Tinkerforge
1378
1538
  #
1379
1539
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1380
1540
  def set_wifi2_client_configuration(enable, ssid, ip, subnet_mask, gateway, mac_address, bssid)
1381
- send_request FUNCTION_SET_WIFI2_CLIENT_CONFIGURATION, [enable, ssid, ip, subnet_mask, gateway, mac_address, bssid], '? Z32 C4 C4 C4 C6 C6', 0, ''
1541
+ check_validity
1542
+
1543
+ send_request FUNCTION_SET_WIFI2_CLIENT_CONFIGURATION, [enable, ssid, ip, subnet_mask, gateway, mac_address, bssid], '? Z32 C4 C4 C4 C6 C6', 8, ''
1382
1544
  end
1383
1545
 
1384
1546
  # Returns the client configuration as set by BrickMaster#set_wifi2_client_configuration.
1385
1547
  #
1386
1548
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1387
1549
  def get_wifi2_client_configuration
1388
- send_request FUNCTION_GET_WIFI2_CLIENT_CONFIGURATION, [], '', 57, '? Z32 C4 C4 C4 C6 C6'
1550
+ check_validity
1551
+
1552
+ send_request FUNCTION_GET_WIFI2_CLIENT_CONFIGURATION, [], '', 65, '? Z32 C4 C4 C4 C6 C6'
1389
1553
  end
1390
1554
 
1391
1555
  # Sets the client hostname (up to 32 characters) of the WIFI Extension 2.0. The
@@ -1400,14 +1564,18 @@ module Tinkerforge
1400
1564
  #
1401
1565
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1402
1566
  def set_wifi2_client_hostname(hostname)
1403
- send_request FUNCTION_SET_WIFI2_CLIENT_HOSTNAME, [hostname], 'Z32', 0, ''
1567
+ check_validity
1568
+
1569
+ send_request FUNCTION_SET_WIFI2_CLIENT_HOSTNAME, [hostname], 'Z32', 8, ''
1404
1570
  end
1405
1571
 
1406
1572
  # Returns the client hostname as set by BrickMaster#set_wifi2_client_hostname.
1407
1573
  #
1408
1574
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1409
1575
  def get_wifi2_client_hostname
1410
- send_request FUNCTION_GET_WIFI2_CLIENT_HOSTNAME, [], '', 32, 'Z32'
1576
+ check_validity
1577
+
1578
+ send_request FUNCTION_GET_WIFI2_CLIENT_HOSTNAME, [], '', 40, 'Z32'
1411
1579
  end
1412
1580
 
1413
1581
  # Sets the client password (up to 63 chars) for WPA/WPA2 encryption.
@@ -1420,7 +1588,9 @@ module Tinkerforge
1420
1588
  #
1421
1589
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1422
1590
  def set_wifi2_client_password(password)
1423
- send_request FUNCTION_SET_WIFI2_CLIENT_PASSWORD, [password], 'Z64', 0, ''
1591
+ check_validity
1592
+
1593
+ send_request FUNCTION_SET_WIFI2_CLIENT_PASSWORD, [password], 'Z64', 8, ''
1424
1594
  end
1425
1595
 
1426
1596
  # Returns the client password as set by BrickMaster#set_wifi2_client_password.
@@ -1431,13 +1601,15 @@ module Tinkerforge
1431
1601
  #
1432
1602
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1433
1603
  def get_wifi2_client_password
1434
- send_request FUNCTION_GET_WIFI2_CLIENT_PASSWORD, [], '', 64, 'Z64'
1604
+ check_validity
1605
+
1606
+ send_request FUNCTION_GET_WIFI2_CLIENT_PASSWORD, [], '', 72, 'Z64'
1435
1607
  end
1436
1608
 
1437
1609
  # Sets the access point specific configuration of the WIFI Extension 2.0.
1438
1610
  #
1439
1611
  # The ``enable`` parameter enables or disables the access point part of the
1440
- # WIFI Extension 2.0. The default value is true.
1612
+ # WIFI Extension 2.0.
1441
1613
  #
1442
1614
  # The ``ssid`` parameter sets the SSID (up to 32 characters) of the access point.
1443
1615
  #
@@ -1447,15 +1619,13 @@ module Tinkerforge
1447
1619
  # The default configuration is DHCP.
1448
1620
  #
1449
1621
  # The ``encryption`` parameter sets the encryption mode to be used. Possible
1450
- # values are Open (no encryption), WEP or WPA/WPA2 PSK. The default value is
1451
- # WPA/WPA2 PSK. Use the BrickMaster#set_wifi2_ap_password function to set the encryption
1622
+ # values are Open (no encryption), WEP or WPA/WPA2 PSK.
1623
+ # Use the BrickMaster#set_wifi2_ap_password function to set the encryption
1452
1624
  # password.
1453
1625
  #
1454
1626
  # The ``hidden`` parameter makes the access point hide or show its SSID.
1455
- # The default value is *false*.
1456
1627
  #
1457
1628
  # The ``channel`` parameter sets the channel (1 to 13) of the access point.
1458
- # The default value is 1.
1459
1629
  #
1460
1630
  # If the ``mac_address`` parameter is set to all zero then the factory MAC
1461
1631
  # address is used. Otherwise this parameter can be used to set a custom MAC
@@ -1469,14 +1639,18 @@ module Tinkerforge
1469
1639
  #
1470
1640
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1471
1641
  def set_wifi2_ap_configuration(enable, ssid, ip, subnet_mask, gateway, encryption, hidden, channel, mac_address)
1472
- send_request FUNCTION_SET_WIFI2_AP_CONFIGURATION, [enable, ssid, ip, subnet_mask, gateway, encryption, hidden, channel, mac_address], '? Z32 C4 C4 C4 C ? C C6', 0, ''
1642
+ check_validity
1643
+
1644
+ send_request FUNCTION_SET_WIFI2_AP_CONFIGURATION, [enable, ssid, ip, subnet_mask, gateway, encryption, hidden, channel, mac_address], '? Z32 C4 C4 C4 C ? C C6', 8, ''
1473
1645
  end
1474
1646
 
1475
1647
  # Returns the access point configuration as set by BrickMaster#set_wifi2_ap_configuration.
1476
1648
  #
1477
1649
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1478
1650
  def get_wifi2_ap_configuration
1479
- send_request FUNCTION_GET_WIFI2_AP_CONFIGURATION, [], '', 54, '? Z32 C4 C4 C4 C ? C C6'
1651
+ check_validity
1652
+
1653
+ send_request FUNCTION_GET_WIFI2_AP_CONFIGURATION, [], '', 62, '? Z32 C4 C4 C4 C ? C C6'
1480
1654
  end
1481
1655
 
1482
1656
  # Sets the access point password (at least 8 and up to 63 chars) for the configured encryption
@@ -1490,7 +1664,9 @@ module Tinkerforge
1490
1664
  #
1491
1665
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1492
1666
  def set_wifi2_ap_password(password)
1493
- send_request FUNCTION_SET_WIFI2_AP_PASSWORD, [password], 'Z64', 0, ''
1667
+ check_validity
1668
+
1669
+ send_request FUNCTION_SET_WIFI2_AP_PASSWORD, [password], 'Z64', 8, ''
1494
1670
  end
1495
1671
 
1496
1672
  # Returns the access point password as set by BrickMaster#set_wifi2_ap_password.
@@ -1501,7 +1677,9 @@ module Tinkerforge
1501
1677
  #
1502
1678
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1503
1679
  def get_wifi2_ap_password
1504
- send_request FUNCTION_GET_WIFI2_AP_PASSWORD, [], '', 64, 'Z64'
1680
+ check_validity
1681
+
1682
+ send_request FUNCTION_GET_WIFI2_AP_PASSWORD, [], '', 72, 'Z64'
1505
1683
  end
1506
1684
 
1507
1685
  # All configuration functions for the WIFI Extension 2.0 do not change the
@@ -1513,35 +1691,45 @@ module Tinkerforge
1513
1691
  #
1514
1692
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1515
1693
  def save_wifi2_configuration
1516
- send_request FUNCTION_SAVE_WIFI2_CONFIGURATION, [], '', 1, 'C'
1694
+ check_validity
1695
+
1696
+ send_request FUNCTION_SAVE_WIFI2_CONFIGURATION, [], '', 9, 'C'
1517
1697
  end
1518
1698
 
1519
- # Returns the current version of the WIFI Extension 2.0 firmware (major, minor, revision).
1699
+ # Returns the current version of the WIFI Extension 2.0 firmware.
1520
1700
  #
1521
1701
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1522
1702
  def get_wifi2_firmware_version
1523
- send_request FUNCTION_GET_WIFI2_FIRMWARE_VERSION, [], '', 3, 'C3'
1703
+ check_validity
1704
+
1705
+ send_request FUNCTION_GET_WIFI2_FIRMWARE_VERSION, [], '', 11, 'C3'
1524
1706
  end
1525
1707
 
1526
1708
  # Turns the green status LED of the WIFI Extension 2.0 on.
1527
1709
  #
1528
1710
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1529
1711
  def enable_wifi2_status_led
1530
- send_request FUNCTION_ENABLE_WIFI2_STATUS_LED, [], '', 0, ''
1712
+ check_validity
1713
+
1714
+ send_request FUNCTION_ENABLE_WIFI2_STATUS_LED, [], '', 8, ''
1531
1715
  end
1532
1716
 
1533
1717
  # Turns the green status LED of the WIFI Extension 2.0 off.
1534
1718
  #
1535
1719
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1536
1720
  def disable_wifi2_status_led
1537
- send_request FUNCTION_DISABLE_WIFI2_STATUS_LED, [], '', 0, ''
1721
+ check_validity
1722
+
1723
+ send_request FUNCTION_DISABLE_WIFI2_STATUS_LED, [], '', 8, ''
1538
1724
  end
1539
1725
 
1540
1726
  # Returns *true* if the green status LED of the WIFI Extension 2.0 is turned on.
1541
1727
  #
1542
1728
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1543
1729
  def is_wifi2_status_led_enabled
1544
- send_request FUNCTION_IS_WIFI2_STATUS_LED_ENABLED, [], '', 1, '?'
1730
+ check_validity
1731
+
1732
+ send_request FUNCTION_IS_WIFI2_STATUS_LED_ENABLED, [], '', 9, '?'
1545
1733
  end
1546
1734
 
1547
1735
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1549,7 +1737,7 @@ module Tinkerforge
1549
1737
  # Sets the mesh specific configuration of the WIFI Extension 2.0.
1550
1738
  #
1551
1739
  # The ``enable`` parameter enables or disables the mesh part of the
1552
- # WIFI Extension 2.0. The default value is *false*. The mesh part cannot be
1740
+ # WIFI Extension 2.0. The mesh part cannot be
1553
1741
  # enabled together with the client and access-point part.
1554
1742
  #
1555
1743
  # If the ``root_ip`` parameter is set to all zero then ``root_subnet_mask``
@@ -1578,7 +1766,9 @@ module Tinkerforge
1578
1766
  #
1579
1767
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1580
1768
  def set_wifi2_mesh_configuration(enable, root_ip, root_subnet_mask, root_gateway, router_bssid, group_id, group_ssid_prefix, gateway_ip, gateway_port)
1581
- send_request FUNCTION_SET_WIFI2_MESH_CONFIGURATION, [enable, root_ip, root_subnet_mask, root_gateway, router_bssid, group_id, group_ssid_prefix, gateway_ip, gateway_port], '? C4 C4 C4 C6 C6 Z16 C4 S', 0, ''
1769
+ check_validity
1770
+
1771
+ send_request FUNCTION_SET_WIFI2_MESH_CONFIGURATION, [enable, root_ip, root_subnet_mask, root_gateway, router_bssid, group_id, group_ssid_prefix, gateway_ip, gateway_port], '? C4 C4 C4 C6 C6 Z16 C4 S', 8, ''
1582
1772
  end
1583
1773
 
1584
1774
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1587,7 +1777,9 @@ module Tinkerforge
1587
1777
  #
1588
1778
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1589
1779
  def get_wifi2_mesh_configuration
1590
- send_request FUNCTION_GET_WIFI2_MESH_CONFIGURATION, [], '', 47, '? C4 C4 C4 C6 C6 Z16 C4 S'
1780
+ check_validity
1781
+
1782
+ send_request FUNCTION_GET_WIFI2_MESH_CONFIGURATION, [], '', 55, '? C4 C4 C4 C6 C6 Z16 C4 S'
1591
1783
  end
1592
1784
 
1593
1785
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1607,7 +1799,9 @@ module Tinkerforge
1607
1799
  #
1608
1800
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1609
1801
  def set_wifi2_mesh_router_ssid(ssid)
1610
- send_request FUNCTION_SET_WIFI2_MESH_ROUTER_SSID, [ssid], 'Z32', 0, ''
1802
+ check_validity
1803
+
1804
+ send_request FUNCTION_SET_WIFI2_MESH_ROUTER_SSID, [ssid], 'Z32', 8, ''
1611
1805
  end
1612
1806
 
1613
1807
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1616,7 +1810,9 @@ module Tinkerforge
1616
1810
  #
1617
1811
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1618
1812
  def get_wifi2_mesh_router_ssid
1619
- send_request FUNCTION_GET_WIFI2_MESH_ROUTER_SSID, [], '', 32, 'Z32'
1813
+ check_validity
1814
+
1815
+ send_request FUNCTION_GET_WIFI2_MESH_ROUTER_SSID, [], '', 40, 'Z32'
1620
1816
  end
1621
1817
 
1622
1818
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1632,7 +1828,9 @@ module Tinkerforge
1632
1828
  #
1633
1829
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1634
1830
  def set_wifi2_mesh_router_password(password)
1635
- send_request FUNCTION_SET_WIFI2_MESH_ROUTER_PASSWORD, [password], 'Z64', 0, ''
1831
+ check_validity
1832
+
1833
+ send_request FUNCTION_SET_WIFI2_MESH_ROUTER_PASSWORD, [password], 'Z64', 8, ''
1636
1834
  end
1637
1835
 
1638
1836
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1641,7 +1839,9 @@ module Tinkerforge
1641
1839
  #
1642
1840
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1643
1841
  def get_wifi2_mesh_router_password
1644
- send_request FUNCTION_GET_WIFI2_MESH_ROUTER_PASSWORD, [], '', 64, 'Z64'
1842
+ check_validity
1843
+
1844
+ send_request FUNCTION_GET_WIFI2_MESH_ROUTER_PASSWORD, [], '', 72, 'Z64'
1645
1845
  end
1646
1846
 
1647
1847
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1650,7 +1850,9 @@ module Tinkerforge
1650
1850
  #
1651
1851
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1652
1852
  def get_wifi2_mesh_common_status
1653
- send_request FUNCTION_GET_WIFI2_MESH_COMMON_STATUS, [], '', 13, 'C ? ? S L L'
1853
+ check_validity
1854
+
1855
+ send_request FUNCTION_GET_WIFI2_MESH_COMMON_STATUS, [], '', 21, 'C ? ? S L L'
1654
1856
  end
1655
1857
 
1656
1858
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1659,7 +1861,9 @@ module Tinkerforge
1659
1861
  #
1660
1862
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1661
1863
  def get_wifi2_mesh_client_status
1662
- send_request FUNCTION_GET_WIFI2_MESH_CLIENT_STATUS, [], '', 50, 'Z32 C4 C4 C4 C6'
1864
+ check_validity
1865
+
1866
+ send_request FUNCTION_GET_WIFI2_MESH_CLIENT_STATUS, [], '', 58, 'Z32 C4 C4 C4 C6'
1663
1867
  end
1664
1868
 
1665
1869
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1668,15 +1872,74 @@ module Tinkerforge
1668
1872
  #
1669
1873
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1670
1874
  def get_wifi2_mesh_ap_status
1671
- send_request FUNCTION_GET_WIFI2_MESH_AP_STATUS, [], '', 50, 'Z32 C4 C4 C4 C6'
1875
+ check_validity
1876
+
1877
+ send_request FUNCTION_GET_WIFI2_MESH_AP_STATUS, [], '', 58, 'Z32 C4 C4 C4 C6'
1878
+ end
1879
+
1880
+ # This function is for internal use to flash the initial
1881
+ # bootstrapper and bootloader to the Bricklets.
1882
+ #
1883
+ # If you need to flash a boostrapper/bootloader (for exmaple
1884
+ # because you made your own Bricklet from scratch) please
1885
+ # take a look at our open source flash and test tool at
1886
+ # `https://github.com/Tinkerforge/flash-test <https://github.com/Tinkerforge/flash-test>`__
1887
+ #
1888
+ # Don't use this function directly.
1889
+ #
1890
+ # .. versionadded:: 2.5.0$nbsp;(Firmware)
1891
+ def set_bricklet_xmc_flash_config(config, parameter1, parameter2, data)
1892
+ check_validity
1893
+
1894
+ send_request FUNCTION_SET_BRICKLET_XMC_FLASH_CONFIG, [config, parameter1, parameter2, data], 'L L L C52', 72, 'L C60'
1895
+ end
1896
+
1897
+ # This function is for internal use to flash the initial
1898
+ # bootstrapper and bootloader to the Bricklets.
1899
+ #
1900
+ # If you need to flash a boostrapper/bootloader (for exmaple
1901
+ # because you made your own Bricklet from scratch) please
1902
+ # take a look at our open source flash and test tool at
1903
+ # `https://github.com/Tinkerforge/flash-test <https://github.com/Tinkerforge/flash-test>`__
1904
+ #
1905
+ # Don't use this function directly.
1906
+ #
1907
+ # .. versionadded:: 2.5.0$nbsp;(Firmware)
1908
+ def set_bricklet_xmc_flash_data(data)
1909
+ check_validity
1910
+
1911
+ send_request FUNCTION_SET_BRICKLET_XMC_FLASH_DATA, [data], 'C64', 12, 'L'
1912
+ end
1913
+
1914
+ # This function is only available in Master Brick hardware version >= 3.0.
1915
+ #
1916
+ # Enables/disables all four Bricklets if set to true/false.
1917
+ #
1918
+ # If you disable the Bricklets the power supply to the Bricklets will be disconnected.
1919
+ # The Bricklets will lose all configurations if disabled.
1920
+ #
1921
+ # .. versionadded:: 2.5.0$nbsp;(Firmware)
1922
+ def set_bricklets_enabled(bricklets_enabled)
1923
+ check_validity
1924
+
1925
+ send_request FUNCTION_SET_BRICKLETS_ENABLED, [bricklets_enabled], '?', 8, ''
1926
+ end
1927
+
1928
+ # Returns *true* if the Bricklets are enabled, *false* otherwise.
1929
+ #
1930
+ # .. versionadded:: 2.5.0$nbsp;(Firmware)
1931
+ def get_bricklets_enabled
1932
+ check_validity
1933
+
1934
+ send_request FUNCTION_GET_BRICKLETS_ENABLED, [], '', 9, '?'
1672
1935
  end
1673
1936
 
1674
1937
  # The SPITF protocol can be used with a dynamic baudrate. If the dynamic baudrate is
1675
1938
  # enabled, the Brick will try to adapt the baudrate for the communication
1676
1939
  # between Bricks and Bricklets according to the amount of data that is transferred.
1677
1940
  #
1678
- # The baudrate will be increased exponentially if lots of data is send/received and
1679
- # decreased linearly if little data is send/received.
1941
+ # The baudrate will be increased exponentially if lots of data is sent/received and
1942
+ # decreased linearly if little data is sent/received.
1680
1943
  #
1681
1944
  # This lowers the baudrate in applications where little data is transferred (e.g.
1682
1945
  # a weather station) and increases the robustness. If there is lots of data to transfer
@@ -1690,20 +1953,20 @@ module Tinkerforge
1690
1953
  # BrickMaster#set_spitfp_baudrate. If the dynamic baudrate is disabled, the baudrate
1691
1954
  # as set by BrickMaster#set_spitfp_baudrate will be used statically.
1692
1955
  #
1693
- # The minimum dynamic baudrate has a value range of 400000 to 2000000 baud.
1694
- #
1695
- # By default dynamic baudrate is enabled and the minimum dynamic baudrate is 400000.
1696
- #
1697
1956
  # .. versionadded:: 2.4.6$nbsp;(Firmware)
1698
1957
  def set_spitfp_baudrate_config(enable_dynamic_baudrate, minimum_dynamic_baudrate)
1699
- send_request FUNCTION_SET_SPITFP_BAUDRATE_CONFIG, [enable_dynamic_baudrate, minimum_dynamic_baudrate], '? L', 0, ''
1958
+ check_validity
1959
+
1960
+ send_request FUNCTION_SET_SPITFP_BAUDRATE_CONFIG, [enable_dynamic_baudrate, minimum_dynamic_baudrate], '? L', 8, ''
1700
1961
  end
1701
1962
 
1702
1963
  # Returns the baudrate config, see BrickMaster#set_spitfp_baudrate_config.
1703
1964
  #
1704
1965
  # .. versionadded:: 2.4.6$nbsp;(Firmware)
1705
1966
  def get_spitfp_baudrate_config
1706
- send_request FUNCTION_GET_SPITFP_BAUDRATE_CONFIG, [], '', 5, '? L'
1967
+ check_validity
1968
+
1969
+ send_request FUNCTION_GET_SPITFP_BAUDRATE_CONFIG, [], '', 13, '? L'
1707
1970
  end
1708
1971
 
1709
1972
  # Returns the timeout count for the different communication methods.
@@ -1715,11 +1978,12 @@ module Tinkerforge
1715
1978
  #
1716
1979
  # .. versionadded:: 2.4.3$nbsp;(Firmware)
1717
1980
  def get_send_timeout_count(communication_method)
1718
- send_request FUNCTION_GET_SEND_TIMEOUT_COUNT, [communication_method], 'C', 4, 'L'
1981
+ check_validity
1982
+
1983
+ send_request FUNCTION_GET_SEND_TIMEOUT_COUNT, [communication_method], 'C', 12, 'L'
1719
1984
  end
1720
1985
 
1721
- # Sets the baudrate for a specific Bricklet port ('a' - 'd'). The
1722
- # baudrate can be in the range 400000 to 2000000.
1986
+ # Sets the baudrate for a specific Bricklet port.
1723
1987
  #
1724
1988
  # If you want to increase the throughput of Bricklets you can increase
1725
1989
  # the baudrate. If you get a high error count because of high
@@ -1733,18 +1997,20 @@ module Tinkerforge
1733
1997
  # or similar is necessary in you applications we recommend to not change
1734
1998
  # the baudrate.
1735
1999
  #
1736
- # The default baudrate for all ports is 1400000.
1737
- #
1738
2000
  # .. versionadded:: 2.4.3$nbsp;(Firmware)
1739
2001
  def set_spitfp_baudrate(bricklet_port, baudrate)
1740
- send_request FUNCTION_SET_SPITFP_BAUDRATE, [bricklet_port, baudrate], 'k L', 0, ''
2002
+ check_validity
2003
+
2004
+ send_request FUNCTION_SET_SPITFP_BAUDRATE, [bricklet_port, baudrate], 'k L', 8, ''
1741
2005
  end
1742
2006
 
1743
2007
  # Returns the baudrate for a given Bricklet port, see BrickMaster#set_spitfp_baudrate.
1744
2008
  #
1745
2009
  # .. versionadded:: 2.4.3$nbsp;(Firmware)
1746
2010
  def get_spitfp_baudrate(bricklet_port)
1747
- send_request FUNCTION_GET_SPITFP_BAUDRATE, [bricklet_port], 'k', 4, 'L'
2011
+ check_validity
2012
+
2013
+ send_request FUNCTION_GET_SPITFP_BAUDRATE, [bricklet_port], 'k', 12, 'L'
1748
2014
  end
1749
2015
 
1750
2016
  # Returns the error count for the communication between Brick and Bricklet.
@@ -1761,7 +2027,9 @@ module Tinkerforge
1761
2027
  #
1762
2028
  # .. versionadded:: 2.4.3$nbsp;(Firmware)
1763
2029
  def get_spitfp_error_count(bricklet_port)
1764
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [bricklet_port], 'k', 16, 'L L L L'
2030
+ check_validity
2031
+
2032
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [bricklet_port], 'k', 24, 'L L L L'
1765
2033
  end
1766
2034
 
1767
2035
  # Enables the status LED.
@@ -1773,7 +2041,9 @@ module Tinkerforge
1773
2041
  #
1774
2042
  # .. versionadded:: 2.3.2$nbsp;(Firmware)
1775
2043
  def enable_status_led
1776
- send_request FUNCTION_ENABLE_STATUS_LED, [], '', 0, ''
2044
+ check_validity
2045
+
2046
+ send_request FUNCTION_ENABLE_STATUS_LED, [], '', 8, ''
1777
2047
  end
1778
2048
 
1779
2049
  # Disables the status LED.
@@ -1785,14 +2055,18 @@ module Tinkerforge
1785
2055
  #
1786
2056
  # .. versionadded:: 2.3.2$nbsp;(Firmware)
1787
2057
  def disable_status_led
1788
- send_request FUNCTION_DISABLE_STATUS_LED, [], '', 0, ''
2058
+ check_validity
2059
+
2060
+ send_request FUNCTION_DISABLE_STATUS_LED, [], '', 8, ''
1789
2061
  end
1790
2062
 
1791
2063
  # Returns *true* if the status LED is enabled, *false* otherwise.
1792
2064
  #
1793
2065
  # .. versionadded:: 2.3.2$nbsp;(Firmware)
1794
2066
  def is_status_led_enabled
1795
- send_request FUNCTION_IS_STATUS_LED_ENABLED, [], '', 1, '?'
2067
+ check_validity
2068
+
2069
+ send_request FUNCTION_IS_STATUS_LED_ENABLED, [], '', 9, '?'
1796
2070
  end
1797
2071
 
1798
2072
  # Returns the firmware and protocol version and the name of the Bricklet for a
@@ -1801,17 +2075,21 @@ module Tinkerforge
1801
2075
  # This functions sole purpose is to allow automatic flashing of v1.x.y Bricklet
1802
2076
  # plugins.
1803
2077
  def get_protocol1_bricklet_name(port)
1804
- send_request FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'k', 44, 'C C3 Z40'
2078
+ check_validity
2079
+
2080
+ send_request FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'k', 52, 'C C3 Z40'
1805
2081
  end
1806
2082
 
1807
- # Returns the temperature in °C/10 as measured inside the microcontroller. The
2083
+ # Returns the temperature as measured inside the microcontroller. The
1808
2084
  # value returned is not the ambient temperature!
1809
2085
  #
1810
2086
  # The temperature is only proportional to the real temperature and it has an
1811
2087
  # accuracy of ±15%. Practically it is only useful as an indicator for
1812
2088
  # temperature changes.
1813
2089
  def get_chip_temperature
1814
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
2090
+ check_validity
2091
+
2092
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
1815
2093
  end
1816
2094
 
1817
2095
  # Calling this function will reset the Brick. Calling this function
@@ -1821,19 +2099,43 @@ module Tinkerforge
1821
2099
  # calling functions on the existing ones will result in
1822
2100
  # undefined behavior!
1823
2101
  def reset
1824
- send_request FUNCTION_RESET, [], '', 0, ''
2102
+ check_validity
2103
+
2104
+ send_request FUNCTION_RESET, [], '', 8, ''
2105
+ end
2106
+
2107
+ # Writes 32 bytes of firmware to the bricklet attached at the given port.
2108
+ # The bytes are written to the position offset * 32.
2109
+ #
2110
+ # This function is used by Brick Viewer during flashing. It should not be
2111
+ # necessary to call it in a normal user program.
2112
+ def write_bricklet_plugin(port, offset, chunk)
2113
+ check_validity
2114
+
2115
+ send_request FUNCTION_WRITE_BRICKLET_PLUGIN, [port, offset, chunk], 'k C C32', 8, ''
2116
+ end
2117
+
2118
+ # Reads 32 bytes of firmware from the bricklet attached at the given port.
2119
+ # The bytes are read starting at the position offset * 32.
2120
+ #
2121
+ # This function is used by Brick Viewer during flashing. It should not be
2122
+ # necessary to call it in a normal user program.
2123
+ def read_bricklet_plugin(port, offset)
2124
+ check_validity
2125
+
2126
+ send_request FUNCTION_READ_BRICKLET_PLUGIN, [port, offset], 'k C', 40, 'C32'
1825
2127
  end
1826
2128
 
1827
2129
  # Returns the UID, the UID where the Brick is connected to,
1828
2130
  # the position, the hardware and firmware version as well as the
1829
2131
  # device identifier.
1830
2132
  #
1831
- # The position can be '0'-'8' (stack position).
2133
+ # The position is the position in the stack from '0' (bottom) to '8' (top).
1832
2134
  #
1833
2135
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
1834
2136
  # |device_identifier_constant|
1835
2137
  def get_identity
1836
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
2138
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
1837
2139
  end
1838
2140
 
1839
2141
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.