tinkerforge 2.1.22 → 2.1.27

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 (144) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +157 -76
  3. data/lib/tinkerforge/brick_hat.rb +115 -32
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +192 -87
  6. data/lib/tinkerforge/brick_imu_v2.rb +220 -119
  7. data/lib/tinkerforge/brick_master.rb +498 -198
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +187 -103
  10. data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
  11. data/lib/tinkerforge/brick_stepper.rb +214 -102
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
  14. data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
  18. data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
  21. data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
  24. data/lib/tinkerforge/bricklet_barometer.rb +108 -58
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
  26. data/lib/tinkerforge/bricklet_can.rb +84 -24
  27. data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
  28. data/lib/tinkerforge/bricklet_co2.rb +36 -25
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
  30. data/lib/tinkerforge/bricklet_color.rb +77 -49
  31. data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
  32. data/lib/tinkerforge/bricklet_compass.rb +397 -0
  33. data/lib/tinkerforge/bricklet_current12.rb +61 -40
  34. data/lib/tinkerforge/bricklet_current25.rb +61 -40
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
  37. data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +335 -0
  39. data/lib/tinkerforge/bricklet_dmx.rb +92 -48
  40. data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +416 -0
  46. data/lib/tinkerforge/bricklet_gps.rb +72 -48
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
  50. data/lib/tinkerforge/bricklet_humidity.rb +54 -38
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
  52. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  53. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
  54. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
  55. data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
  62. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  63. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
  65. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
  66. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
  67. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
  68. data/lib/tinkerforge/bricklet_io16.rb +57 -32
  69. data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
  70. data/lib/tinkerforge/bricklet_io4.rb +56 -31
  71. data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
  72. data/lib/tinkerforge/bricklet_isolator.rb +111 -35
  73. data/lib/tinkerforge/bricklet_joystick.rb +63 -42
  74. data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
  75. data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
  76. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +101 -53
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -131
  78. data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
  79. data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
  80. data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
  81. data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
  82. data/lib/tinkerforge/bricklet_line.rb +35 -22
  83. data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
  84. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
  85. data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
  86. data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
  87. data/lib/tinkerforge/bricklet_moisture.rb +43 -30
  88. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  89. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
  90. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
  91. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
  92. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +371 -0
  93. data/lib/tinkerforge/bricklet_nfc.rb +130 -80
  94. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  95. data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
  96. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +97 -40
  97. data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
  98. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  99. data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
  100. data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
  101. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
  102. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  103. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  104. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  105. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  106. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  107. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  108. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  109. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  110. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  111. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  112. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  113. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  114. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  115. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  116. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  117. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
  118. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  119. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  120. data/lib/tinkerforge/bricklet_rs485.rb +303 -207
  121. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  122. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  123. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  124. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  125. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  126. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  127. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  128. data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
  129. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
  130. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  131. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  132. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  133. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  134. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  135. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  136. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  137. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  138. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  139. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
  140. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
  141. data/lib/tinkerforge/device_display_names.rb +165 -0
  142. data/lib/tinkerforge/ip_connection.rb +155 -33
  143. data/lib/tinkerforge/version.rb +1 -1
  144. metadata +14 -4
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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
  # NFC tag read/write, NFC P2P and Card Emulation
14
16
  class BrickletNFC < Device
@@ -147,7 +149,7 @@ module Tinkerforge
147
149
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
148
150
  # the IP Connection <tt>ipcon</tt>.
149
151
  def initialize(uid, ipcon)
150
- super uid, ipcon
152
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
151
153
 
152
154
  @api_version = [2, 0, 1]
153
155
 
@@ -189,10 +191,11 @@ module Tinkerforge
189
191
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
190
192
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
191
193
 
192
- @callback_formats[CALLBACK_READER_STATE_CHANGED] = 'C ?'
193
- @callback_formats[CALLBACK_CARDEMU_STATE_CHANGED] = 'C ?'
194
- @callback_formats[CALLBACK_P2P_STATE_CHANGED] = 'C ?'
194
+ @callback_formats[CALLBACK_READER_STATE_CHANGED] = [10, 'C ?']
195
+ @callback_formats[CALLBACK_CARDEMU_STATE_CHANGED] = [10, 'C ?']
196
+ @callback_formats[CALLBACK_P2P_STATE_CHANGED] = [10, 'C ?']
195
197
 
