tinkerforge 2.1.8 → 2.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/lib/tinkerforge/brick_dc.rb +2 -2
  2. data/lib/tinkerforge/brick_imu.rb +2 -2
  3. data/lib/tinkerforge/brick_imu_v2.rb +2 -2
  4. data/lib/tinkerforge/brick_master.rb +410 -20
  5. data/lib/tinkerforge/brick_red.rb +2 -2
  6. data/lib/tinkerforge/brick_servo.rb +2 -2
  7. data/lib/tinkerforge/brick_stepper.rb +2 -2
  8. data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
  9. data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
  10. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +2 -2
  11. data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
  12. data/lib/tinkerforge/bricklet_analog_in_v2.rb +2 -2
  13. data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
  14. data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
  15. data/lib/tinkerforge/bricklet_barometer.rb +2 -2
  16. data/lib/tinkerforge/bricklet_can.rb +289 -0
  17. data/lib/tinkerforge/bricklet_co2.rb +2 -2
  18. data/lib/tinkerforge/bricklet_color.rb +2 -2
  19. data/lib/tinkerforge/bricklet_current12.rb +2 -2
  20. data/lib/tinkerforge/bricklet_current25.rb +2 -2
  21. data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
  22. data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
  23. data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
  24. data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
  25. data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
  26. data/lib/tinkerforge/bricklet_gps.rb +2 -2
  27. data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
  28. data/lib/tinkerforge/bricklet_humidity.rb +2 -2
  29. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
  30. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
  31. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
  32. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
  33. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
  34. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
  35. data/lib/tinkerforge/bricklet_io16.rb +3 -3
  36. data/lib/tinkerforge/bricklet_io4.rb +2 -2
  37. data/lib/tinkerforge/bricklet_joystick.rb +2 -2
  38. data/lib/tinkerforge/bricklet_laser_range_finder.rb +3 -3
  39. data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
  40. data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
  41. data/lib/tinkerforge/bricklet_led_strip.rb +3 -3
  42. data/lib/tinkerforge/bricklet_line.rb +2 -2
  43. data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
  44. data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
  45. data/lib/tinkerforge/bricklet_moisture.rb +2 -2
  46. data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
  47. data/lib/tinkerforge/bricklet_multi_touch.rb +3 -3
  48. data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
  49. data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
  50. data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
  51. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
  52. data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
  53. data/lib/tinkerforge/bricklet_ptc.rb +2 -2
  54. data/lib/tinkerforge/bricklet_real_time_clock.rb +96 -3
  55. data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
  56. data/lib/tinkerforge/bricklet_rgb_led.rb +59 -0
  57. data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
  58. data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
  59. data/lib/tinkerforge/bricklet_rs232.rb +2 -2
  60. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
  61. data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
  62. data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
  63. data/lib/tinkerforge/bricklet_temperature.rb +2 -2
  64. data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
  65. data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
  66. data/lib/tinkerforge/bricklet_tilt.rb +2 -2
  67. data/lib/tinkerforge/bricklet_uv_light.rb +2 -2
  68. data/lib/tinkerforge/bricklet_voltage.rb +2 -2
  69. data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
  70. data/lib/tinkerforge/version.rb +1 -1
  71. metadata +4 -2
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2016-02-10. #
3
+ # This file was automatically generated on 2016-06-30. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.8 #
5
+ # Ruby Bindings Version 2.1.9 #
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 #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2016-02-10. #
3
+ # This file was automatically generated on 2016-06-30. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.8 #
5
+ # Ruby Bindings Version 2.1.9 #
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 #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2016-02-10. #
3
+ # This file was automatically generated on 2016-06-30. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.8 #
5
+ # Ruby Bindings Version 2.1.9 #
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 #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2016-02-10. #
3
+ # This file was automatically generated on 2016-06-30. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.8 #
5
+ # Ruby Bindings Version 2.1.9 #
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 #
@@ -147,6 +147,31 @@ module Tinkerforge
147
147
  FUNCTION_GET_ETHERNET_AUTHENTICATION_SECRET = 74 # :nodoc:
148
148
  FUNCTION_SET_WIFI_AUTHENTICATION_SECRET = 75 # :nodoc:
149
149
  FUNCTION_GET_WIFI_AUTHENTICATION_SECRET = 76 # :nodoc:
150
+ FUNCTION_GET_CONNECTION_TYPE = 77 # :nodoc:
151
+ FUNCTION_IS_WIFI2_PRESENT = 78 # :nodoc:
152
+ FUNCTION_START_WIFI2_BOOTLOADER = 79 # :nodoc:
153
+ FUNCTION_WRITE_WIFI2_SERIAL_PORT = 80 # :nodoc:
154
+ FUNCTION_READ_WIFI2_SERIAL_PORT = 81 # :nodoc:
155
+ FUNCTION_SET_WIFI2_AUTHENTICATION_SECRET = 82 # :nodoc:
156
+ FUNCTION_GET_WIFI2_AUTHENTICATION_SECRET = 83 # :nodoc:
157
+ FUNCTION_SET_WIFI2_CONFIGURATION = 84 # :nodoc:
158
+ FUNCTION_GET_WIFI2_CONFIGURATION = 85 # :nodoc:
159
+ FUNCTION_GET_WIFI2_STATUS = 86 # :nodoc:
160
+ FUNCTION_SET_WIFI2_CLIENT_CONFIGURATION = 87 # :nodoc:
161
+ FUNCTION_GET_WIFI2_CLIENT_CONFIGURATION = 88 # :nodoc:
162
+ FUNCTION_SET_WIFI2_CLIENT_HOSTNAME = 89 # :nodoc:
163
+ FUNCTION_GET_WIFI2_CLIENT_HOSTNAME = 90 # :nodoc:
164
+ FUNCTION_SET_WIFI2_CLIENT_PASSWORD = 91 # :nodoc:
165
+ FUNCTION_GET_WIFI2_CLIENT_PASSWORD = 92 # :nodoc:
166
+ FUNCTION_SET_WIFI2_AP_CONFIGURATION = 93 # :nodoc:
167
+ FUNCTION_GET_WIFI2_AP_CONFIGURATION = 94 # :nodoc:
168
+ FUNCTION_SET_WIFI2_AP_PASSWORD = 95 # :nodoc:
169
+ FUNCTION_GET_WIFI2_AP_PASSWORD = 96 # :nodoc:
170
+ FUNCTION_SAVE_WIFI2_CONFIGURATION = 97 # :nodoc:
171
+ FUNCTION_GET_WIFI2_FIRMWARE_VERSION = 98 # :nodoc:
172
+ FUNCTION_ENABLE_WIFI2_STATUS_LED = 99 # :nodoc:
173
+ FUNCTION_DISABLE_WIFI2_STATUS_LED = 100 # :nodoc:
174
+ FUNCTION_IS_WIFI2_STATUS_LED_ENABLED = 101 # :nodoc:
150
175
  FUNCTION_ENABLE_STATUS_LED = 238 # :nodoc:
151
176
  FUNCTION_DISABLE_STATUS_LED = 239 # :nodoc:
152
177
  FUNCTION_IS_STATUS_LED_ENABLED = 240 # :nodoc:
@@ -159,6 +184,7 @@ module Tinkerforge
159
184
  EXTENSION_TYPE_RS485 = 2 # :nodoc:
160
185
  EXTENSION_TYPE_WIFI = 3 # :nodoc:
161
186
  EXTENSION_TYPE_ETHERNET = 4 # :nodoc:
187
+ EXTENSION_TYPE_WIFI2 = 5 # :nodoc:
162
188
  CHIBI_FREQUENCY_OQPSK_868_MHZ = 0 # :nodoc:
163
189
  CHIBI_FREQUENCY_OQPSK_915_MHZ = 1 # :nodoc:
164
190
  CHIBI_FREQUENCY_OQPSK_780_MHZ = 2 # :nodoc:
@@ -202,13 +228,35 @@ module Tinkerforge
202
228
  THRESHOLD_OPTION_GREATER = '>' # :nodoc:
203
229
  ETHERNET_CONNECTION_DHCP = 0 # :nodoc:
204
230
  ETHERNET_CONNECTION_STATIC_IP = 1 # :nodoc:
231
+ CONNECTION_TYPE_NONE = 0 # :nodoc:
232
+ CONNECTION_TYPE_USB = 1 # :nodoc:
233
+ CONNECTION_TYPE_SPI_STACK = 2 # :nodoc:
234
+ CONNECTION_TYPE_CHIBI = 3 # :nodoc:
235
+ CONNECTION_TYPE_RS485 = 4 # :nodoc:
236
+ CONNECTION_TYPE_WIFI = 5 # :nodoc:
237
+ CONNECTION_TYPE_ETHERNET = 6 # :nodoc:
238
+ CONNECTION_TYPE_WIFI2 = 7 # :nodoc:
239
+ WIFI2_PHY_MODE_B = 0 # :nodoc:
240
+ WIFI2_PHY_MODE_G = 1 # :nodoc:
241
+ WIFI2_PHY_MODE_N = 2 # :nodoc:
242
+ WIFI2_CLIENT_STATUS_IDLE = 0 # :nodoc:
243
+ WIFI2_CLIENT_STATUS_CONNECTING = 1 # :nodoc:
244
+ WIFI2_CLIENT_STATUS_WRONG_PASSWORD = 2 # :nodoc:
245
+ WIFI2_CLIENT_STATUS_NO_AP_FOUND = 3 # :nodoc:
246
+ WIFI2_CLIENT_STATUS_CONNECT_FAILED = 4 # :nodoc:
247
+ WIFI2_CLIENT_STATUS_GOT_IP = 5 # :nodoc:
248
+ WIFI2_AP_ENCRYPTION_OPEN = 0 # :nodoc:
249
+ WIFI2_AP_ENCRYPTION_WEP = 1 # :nodoc:
250
+ WIFI2_AP_ENCRYPTION_WPA_PSK = 2 # :nodoc:
251
+ WIFI2_AP_ENCRYPTION_WPA2_PSK = 3 # :nodoc:
252
+ WIFI2_AP_ENCRYPTION_WPA_WPA2_PSK = 4 # :nodoc:
205
253
 