198
+ @ipcon.add_device self
196
199
  end
197
200
 
198
201
  # Sets the mode. The NFC Bricklet supports four modes:
@@ -205,30 +208,19 @@ module Tinkerforge
205
208
  # If you change a mode, the Bricklet will reconfigure the hardware for this mode.
206
209
  # Therefore, you can only use functions corresponding to the current mode. For
207
210
  # example, in Reader mode you can only use Reader functions.
208
- #
209
- # The default mode is "off".
210
211
  def set_mode(mode)
211
- send_request FUNCTION_SET_MODE, [mode], 'C', 0, ''
212
+ check_validity
213
+
214
+ send_request FUNCTION_SET_MODE, [mode], 'C', 8, ''
212
215
  end
213
216
 
214
217
  # Returns the mode as set by BrickletNFC#set_mode.
215
218
  def get_mode
216
- send_request FUNCTION_GET_MODE, [], '', 1, 'C'
219
+ check_validity
220
+
221
+ send_request FUNCTION_GET_MODE, [], '', 9, 'C'
217
222
  end
218
223
 
219
- # To read or write a tag that is in proximity of the NFC Bricklet you
220
- # first have to call this function with the expected tag type as parameter.
221
- # It is no problem if you don't know the tag type. You can cycle through
222
- # the available tag types until the tag answers the request.
223
- #
224
- # Currently the following tag types are supported:
225
- #
226
- # * Mifare Classic
227
- # * NFC Forum Type 1
228
- # * NFC Forum Type 2
229
- # * NFC Forum Type 3
230
- # * NFC Forum Type 4
231
- #
232
224
  # After you call BrickletNFC#reader_request_tag_id the NFC Bricklet will try to read
233
225
  # the tag ID from the tag. After this process is done the state will change.
234
226
  # You can either register the CALLBACK_READER_STATE_CHANGED callback or you can poll
@@ -247,7 +239,9 @@ module Tinkerforge
247
239
  # In case of any *ReaderError* state the selection is lost and you have to
248
240
  # start again by calling BrickletNFC#reader_request_tag_id.
249
241
  def reader_request_tag_id
250
- send_request FUNCTION_READER_REQUEST_TAG_ID, [], '', 0, ''
242
+ check_validity
243
+
244
+ send_request FUNCTION_READER_REQUEST_TAG_ID, [], '', 8, ''
251
245
  end
252
246
 
253
247
  # Returns the tag type and the tag ID. This function can only be called if the
@@ -261,7 +255,9 @@ module Tinkerforge
261
255
  # CALLBACK_READER_STATE_CHANGED callback)
262
256
  # 3. Call BrickletNFC#reader_get_tag_id
263
257
  def reader_get_tag_id_low_level
264
- send_request FUNCTION_READER_GET_TAG_ID_LOW_LEVEL, [], '', 34, 'C C C32'
258
+ check_validity
259
+
260
+ send_request FUNCTION_READER_GET_TAG_ID_LOW_LEVEL, [], '', 42, 'C C C32'
265
261
  end
266
262
 
267
263
  # Returns the current reader state of the NFC Bricklet.
@@ -281,10 +277,12 @@ module Tinkerforge
281
277
  #
282
278
  # The same approach is used analogously for the other API functions.
283
279
  def reader_get_state
284
- send_request FUNCTION_READER_GET_STATE, [], '', 2, 'C ?'
280
+ check_validity
281
+
282
+ send_request FUNCTION_READER_GET_STATE, [], '', 10, 'C ?'
285
283
  end
286
284
 
287
- # Writes NDEF formated data with a maximum of 255 bytes.
285
+ # Writes NDEF formated data.
288
286
  #
289
287
  # This function currently supports NFC Forum Type 2 and 4.
290
288
  #
@@ -299,7 +297,9 @@ module Tinkerforge
299
297
  # 5. Wait for state to change to *ReaderWriteNDEFReady* (see BrickletNFC#reader_get_state
300
298
  # or CALLBACK_READER_STATE_CHANGED callback)
301
299
  def reader_write_ndef_low_level(ndef_length, ndef_chunk_offset, ndef_chunk_data)
302
- send_request FUNCTION_READER_WRITE_NDEF_LOW_LEVEL, [ndef_length, ndef_chunk_offset, ndef_chunk_data], 'S S C60', 0, ''
300
+ check_validity
301
+
302
+ send_request FUNCTION_READER_WRITE_NDEF_LOW_LEVEL, [ndef_length, ndef_chunk_offset, ndef_chunk_data], 'S S C60', 8, ''
303
303
  end
304
304
 
305
305
  # Reads NDEF formated data from a tag.
@@ -318,15 +318,17 @@ module Tinkerforge
318
318
  # or CALLBACK_READER_STATE_CHANGED callback)
319
319
  # 6. Call BrickletNFC#reader_read_ndef to retrieve the NDEF message from the buffer
320
320
  def reader_request_ndef
321
- send_request FUNCTION_READER_REQUEST_NDEF, [], '', 0, ''
321
+ check_validity
322
+
323
+ send_request FUNCTION_READER_REQUEST_NDEF, [], '', 8, ''
322
324
  end
323
325
 
324
326
  # Returns the NDEF data from an internal buffer. To fill the buffer
325
327
  # with a NDEF message you have to call BrickletNFC#reader_request_ndef beforehand.
326
- #
327
- # The buffer can have a size of up to 8192 bytes.
328
328
  def reader_read_ndef_low_level
329
- send_request FUNCTION_READER_READ_NDEF_LOW_LEVEL, [], '', 64, 'S S C60'
329
+ check_validity
330
+
331
+ send_request FUNCTION_READER_READ_NDEF_LOW_LEVEL, [], '', 72, 'S S C60'
330
332
  end
331
333
 
332
334
  # Mifare Classic tags use authentication. If you want to read from or write to
@@ -350,7 +352,9 @@ module Tinkerforge
350
352
  #
351
353
  # The authentication will always work for one whole sector (4 pages).
352
354
  def reader_authenticate_mifare_classic_page(page, key_number, key)
353
- send_request FUNCTION_READER_AUTHENTICATE_MIFARE_CLASSIC_PAGE, [page, key_number, key], 'S C C6', 0, ''
355
+ check_validity
356
+
357
+ send_request FUNCTION_READER_AUTHENTICATE_MIFARE_CLASSIC_PAGE, [page, key_number, key], 'S C C6', 8, ''
354
358
  end
355
359
 
356
360
  # Writes a maximum of 8192 bytes starting from the given page. How many pages are written
@@ -381,7 +385,9 @@ module Tinkerforge
381
385
  #
382
386
  # Choose CC by setting page to 3 or NDEF by setting page to 4.
383
387
  def reader_write_page_low_level(page, data_length, data_chunk_offset, data_chunk_data)
384
- send_request FUNCTION_READER_WRITE_PAGE_LOW_LEVEL, [page, data_length, data_chunk_offset, data_chunk_data], 'S S S C58', 0, ''
388
+ check_validity
389
+
390
+ send_request FUNCTION_READER_WRITE_PAGE_LOW_LEVEL, [page, data_length, data_chunk_offset, data_chunk_data], 'S S S C58', 8, ''
385
391
  end
386
392
 
387
393
  # Reads a maximum of 8192 bytes starting from the given page and stores them into a buffer.
@@ -415,15 +421,17 @@ module Tinkerforge
415
421
  #
416
422
  # Choose CC by setting page to 3 or NDEF by setting page to 4.
417
423
  def reader_request_page(page, length)
418
- send_request FUNCTION_READER_REQUEST_PAGE, [page, length], 'S S', 0, ''
424
+ check_validity
425
+
426
+ send_request FUNCTION_READER_REQUEST_PAGE, [page, length], 'S S', 8, ''
419
427
  end
420
428
 