206
254
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
207
255
  # the IP Connection <tt>ipcon</tt>.
208
256
  def initialize(uid, ipcon)
209
257
  super uid, ipcon
210
258
 
211
- @api_version = [2, 0, 3]
259
+ @api_version = [2, 0, 4]
212
260
 
213
261
  @response_expected[FUNCTION_GET_STACK_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
214
262
  @response_expected[FUNCTION_GET_STACK_CURRENT] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -286,6 +334,31 @@ module Tinkerforge
286
334
  @response_expected[FUNCTION_GET_ETHERNET_AUTHENTICATION_SECRET] = RESPONSE_EXPECTED_ALWAYS_TRUE
287
335
  @response_expected[FUNCTION_SET_WIFI_AUTHENTICATION_SECRET] = RESPONSE_EXPECTED_FALSE
288
336
  @response_expected[FUNCTION_GET_WIFI_AUTHENTICATION_SECRET] = RESPONSE_EXPECTED_ALWAYS_TRUE
337
+ @response_expected[FUNCTION_GET_CONNECTION_TYPE] = RESPONSE_EXPECTED_ALWAYS_TRUE
338
+ @response_expected[FUNCTION_IS_WIFI2_PRESENT] = RESPONSE_EXPECTED_ALWAYS_TRUE
339
+ @response_expected[FUNCTION_START_WIFI2_BOOTLOADER] = RESPONSE_EXPECTED_ALWAYS_TRUE
340
+ @response_expected[FUNCTION_WRITE_WIFI2_SERIAL_PORT] = RESPONSE_EXPECTED_ALWAYS_TRUE
341
+ @response_expected[FUNCTION_READ_WIFI2_SERIAL_PORT] = RESPONSE_EXPECTED_ALWAYS_TRUE
342
+ @response_expected[FUNCTION_SET_WIFI2_AUTHENTICATION_SECRET] = RESPONSE_EXPECTED_FALSE
343
+ @response_expected[FUNCTION_GET_WIFI2_AUTHENTICATION_SECRET] = RESPONSE_EXPECTED_ALWAYS_TRUE
344
+ @response_expected[FUNCTION_SET_WIFI2_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
345
+ @response_expected[FUNCTION_GET_WIFI2_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
346
+ @response_expected[FUNCTION_GET_WIFI2_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
347
+ @response_expected[FUNCTION_SET_WIFI2_CLIENT_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
348
+ @response_expected[FUNCTION_GET_WIFI2_CLIENT_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
349
+ @response_expected[FUNCTION_SET_WIFI2_CLIENT_HOSTNAME] = RESPONSE_EXPECTED_FALSE
350
+ @response_expected[FUNCTION_GET_WIFI2_CLIENT_HOSTNAME] = RESPONSE_EXPECTED_ALWAYS_TRUE
351
+ @response_expected[FUNCTION_SET_WIFI2_CLIENT_PASSWORD] = RESPONSE_EXPECTED_FALSE
352
+ @response_expected[FUNCTION_GET_WIFI2_CLIENT_PASSWORD] = RESPONSE_EXPECTED_ALWAYS_TRUE
353
+ @response_expected[FUNCTION_SET_WIFI2_AP_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
354
+ @response_expected[FUNCTION_GET_WIFI2_AP_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
355
+ @response_expected[FUNCTION_SET_WIFI2_AP_PASSWORD] = RESPONSE_EXPECTED_FALSE
356
+ @response_expected[FUNCTION_GET_WIFI2_AP_PASSWORD] = RESPONSE_EXPECTED_ALWAYS_TRUE
357
+ @response_expected[FUNCTION_SAVE_WIFI2_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
358
+ @response_expected[FUNCTION_GET_WIFI2_FIRMWARE_VERSION] = RESPONSE_EXPECTED_ALWAYS_TRUE
359
+ @response_expected[FUNCTION_ENABLE_WIFI2_STATUS_LED] = RESPONSE_EXPECTED_FALSE
360
+ @response_expected[FUNCTION_DISABLE_WIFI2_STATUS_LED] = RESPONSE_EXPECTED_FALSE
361
+ @response_expected[FUNCTION_IS_WIFI2_STATUS_LED_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
289
362
  @response_expected[FUNCTION_ENABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
290
363
  @response_expected[FUNCTION_DISABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
291
364
  @response_expected[FUNCTION_IS_STATUS_LED_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -303,7 +376,7 @@ module Tinkerforge
303
376
  end
304
377
 
305
378
  # Returns the stack voltage in mV. The stack voltage is the
306
- # voltage that is supplied via the stack, i.e. it is given by a
379
+ # voltage that is supplied via the stack, i.e. it is given by a
307
380
  # Step-Down or Step-Up Power Supply.
308
381
  def get_stack_voltage
309
382
  send_request(FUNCTION_GET_STACK_VOLTAGE, [], '', 2, 'S')
@@ -316,8 +389,8 @@ module Tinkerforge
316
389
  send_request(FUNCTION_GET_STACK_CURRENT, [], '', 2, 'S')
317
390
  end
318
391
 
319
- # Writes the extension type to the EEPROM of a specified extension.
320
- # The extension is either 0 or 1 (0 is the on the bottom, 1 is the on on top,
392
+ # Writes the extension type to the EEPROM of a specified extension.
393
+ # The extension is either 0 or 1 (0 is the on the bottom, 1 is the one on top,
321
394
  # if only one extension is present use 0).
322
395
  #
323
396
  # Possible extension types:
@@ -328,8 +401,9 @@ module Tinkerforge
328
401
  # "2", "RS485"
329
402
  # "3", "WIFI"
330
403
  # "4", "Ethernet"
404
+ # "5", "WIFI 2.0"
331
405
  #
332
- # The extension type is already set when bought and it can be set with the
406
+ # The extension type is already set when bought and it can be set with the
333
407
  # Brick Viewer, it is unlikely that you need this function.
334
408
  def set_extension_type(extension, exttype)
335
409
  send_request(FUNCTION_SET_EXTENSION_TYPE, [extension, exttype], 'C L', 0, '')
@@ -347,7 +421,7 @@ module Tinkerforge
347
421
 
348
422
  # Sets the address (1-255) belonging to the Chibi Extension.
349
423
  #
350
- # It is possible to set the address with the Brick Viewer and it will be
424
+ # It is possible to set the address with the Brick Viewer and it will be
351
425
  # saved in the EEPROM of the Chibi Extension, it does not
352
426
  # have to be set on every startup.
353
427
  def set_chibi_address(address)
@@ -362,7 +436,7 @@ module Tinkerforge
362
436
  # Sets the address (1-255) of the Chibi Master. This address is used if the
363
437
  # Chibi Extension is used as slave (i.e. it does not have a USB connection).
364
438
  #
365
- # It is possible to set the address with the Brick Viewer and it will be
439
+ # It is possible to set the address with the Brick Viewer and it will be
366
440
  # saved in the EEPROM of the Chibi Extension, it does not
367
441
  # have to be set on every startup.
368
442
  def set_chibi_master_address(address)
@@ -422,7 +496,7 @@ module Tinkerforge
422
496
  # "2", "OQPSK 780MHz (China)"
423
497
  # "3", "BPSK40 915MHz"
424
498
  #
425
- # It is possible to set the frequency with the Brick Viewer and it will be
499
+ # It is possible to set the frequency with the Brick Viewer and it will be
426
500
  # saved in the EEPROM of the Chibi Extension, it does not
427
501
  # have to be set on every startup.
428
502
  def set_chibi_frequency(frequency)
@@ -444,7 +518,7 @@ module Tinkerforge
444
518
  # "OQPSK 780MHz (China)", "0, 1, 2, 3"
445
519
  # "BPSK40 915MHz", "1, 2, 3, 4, 5, 6, 7, 8, 9, 10"
446
520
  #
447
- # It is possible to set the channel with the Brick Viewer and it will be
521
+ # It is possible to set the channel with the Brick Viewer and it will be
448
522
  # saved in the EEPROM of the Chibi Extension, it does not
449
523
  # have to be set on every startup.
450
524
  def set_chibi_channel(channel)
@@ -466,7 +540,7 @@ module Tinkerforge
466
540
  # Set to 0 if the RS485 Extension should be the RS485 Master (i.e.
467
541
  # connected to a PC via USB).
468
542
  #
469
- # It is possible to set the address with the Brick Viewer and it will be
543
+ # It is possible to set the address with the Brick Viewer and it will be
470
544
  # saved in the EEPROM of the RS485 Extension, it does not
471
545
  # have to be set on every startup.
472
546
  def set_rs485_address(address)
@@ -648,7 +722,7 @@ module Tinkerforge
648
722
 
649
723
  # This function is used to set the certificate as well as password and username
650
724
  # for WPA Enterprise. To set the username use index 0xFFFF,
651
- # to set the password use index 0xFFFE. The max length of username and
725
+ # to set the password use index 0xFFFE. The max length of username and
652
726
  # password is 32.
653
727
  #
654
728
  # The certificate is written in chunks of size 32 and the index is used as
@@ -694,7 +768,7 @@ module Tinkerforge
694
768
  # receive buffer has a max size of 1500 byte and if data is transfered
695
769
  # too fast, it might overflow.
696
770
  #
697
- # The return values are the number of overflows, the low watermark
771
+ # The return values are the number of overflows, the low watermark
698
772
  # (i.e. the smallest number of bytes that were free in the buffer) and
699
773
  # the bytes that are currently used.
700
774
  #
@@ -751,7 +825,7 @@ module Tinkerforge
751
825
  send_request(FUNCTION_GET_LONG_WIFI_KEY, [], '', 64, 'Z64')
752
826
  end
753
827
 
754
- # Sets the hostname of the WIFI Extension. The hostname will be displayed
828
+ # Sets the hostname of the WIFI Extension. The hostname will be displayed
755
829
  # by access points as the hostname in the DHCP clients table.
756
830
  #
757
831
  # Setting an empty String will restore the default hostname.
@@ -761,7 +835,7 @@ module Tinkerforge
761
835
  send_request(FUNCTION_SET_WIFI_HOSTNAME, [hostname], 'Z16', 0, '')
762
836
  end
763
837
 
764
- # Returns the hostname as set by BrickMaster#get_wifi_hostname.
838
+ # Returns the hostname as set by BrickMaster#set_wifi_hostname.
765
839
  #
766
840
  # An empty String means, that the default hostname is used.
767
841
  #
@@ -830,7 +904,7 @@ module Tinkerforge
830
904
  send_request(FUNCTION_GET_USB_VOLTAGE_CALLBACK_PERIOD, [], '', 4, 'L')
831
905
  end
832
906
 
833
- # Sets the thresholds for the CALLBACK_STACK_CURRENT_REACHED callback.
907
+ # Sets the thresholds for the CALLBACK_STACK_CURRENT_REACHED callback.
834
908
  #
835
909
  # The following options are possible:
836
910
  #
@@ -856,7 +930,7 @@ module Tinkerforge
856
930
  send_request(FUNCTION_GET_STACK_CURRENT_CALLBACK_THRESHOLD, [], '', 5, 'k S S')
857
931
  end
858
932
 
859
- # Sets the thresholds for the :func:`StackStackVoltageReached` callback.
933
+ # Sets the thresholds for the :func:`StackStackVoltageReached` callback.
860
934
  #
861
935
  # The following options are possible:
862
936
  #
@@ -882,7 +956,7 @@ module Tinkerforge
882
956
  send_request(FUNCTION_GET_STACK_VOLTAGE_CALLBACK_THRESHOLD, [], '', 5, 'k S S')
883
957
  end
884
958
 
885
- # Sets the thresholds for the CALLBACK_USB_VOLTAGE_REACHED callback.
959
+ # Sets the thresholds for the CALLBACK_USB_VOLTAGE_REACHED callback.
886
960
  #
887
961
  # The following options are possible:
888
962
  #
@@ -993,7 +1067,7 @@ module Tinkerforge
993
1067
  send_request(FUNCTION_GET_ETHERNET_STATUS, [], '', 58, 'C6 C4 C4 C4 L L Z32')
994
1068
  end
995
1069
 
996
- # Sets the hostname of the Ethernet Extension. The hostname will be displayed
1070
+ # Sets the hostname of the Ethernet Extension. The hostname will be displayed
997
1071
  # by access points as the hostname in the DHCP clients table.
998
1072
  #
999
1073
  # Setting an empty String will restore the default hostname.
@@ -1093,6 +1167,322 @@ module Tinkerforge
1093
1167
  send_request(FUNCTION_GET_WIFI_AUTHENTICATION_SECRET, [], '', 64, 'Z64')
1094
1168
  end
1095
1169
 
1170
+ # Returns the type of the connection over which this function was called.
1171
+ #
1172
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1173
+ def get_connection_type
1174
+ send_request(FUNCTION_GET_CONNECTION_TYPE, [], '', 1, 'C')
1175
+ end
1176
+
1177
+ # Returns *true* if a WIFI Extension 2.0 is available to be used by the Master
1178
+ # Brick.
1179
+ #
1180
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1181
+ def is_wifi2_present
1182
+ send_request(FUNCTION_IS_WIFI2_PRESENT, [], '', 1, '?')
1183
+ end
1184
+
1185
+ # Starts the bootloader of the WIFI Extension 2.0. Returns 0 on success.
1186
+ # Afterwards the BrickMaster#write_wifi2_serial_port and BrickMaster#read_wifi2_serial_port
1187
+ # functions can be used to communicate with the bootloader to flash a new
1188
+ # firmware.
1189
+ #
1190
+ # The bootloader should only be started over a USB connection. It cannot be
1191
+ # started over a WIFI2 connection, see the BrickMaster#get_connection_type function.
1192
+ #
1193
+ # It is recommended to use the Brick Viewer to update the firmware of the WIFI
1194
+ # Extension 2.0.
1195
+ #
1196
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1197
+ def start_wifi2_bootloader
1198
+ send_request(FUNCTION_START_WIFI2_BOOTLOADER, [], '', 1, 'c')
1199
+ end
1200
+
1201
+ # Writes up to 60 bytes (number of bytes to be written specified by ``length``)
1202
+ # to the serial port of the bootloader of the WIFI Extension 2.0. Returns 0 on
1203
+ # success.
1204
+ #
1205
+ # Before this function can be used the bootloader has to be started using the
1206
+ # BrickMaster#start_wifi2_bootloader function.
1207
+ #
1208
+ # It is recommended to use the Brick Viewer to update the firmware of the WIFI
1209
+ # Extension 2.0.
1210
+ #
1211
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1212
+ def write_wifi2_serial_port(data, length)
1213
+ send_request(FUNCTION_WRITE_WIFI2_SERIAL_PORT, [data, length], 'C60 C', 1, 'c')
1214
+ end
1215
+
1216
+ # Reads up to 60 bytes (number of bytes to be read specified by ``length``)
1217
+ # from the serial port of the bootloader of the WIFI Extension 2.0.
1218
+ # Returns the number of actually read bytes.
1219
+ #
1220
+ # Before this function can be used the bootloader has to be started using the
1221
+ # BrickMaster#start_wifi2_bootloader function.
1222
+ #
1223
+ # It is recommended to use the Brick Viewer to update the firmware of the WIFI
1224
+ # Extension 2.0.
1225
+ #
1226
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1227
+ def read_wifi2_serial_port(length)
1228
+ send_request(FUNCTION_READ_WIFI2_SERIAL_PORT, [length], 'C', 61, 'C60 C')
1229
+ end
1230
+
1231
+ # Sets the WIFI authentication secret. The secret can be a string of up to 64
1232
+ # characters. An empty string disables the authentication. The default value is
1233
+ # an empty string (authentication disabled).
1234
+ #
1235
+ # See the :ref:`authentication tutorial <tutorial_authentication>` for more
1236
+ # information.
1237
+ #
1238
+ # To apply configuration changes to the WIFI Extension 2.0 the
1239
+ # BrickMaster#save_wifi2_configuration function has to be called and the Master Brick
1240
+ # has to be restarted afterwards.
1241
+ #
1242
+ # It is recommended to use the Brick Viewer to set the WIFI authentication secret.
1243
+ #
1244
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1245
+ def set_wifi2_authentication_secret(secret)
1246
+ send_request(FUNCTION_SET_WIFI2_AUTHENTICATION_SECRET, [secret], 'Z64', 0, '')
1247
+ end
1248
+
1249
+ # Returns the WIFI authentication secret as set by
1250
+ # BrickMaster#set_wifi2_authentication_secret.
1251
+ #
1252
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1253
+ def get_wifi2_authentication_secret
1254
+ send_request(FUNCTION_GET_WIFI2_AUTHENTICATION_SECRET, [], '', 64, 'Z64')
1255
+ end
1256
+
1257
+ # Sets the general configuration of the WIFI Extension 2.0.
1258
+ #
1259
+ # The ``port`` parameter sets the port number that your programm will connect
1260
+ # to. The default value is 4223.
1261
+ #
1262
+ # The ``websocket_port`` parameter sets the WebSocket port number that your
1263
+ # JavaScript programm will connect to. The default value is 4280.
1264
+ #
1265
+ # The ``website_port`` parameter sets the port number for the website of the
1266
+ # WIFI Extension 2.0. The default value is 80.
1267
+ #
1268
+ # The ``phy_mode`` parameter sets the specific wireless network mode to be used.
1269
+ # Possible values are B, G and N. The default value is G.
1270
+ #
1271
+ # The ``sleep_mode`` and ``website`` parameters are currently unused.
1272
+ #
1273
+ # To apply configuration changes to the WIFI Extension 2.0 the
1274
+ # BrickMaster#save_wifi2_configuration function has to be called and the Master Brick
1275
+ # has to be restarted afterwards.
1276
+ #
1277
+ # It is recommended to use the Brick Viewer to set the Ethernet configuration.
1278
+ #
1279
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1280
+ def set_wifi2_configuration(port, websocket_port, website_port, phy_mode, sleep_mode, website)
1281
+ send_request(FUNCTION_SET_WIFI2_CONFIGURATION, [port, websocket_port, website_port, phy_mode, sleep_mode, website], 'S S S C C C', 0, '')
1282
+ end
1283
+
1284
+ # Returns the general configuration as set by BrickMaster#set_wifi2_configuration.
1285
+ #
1286
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1287
+ def get_wifi2_configuration
1288
+ send_request(FUNCTION_GET_WIFI2_CONFIGURATION, [], '', 9, 'S S S C C C')
1289
+ end
1290
+
1291
+ # Returns the client and access point status of the WIFI Extension 2.0.
1292
+ #
1293
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1294
+ def get_wifi2_status
1295
+ send_request(FUNCTION_GET_WIFI2_STATUS, [], '', 57, '? C C4 C4 C4 C6 L L c ? C4 C4 C4 C6 L L C')
1296
+ end
1297
+
1298
+ # Sets the client specific configuration of the WIFI Extension 2.0.
1299
+ #
1300
+ # The ``enable`` parameter enables or disables the client part fo the
1301
+ # WIFI Extension 2.0. The default value is *true*.
1302
+ #
1303
+ # The ``ssid`` parameter sets the SSID (up to 32 characters) of the access point
1304
+ # to connect to.
1305
+ #
1306
+ # If the ``ip``, ``subnet_mask`` and ``gateway`` parameters are set to all zero
1307
+ # then DHCP is used for IP address configuration. Otherwise those three
1308
+ # parameters can be used to configure a static IP address. The default
1309
+ # configuration is DHCP.
1310
+ #
1311
+ # If the ``mac_address`` parameter is set to all zero then the factory MAC
1312
+ # address is used. Otherwise this parameter can be used to set a custom MAC
1313
+ # address.
1314
+ #
1315
+ # If the ``bssid`` parameter is set to all zero then WIFI Extension 2.0 will
1316
+ # connect to any access point that matches the configured SSID. Otherwise this
1317
+ # parameter can be used to make the WIFI Extension 2.0 only connect to an
1318
+ # access point if SSID and BSSID match.
1319
+ #
1320
+ # To apply configuration changes to the WIFI Extension 2.0 the
1321
+ # BrickMaster#save_wifi2_configuration function has to be called and the Master Brick
1322
+ # has to be restarted afterwards.
1323
+ #
1324
+ # It is recommended to use the Brick Viewer to set the client configuration.
1325
+ #
1326
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1327
+ def set_wifi2_client_configuration(enable, ssid, ip, subnet_mask, gateway, mac_address, bssid)
1328
+ send_request(FUNCTION_SET_WIFI2_CLIENT_CONFIGURATION, [enable, ssid, ip, subnet_mask, gateway, mac_address, bssid], '? Z32 C4 C4 C4 C6 C6', 0, '')
1329
+ end
1330
+
1331
+ # Returns the client configuration as set by BrickMaster#set_wifi2_client_configuration.
1332
+ #
1333
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1334
+ def get_wifi2_client_configuration
1335
+ send_request(FUNCTION_GET_WIFI2_CLIENT_CONFIGURATION, [], '', 57, '? Z32 C4 C4 C4 C6 C6')
1336
+ end
1337
+
1338
+ # Sets the client hostname (up to 32 characters) of the WIFI Extension 2.0. The
1339
+ # hostname will be displayed by access points as the hostname in the DHCP clients
1340
+ # table.
1341
+ #
1342
+ # To apply configuration changes to the WIFI Extension 2.0 the
1343
+ # BrickMaster#save_wifi2_configuration function has to be called and the Master Brick
1344
+ # has to be restarted afterwards.
1345
+ #
1346
+ # It is recommended to use the Brick Viewer to set the client hostname.
1347
+ #
1348
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1349
+ def set_wifi2_client_hostname(hostname)
1350
+ send_request(FUNCTION_SET_WIFI2_CLIENT_HOSTNAME, [hostname], 'Z32', 0, '')
1351
+ end
1352
+
1353
+ # Returns the client hostname as set by BrickMaster#set_wifi2_client_hostname.
1354
+ #
1355
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1356
+ def get_wifi2_client_hostname
1357
+ send_request(FUNCTION_GET_WIFI2_CLIENT_HOSTNAME, [], '', 32, 'Z32')
1358
+ end
1359
+
1360
+ # Sets the client password (up to 63 chars) for WPA/WPA2 encryption.
1361
+ #
1362
+ # To apply configuration changes to the WIFI Extension 2.0 the
1363
+ # BrickMaster#save_wifi2_configuration function has to be called and the Master Brick
1364
+ # has to be restarted afterwards.
1365
+ #
1366
+ # It is recommended to use the Brick Viewer to set the client password.
1367
+ #
1368
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1369
+ def set_wifi2_client_password(password)
1370
+ send_request(FUNCTION_SET_WIFI2_CLIENT_PASSWORD, [password], 'Z64', 0, '')
1371
+ end
1372
+
1373
+ # Returns the client password as set by BrickMaster#set_wifi2_client_password.
1374
+ #
1375
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1376
+ def get_wifi2_client_password
1377
+ send_request(FUNCTION_GET_WIFI2_CLIENT_PASSWORD, [], '', 64, 'Z64')
1378
+ end
1379
+
1380
+ # Sets the access point specific configuration of the WIFI Extension 2.0.
1381
+ #
1382
+ # The ``enable`` parameter enables or disables the access point part fo the
1383
+ # WIFI Extension 2.0. The default value is true.
1384
+ #
1385
+ # The ``ssid`` parameter sets the SSID (up to 32 characters) of the access point.
1386
+ #
1387
+ # If the ``ip``, ``subnet_mask`` and ``gateway`` parameters are set to all zero
1388
+ # then a DHCP server is enabled. Otherwise those three parameters can be used to
1389
+ # configure a static IP address for the access point. The default configuration
1390
+ # is DHCP.
1391
+ #
1392
+ # The ``encryption`` parameter sets the encryption mode to be used. Possible
1393
+ # values are Open (no encryption), WEP or WPA/WPA2 PSK. The default value is
1394
+ # WPA/WPA2 PSK. Use the BrickMaster#set_wifi2_ap_password function to set the encryption
1395
+ # password.
1396
+ #
1397
+ # The ``hidden`` parameter makes the access point hide or show its SSID.
1398
+ # The default value is *false*.
1399
+ #
1400
+ # The ``channel`` parameter sets the channel (1 to 13) of the access point.
1401
+ # The default value is 1.
1402
+ #
1403
+ # If the ``mac_address`` parameter is set to all zero then the factory MAC
1404
+ # address is used. Otherwise this parameter can be used to set a custom MAC
1405
+ # address.
1406
+ #
1407
+ # To apply configuration changes to the WIFI Extension 2.0 the
1408
+ # BrickMaster#save_wifi2_configuration function has to be called and the Master Brick
1409
+ # has to be restarted afterwards.
1410
+ #
1411
+ # It is recommended to use the Brick Viewer to set the access point configuration.
1412
+ #
1413
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1414
+ def set_wifi2_ap_configuration(enable, ssid, ip, subnet_mask, gateway, encryption, hidden, channel, mac_address)
1415
+ 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, '')
1416
+ end
1417
+
1418
+ # Returns the access point configuration as set by BrickMaster#set_wifi2_ap_configuration.
1419
+ #
1420
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1421
+ def get_wifi2_ap_configuration
1422
+ send_request(FUNCTION_GET_WIFI2_AP_CONFIGURATION, [], '', 54, '? Z32 C4 C4 C4 C ? C C6')
1423
+ end
1424
+
1425
+ # Sets the access point password (up to 63 chars) for the configured encryption
1426
+ # mode, see BrickMaster#set_wifi2_ap_configuration.
1427
+ #
1428
+ # To apply configuration changes to the WIFI Extension 2.0 the
1429
+ # BrickMaster#save_wifi2_configuration function has to be called and the Master Brick
1430
+ # has to be restarted afterwards.
1431
+ #
1432
+ # It is recommended to use the Brick Viewer to set the access point password.
1433
+ #
1434
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1435
+ def set_wifi2_ap_password(password)
1436
+ send_request(FUNCTION_SET_WIFI2_AP_PASSWORD, [password], 'Z64', 0, '')
1437
+ end
1438
+
1439
+ # Returns the access point password as set by BrickMaster#set_wifi2_ap_password.
1440
+ #
1441
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1442
+ def get_wifi2_ap_password
1443
+ send_request(FUNCTION_GET_WIFI2_AP_PASSWORD, [], '', 64, 'Z64')
1444
+ end
1445
+
1446
+ # All configuration functions for the WIFI Extension 2.0 do not change the
1447
+ # values permanently. After configuration this function has to be called to
1448
+ # permanently store the values.
1449
+ #
1450
+ # The values are stored in the EEPROM and only applied on startup. That means
1451
+ # you have to restart the Master Brick after configuration.
1452
+ #
1453
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1454
+ def save_wifi2_configuration
1455
+ send_request(FUNCTION_SAVE_WIFI2_CONFIGURATION, [], '', 1, 'C')
1456
+ end
1457
+
1458
+ # Returns the current version of the WIFI Extension 2.0 firmware (major, minor, revision).
1459
+ #
1460
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1461
+ def get_wifi2_firmware_version
1462
+ send_request(FUNCTION_GET_WIFI2_FIRMWARE_VERSION, [], '', 3, 'C3')
1463
+ end
1464
+
1465
+ # Turns the green status LED of the WIFI Extension 2.0 on.
1466
+ #
1467
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1468
+ def enable_wifi2_status_led
1469
+ send_request(FUNCTION_ENABLE_WIFI2_STATUS_LED, [], '', 0, '')
1470
+ end
1471
+
1472
+ # Turns the green status LED of the WIFI Extension 2.0 off.
1473
+ #
1474
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1475
+ def disable_wifi2_status_led
1476
+ send_request(FUNCTION_DISABLE_WIFI2_STATUS_LED, [], '', 0, '')
1477
+ end
1478
+
1479
+ # Returns *true* if the green status LED of the WIFI Extension 2.0 is turned on.
1480
+ #
1481
+ # .. versionadded:: 2.4.0$nbsp;(Firmware)
1482
+ def is_wifi2_status_led_enabled
1483
+ send_request(FUNCTION_IS_WIFI2_STATUS_LED_ENABLED, [], '', 1, '?')
1484
+ end
1485
+
1096
1486
  # Enables the status LED.
1097
1487
  #
1098
1488
  # The status LED is the blue LED next to the USB connector. If enabled is is