421
429
  # Returns the page data from an internal buffer. To fill the buffer
422
430
  # with specific pages you have to call BrickletNFC#reader_request_page beforehand.
423
- #
424
- # The buffer can have a size of up to 8192 bytes.
425
431
  def reader_read_page_low_level
426
- send_request FUNCTION_READER_READ_PAGE_LOW_LEVEL, [], '', 64, 'S S C60'
432
+ check_validity
433
+
434
+ send_request FUNCTION_READER_READ_PAGE_LOW_LEVEL, [], '', 72, 'S S C60'
427
435
  end
428
436
 
429
437
  # Returns the current cardemu state of the NFC Bricklet.
@@ -443,7 +451,9 @@ module Tinkerforge
443
451
  #
444
452
  # The same approach is used analogously for the other API functions.
445
453
  def cardemu_get_state
446
- send_request FUNCTION_CARDEMU_GET_STATE, [], '', 2, 'C ?'
454
+ check_validity
455
+
456
+ send_request FUNCTION_CARDEMU_GET_STATE, [], '', 10, 'C ?'
447
457
  end
448
458
 
449
459
  # Starts the discovery process. If you call this function while a NFC
@@ -457,10 +467,12 @@ module Tinkerforge
457
467
  # If the cardemu state changes to *CardemuDiscoveryReady* you can start the NDEF message
458
468
  # transfer with BrickletNFC#cardemu_write_ndef and BrickletNFC#cardemu_start_transfer.
459
469
  def cardemu_start_discovery
460
- send_request FUNCTION_CARDEMU_START_DISCOVERY, [], '', 0, ''
470
+ check_validity
471
+
472
+ send_request FUNCTION_CARDEMU_START_DISCOVERY, [], '', 8, ''
461
473
  end
462
474
 
463
- # Writes the NDEF messages that is to be transferred to the NFC peer.
475
+ # Writes the NDEF message that is to be transferred to the NFC peer.
464
476
  #
465
477
  # The maximum supported NDEF message size in Cardemu mode is 255 byte.
466
478
  #
@@ -468,7 +480,9 @@ module Tinkerforge
468
480
  # will not be overwritten until you call this function again or change the
469
481
  # mode.
470
482
  def cardemu_write_ndef_low_level(ndef_length, ndef_chunk_offset, ndef_chunk_data)
471
- send_request FUNCTION_CARDEMU_WRITE_NDEF_LOW_LEVEL, [ndef_length, ndef_chunk_offset, ndef_chunk_data], 'S S C60', 0, ''
483
+ check_validity
484
+
485
+ send_request FUNCTION_CARDEMU_WRITE_NDEF_LOW_LEVEL, [ndef_length, ndef_chunk_offset, ndef_chunk_data], 'S S C60', 8, ''
472
486
  end
473
487
 
474
488
  # You can start the transfer of a NDEF message if the cardemu state is *CardemuDiscoveryReady*.
@@ -480,7 +494,9 @@ module Tinkerforge
480
494
  # change to *CardemuTransferNDEFReady* if the transfer was successful or
481
495
  # *CardemuTransferNDEFError* if it wasn't.
482
496
  def cardemu_start_transfer(transfer)
483
- send_request FUNCTION_CARDEMU_START_TRANSFER, [transfer], 'C', 0, ''
497
+ check_validity
498
+
499
+ send_request FUNCTION_CARDEMU_START_TRANSFER, [transfer], 'C', 8, ''
484
500
  end
485
501
 
486
502
  # Returns the current P2P state of the NFC Bricklet.
@@ -500,7 +516,9 @@ module Tinkerforge
500
516
  #
501
517
  # The same approach is used analogously for the other API functions.
502
518
  def p2p_get_state
503
- send_request FUNCTION_P2P_GET_STATE, [], '', 2, 'C ?'
519
+ check_validity
520
+
521
+ send_request FUNCTION_P2P_GET_STATE, [], '', 10, 'C ?'
504
522
  end
505
523
 
506
524
  # Starts the discovery process. If you call this function while another NFC
@@ -514,10 +532,12 @@ module Tinkerforge
514
532
  # If the P2P state changes to *P2PDiscoveryReady* you can start the NDEF message
515
533
  # transfer with BrickletNFC#p2p_start_transfer.
516
534
  def p2p_start_discovery
517
- send_request FUNCTION_P2P_START_DISCOVERY, [], '', 0, ''
535
+ check_validity
536
+
537
+ send_request FUNCTION_P2P_START_DISCOVERY, [], '', 8, ''
518
538
  end
519
539
 
520
- # Writes the NDEF messages that is to be transferred to the NFC peer.
540
+ # Writes the NDEF message that is to be transferred to the NFC peer.
521
541
  #
522
542
  # The maximum supported NDEF message size for P2P transfer is 255 byte.
523
543
  #
@@ -525,7 +545,9 @@ module Tinkerforge
525
545
  # will not be overwritten until you call this function again, change the
526
546
  # mode or use P2P to read an NDEF messages.
527
547
  def p2p_write_ndef_low_level(ndef_length, ndef_chunk_offset, ndef_chunk_data)
528
- send_request FUNCTION_P2P_WRITE_NDEF_LOW_LEVEL, [ndef_length, ndef_chunk_offset, ndef_chunk_data], 'S S C60', 0, ''
548
+ check_validity
549
+
550
+ send_request FUNCTION_P2P_WRITE_NDEF_LOW_LEVEL, [ndef_length, ndef_chunk_offset, ndef_chunk_data], 'S S C60', 8, ''
529
551
  end
530
552
 
531
553
  # You can start the transfer of a NDEF message if the P2P state is *P2PDiscoveryReady*.
@@ -541,16 +563,19 @@ module Tinkerforge
541
563
  # you can now use BrickletNFC#p2p_read_ndef to read the NDEF message that was written
542
564
  # by the NFC peer.
543
565
  def p2p_start_transfer(transfer)
544
- send_request FUNCTION_P2P_START_TRANSFER, [transfer], 'C', 0, ''
566
+ check_validity
567
+
568
+ send_request FUNCTION_P2P_START_TRANSFER, [transfer], 'C', 8, ''
545
569
  end
546
570
 
547
571
  # Returns the NDEF message that was written by a NFC peer in NFC P2P mode.
548
- # The maximum NDEF length is 8192 byte.
549
572
  #
550
573
  # The NDEF message is ready if you called BrickletNFC#p2p_start_transfer with a
551
574
  # read transfer and the P2P state changed to *P2PTransferNDEFReady*.
552
575
  def p2p_read_ndef_low_level
553
- send_request FUNCTION_P2P_READ_NDEF_LOW_LEVEL, [], '', 64, 'S S C60'
576
+ check_validity
577
+
578
+ send_request FUNCTION_P2P_READ_NDEF_LOW_LEVEL, [], '', 72, 'S S C60'
554
579
  end
555
580
 
556
581
  # Sets the detection LED configuration. By default the LED shows
@@ -560,15 +585,19 @@ module Tinkerforge
560
585
  #
561
586
  # If the Bricklet is in bootloader mode, the LED is off.
562
587
  def set_detection_led_config(config)
563
- send_request FUNCTION_SET_DETECTION_LED_CONFIG, [config], 'C', 0, ''
588
+ check_validity
589
+
590
+ send_request FUNCTION_SET_DETECTION_LED_CONFIG, [config], 'C', 8, ''
564
591
  end
565
592
 
566
593
  # Returns the configuration as set by BrickletNFC#set_detection_led_config
567
594
  def get_detection_led_config
568
- send_request FUNCTION_GET_DETECTION_LED_CONFIG, [], '', 1, 'C'
595
+ check_validity
596
+
597
+ send_request FUNCTION_GET_DETECTION_LED_CONFIG, [], '', 9, 'C'
569
598
  end
570
599
 
571
- # Sets the maximum timeout in ms.
600
+ # Sets the maximum timeout.
572
601
  #
573
602
  # This is a global maximum used for all internal state timeouts. The timeouts depend heavily
574
603
  # on the used tags etc. For example: If you use a Type 2 tag and you want to detect if
@@ -583,21 +612,23 @@ module Tinkerforge
583
612
  # If you need a fast response time to discover if a tag is present or not you can find
584
613
  # a good timeout value by trial and error for your specific tag.
585
614
  #
586
- # By default we use a very conservative timeout, to be sure that any Tag can always
615
+ # By default we use a very conservative timeout, to be sure that any tag can always
587
616
  # answer in time.
588
617
  #
589
- # Default timeout: 2000ms.
590
- #
591
618
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
592
619
  def set_maximum_timeout(timeout)
593
- send_request FUNCTION_SET_MAXIMUM_TIMEOUT, [timeout], 'S', 0, ''
620
+ check_validity
621
+
622
+ send_request FUNCTION_SET_MAXIMUM_TIMEOUT, [timeout], 'S', 8, ''
594
623
  end
595
624
 
596
625
  # Returns the timeout as set by BrickletNFC#set_maximum_timeout
597
626
  #
598
627
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
599
628
  def get_maximum_timeout
600
- send_request FUNCTION_GET_MAXIMUM_TIMEOUT, [], '', 2, 'S'
629
+ check_validity
630
+
631
+ send_request FUNCTION_GET_MAXIMUM_TIMEOUT, [], '', 10, 'S'
601
632
  end
602
633
 
603
634
  # Returns the error count for the communication between Brick and Bricklet.
@@ -612,7 +643,9 @@ module Tinkerforge
612
643
  # The errors counts are for errors that occur on the Bricklet side. All
613
644
  # Bricks have a similar function that returns the errors on the Brick side.
614
645
  def get_spitfp_error_count
615
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
646
+ check_validity
647
+
648
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
616
649
  end
617
650
 
618
651
  # Sets the bootloader mode and returns the status after the requested
@@ -625,12 +658,16 @@ module Tinkerforge
625
658
  # This function is used by Brick Viewer during flashing. It should not be
626
659
  # necessary to call it in a normal user program.
627
660
  def set_bootloader_mode(mode)
628
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
661
+ check_validity
662
+
663
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
629
664
  end
630
665
 
631
666
  # Returns the current bootloader mode, see BrickletNFC#set_bootloader_mode.
632
667
  def get_bootloader_mode
633
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
668
+ check_validity
669
+
670
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
634
671
  end
635
672
 
636
673
  # Sets the firmware pointer for BrickletNFC#write_firmware. The pointer has
@@ -640,7 +677,9 @@ module Tinkerforge
640
677
  # This function is used by Brick Viewer during flashing. It should not be
641
678
  # necessary to call it in a normal user program.
642
679
  def set_write_firmware_pointer(pointer)
643
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
680
+ check_validity
681
+
682
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
644
683
  end
645
684
 
646
685
  # Writes 64 Bytes of firmware at the position as written by
@@ -652,7 +691,9 @@ module Tinkerforge
652
691
  # This function is used by Brick Viewer during flashing. It should not be
653
692
  # necessary to call it in a normal user program.
654
693
  def write_firmware(data)
655
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
694
+ check_validity
695
+
696
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
656
697
  end
657
698
 
658
699
  # Sets the status LED configuration. By default the LED shows
@@ -663,22 +704,28 @@ module Tinkerforge
663
704
  #
664
705
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
665
706
  def set_status_led_config(config)
666
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
707
+ check_validity
708
+
709
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
667
710
  end
668
711
 
669
712
  # Returns the configuration as set by BrickletNFC#set_status_led_config
670
713
  def get_status_led_config
671
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
714
+ check_validity
715
+
716
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
672
717
  end
673
718
 
674
- # Returns the temperature in °C as measured inside the microcontroller. The
719
+ # Returns the temperature as measured inside the microcontroller. The
675
720
  # value returned is not the ambient temperature!
676
721
  #
677
722
  # The temperature is only proportional to the real temperature and it has bad
678
723
  # accuracy. Practically it is only useful as an indicator for
679
724
  # temperature changes.
680
725
  def get_chip_temperature
681
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
726
+ check_validity
727
+
728
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
682
729
  end
683
730
 
684
731
  # Calling this function will reset the Bricklet. All configurations
@@ -688,7 +735,9 @@ module Tinkerforge
688
735
  # calling functions on the existing ones will result in
689
736
  # undefined behavior!
690
737
  def reset
691
- send_request FUNCTION_RESET, [], '', 0, ''
738
+ check_validity
739
+
740
+ send_request FUNCTION_RESET, [], '', 8, ''
692
741
  end
693
742
 
694
743
  # Writes a new UID into flash. If you want to set a new UID
@@ -697,25 +746,31 @@ module Tinkerforge
697
746
  #
698
747
  # We recommend that you use Brick Viewer to change the UID.
699
748
  def write_uid(uid)
700
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
749
+ check_validity
750
+
751
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
701
752
  end
702
753
 
703
754
  # Returns the current UID as an integer. Encode as
704
755
  # Base58 to get the usual string version.
705
756
  def read_uid
706
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
757
+ check_validity
758
+
759
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
707
760
  end
708
761
 
709
762
  # Returns the UID, the UID where the Bricklet is connected to,
710
763
  # the position, the hardware and firmware version as well as the
711
764
  # device identifier.
712
765
  #
713
- # The position can be 'a', 'b', 'c' or 'd'.
766
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
767
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
768
+ # position 'z'.
714
769
  #
715
770
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
716
771
  # |device_identifier_constant|
717
772
  def get_identity
718
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
773
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
719
774
  end
720
775
 
721
776
  # Returns the tag type and the tag ID. This function can only be called if the
@@ -734,7 +789,7 @@ module Tinkerforge
734
789
  [ret[0], ret[2][0, ret[1]]]
735
790
  end
736
791
 
737
- # Writes NDEF formated data with a maximum of 255 bytes.
792
+ # Writes NDEF formated data.
738
793
  #
739
794
  # This function currently supports NFC Forum Type 2 and 4.
740
795
  #
@@ -781,8 +836,6 @@ module Tinkerforge
781
836
 
782
837
  # Returns the NDEF data from an internal buffer. To fill the buffer
783
838
  # with a NDEF message you have to call BrickletNFC#reader_request_ndef beforehand.
784
- #
785
- # The buffer can have a size of up to 8192 bytes.
786
839
  def reader_read_ndef
787
840
  ndef_length = nil # assigned in block
788
841
  ndef_data = nil # assigned in block
@@ -876,8 +929,6 @@ module Tinkerforge
876
929
 
877
930
  # Returns the page data from an internal buffer. To fill the buffer
878
931
  # with specific pages you have to call BrickletNFC#reader_request_page beforehand.
879
- #
880
- # The buffer can have a size of up to 8192 bytes.
881
932
  def reader_read_page
882
933
  data_length = nil # assigned in block
883
934
  data_data = nil # assigned in block
@@ -911,7 +962,7 @@ module Tinkerforge
911
962
  data_data[0, data_length]
912
963
  end
913
964
 
914
- # Writes the NDEF messages that is to be transferred to the NFC peer.
965
+ # Writes the NDEF message that is to be transferred to the NFC peer.
915
966
  #
916
967
  # The maximum supported NDEF message size in Cardemu mode is 255 byte.
917
968
  #
@@ -949,7 +1000,7 @@ module Tinkerforge
949
1000
  ret
950
1001
  end
951
1002
 
952
- # Writes the NDEF messages that is to be transferred to the NFC peer.
1003
+ # Writes the NDEF message that is to be transferred to the NFC peer.
953
1004
  #
954
1005
  # The maximum supported NDEF message size for P2P transfer is 255 byte.
955
1006
  #
@@ -988,7 +1039,6 @@ module Tinkerforge
988
1039
  end
989
1040
 
990
1041
  # Returns the NDEF message that was written by a NFC peer in NFC P2P mode.
991
- # The maximum NDEF length is 8192 byte.
992
1042
  #
993
1043
  # The NDEF message is ready if you called BrickletNFC#p2p_start_transfer with a
994
1044
  # read transfer and the P2P state changed to *P2PTransferNDEFReady*.