tinkerforge 2.0.8 → 2.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/lib/tinkerforge/brick_dc.rb +6 -4
  2. data/lib/tinkerforge/brick_imu.rb +20 -17
  3. data/lib/tinkerforge/brick_master.rb +62 -58
  4. data/lib/tinkerforge/brick_servo.rb +6 -4
  5. data/lib/tinkerforge/brick_stepper.rb +6 -4
  6. data/lib/tinkerforge/bricklet_ambient_light.rb +6 -4
  7. data/lib/tinkerforge/bricklet_analog_in.rb +8 -6
  8. data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
  9. data/lib/tinkerforge/bricklet_barometer.rb +6 -4
  10. data/lib/tinkerforge/bricklet_current12.rb +6 -4
  11. data/lib/tinkerforge/bricklet_current25.rb +6 -4
  12. data/lib/tinkerforge/bricklet_distance_ir.rb +6 -4
  13. data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
  14. data/lib/tinkerforge/bricklet_gps.rb +7 -7
  15. data/lib/tinkerforge/bricklet_humidity.rb +6 -4
  16. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
  17. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
  18. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +7 -6
  19. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
  20. data/lib/tinkerforge/bricklet_io16.rb +3 -3
  21. data/lib/tinkerforge/bricklet_io4.rb +2 -2
  22. data/lib/tinkerforge/bricklet_joystick.rb +6 -4
  23. data/lib/tinkerforge/bricklet_lcd_16x2.rb +12 -12
  24. data/lib/tinkerforge/bricklet_lcd_20x4.rb +12 -12
  25. data/lib/tinkerforge/bricklet_linear_poti.rb +6 -4
  26. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
  27. data/lib/tinkerforge/bricklet_ptc.rb +9 -7
  28. data/lib/tinkerforge/bricklet_rotary_poti.rb +6 -4
  29. data/lib/tinkerforge/bricklet_temperature.rb +4 -4
  30. data/lib/tinkerforge/bricklet_temperature_ir.rb +6 -4
  31. data/lib/tinkerforge/bricklet_voltage.rb +6 -4
  32. data/lib/tinkerforge/bricklet_voltage_current.rb +8 -4
  33. data/lib/tinkerforge/ip_connection.rb +18 -13
  34. data/lib/tinkerforge/version.rb +1 -1
  35. metadata +3 -3
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2013-07-04. #
3
+ # This file was automatically generated on 2013-08-23. #
4
4
  # #
5
- # Bindings Version 2.0.8 #
5
+ # Bindings Version 2.0.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 #
@@ -201,11 +201,13 @@ module Tinkerforge
201
201
 
202
202
  # Sets the period in ms with which the threshold callbacks
203
203
  #
204
- # CALLBACK_POSITION_REACHED, CALLBACK_ANALOG_VALUE_REACHED
204
+ # * CALLBACK_POSITION_REACHED,
205
+ # * CALLBACK_ANALOG_VALUE_REACHED
205
206
  #
206
207
  # are triggered, if the thresholds
207
208
  #
208
- # BrickletLinearPoti#set_position_callback_threshold, BrickletLinearPoti#set_analog_value_callback_threshold
209
+ # * BrickletLinearPoti#set_position_callback_threshold,
210
+ # * BrickletLinearPoti#set_analog_value_callback_threshold
209
211
  #
210
212
  # keep being reached.
211
213
  #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2013-07-04. #
3
+ # This file was automatically generated on 2013-08-23. #
4
4
  # #
5
- # Bindings Version 2.0.8 #
5
+ # Bindings Version 2.0.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 2013-07-04. #
3
+ # This file was automatically generated on 2013-08-23. #
4
4
  # #
5
- # Bindings Version 2.0.8 #
5
+ # Bindings Version 2.0.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 #
@@ -215,11 +215,13 @@ module Tinkerforge
215
215
 
216
216
  # Sets the period in ms with which the threshold callback
217
217
  #
218
- # CALLBACK_TEMPERATURE_REACHED, CALLBACK_RESISTANCE_REACHED
218
+ # * CALLBACK_TEMPERATURE_REACHED,
219
+ # * CALLBACK_RESISTANCE_REACHED
219
220
  #
220
221
  # is triggered, if the threshold
221
222
  #
222
- # BrickletPTC#set_temperature_callback_threshold, BrickletPTC#set_resistance_callback_threshold
223
+ # * BrickletPTC#set_temperature_callback_threshold,
224
+ # * BrickletPTC#set_resistance_callback_threshold
223
225
  #
224
226
  # keeps being reached.
225
227
  #
@@ -258,9 +260,9 @@ module Tinkerforge
258
260
  send_request(FUNCTION_IS_SENSOR_CONNECTED, [], '', 1, '?')
259
261
  end
260
262
 
261
- # Sets the wire mode. Possible values are 2, 3 and 4.
262
- #
263
- # The values correspond to 2-, 3- and 4-wire sensors.
263
+ # Sets the wire mode of the sensor. Possible values are 2, 3 and 4 which
264
+ # correspond to 2-, 3- and 4-wire sensors. The value has to match the jumper
265
+ # configuration on the Bricklet.
264
266
  #
265
267
  # The default value is 2 = 2-wire.
266
268
  def set_wire_mode(mode)
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2013-07-04. #
3
+ # This file was automatically generated on 2013-08-23. #
4
4
  # #
5
- # Bindings Version 2.0.8 #
5
+ # Bindings Version 2.0.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 #
@@ -201,11 +201,13 @@ module Tinkerforge
201
201
 
202
202
  # Sets the period in ms with which the threshold callbacks
203
203
  #
204
- # CALLBACK_POSITION_REACHED, CALLBACK_ANALOG_VALUE_REACHED
204
+ # * CALLBACK_POSITION_REACHED,
205
+ # * CALLBACK_ANALOG_VALUE_REACHED
205
206
  #
206
207
  # are triggered, if the thresholds
207
208
  #
208
- # BrickletRotaryPoti#set_position_callback_threshold, BrickletRotaryPoti#set_analog_value_callback_threshold
209
+ # * BrickletRotaryPoti#set_position_callback_threshold,
210
+ # * BrickletRotaryPoti#set_analog_value_callback_threshold
209
211
  #
210
212
  # keep being reached.
211
213
  #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2013-07-04. #
3
+ # This file was automatically generated on 2013-08-23. #
4
4
  # #
5
- # Bindings Version 2.0.8 #
5
+ # Bindings Version 2.0.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 #
@@ -124,11 +124,11 @@ module Tinkerforge
124
124
 
125
125
  # Sets the period in ms with which the threshold callback
126
126
  #
127
- # CALLBACK_TEMPERATURE_REACHED
127
+ # * CALLBACK_TEMPERATURE_REACHED
128
128
  #
129
129
  # is triggered, if the threshold
130
130
  #
131
- # BrickletTemperature#set_temperature_callback_threshold
131
+ # * BrickletTemperature#set_temperature_callback_threshold
132
132
  #
133
133
  # keeps being reached.
134
134
  #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2013-07-04. #
3
+ # This file was automatically generated on 2013-08-23. #
4
4
  # #
5
- # Bindings Version 2.0.8 #
5
+ # Bindings Version 2.0.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 #
@@ -235,11 +235,13 @@ module Tinkerforge
235
235
 
236
236
  # Sets the period in ms with which the threshold callbacks
237
237
  #
238
- # CALLBACK_AMBIENT_TEMPERATURE_REACHED, CALLBACK_OBJECT_TEMPERATURE_REACHED
238
+ # * CALLBACK_AMBIENT_TEMPERATURE_REACHED,
239
+ # * CALLBACK_OBJECT_TEMPERATURE_REACHED
239
240
  #
240
241
  # are triggered, if the thresholds
241
242
  #
242
- # BrickletTemperatureIR#set_ambient_temperature_callback_threshold, BrickletTemperatureIR#set_object_temperature_callback_threshold
243
+ # * BrickletTemperatureIR#set_ambient_temperature_callback_threshold,
244
+ # * BrickletTemperatureIR#set_object_temperature_callback_threshold
243
245
  #
244
246
  # keep being reached.
245
247
  #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2013-07-04. #
3
+ # This file was automatically generated on 2013-08-23. #
4
4
  # #
5
- # Bindings Version 2.0.8 #
5
+ # Bindings Version 2.0.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 #
@@ -201,11 +201,13 @@ module Tinkerforge
201
201
 
202
202
  # Sets the period in ms with which the threshold callbacks
203
203
  #
204
- # CALLBACK_VOLTAGE_REACHED, CALLBACK_ANALOG_VALUE_REACHED
204
+ # * CALLBACK_VOLTAGE_REACHED,
205
+ # * CALLBACK_ANALOG_VALUE_REACHED
205
206
  #
206
207
  # are triggered, if the thresholds
207
208
  #
208
- # BrickletVoltage#set_voltage_callback_threshold, BrickletVoltage#set_analog_value_callback_threshold
209
+ # * BrickletVoltage#set_voltage_callback_threshold,
210
+ # * BrickletVoltage#set_analog_value_callback_threshold
209
211
  #
210
212
  # keep being reached.
211
213
  #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2013-07-04. #
3
+ # This file was automatically generated on 2013-08-23. #
4
4
  # #
5
- # Bindings Version 2.0.8 #
5
+ # Bindings Version 2.0.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 #
@@ -346,11 +346,15 @@ module Tinkerforge
346
346
 
347
347
  # Sets the period in ms with which the threshold callbacks
348
348
  #
349
- # CALLBACK_CURRENT_REACHED, CALLBACK_VOLTAGE_REACHED, CALLBACK_POWER_REACHED
349
+ # * CALLBACK_CURRENT_REACHED,
350
+ # * CALLBACK_VOLTAGE_REACHED,
351
+ # * CALLBACK_POWER_REACHED
350
352
  #
351
353
  # are triggered, if the thresholds
352
354
  #
353
- # BrickletVoltageCurrent#set_current_callback_threshold, BrickletVoltageCurrent#set_voltage_callback_threshold, BrickletVoltageCurrent#set_power_callback_threshold
355
+ # * BrickletVoltageCurrent#set_current_callback_threshold,
356
+ # * BrickletVoltageCurrent#set_voltage_callback_threshold,
357
+ # * BrickletVoltageCurrent#set_power_callback_threshold
354
358
  #
355
359
  # keep being reached.
356
360
  #
@@ -477,6 +477,7 @@ module Tinkerforge
477
477
  @registered_callbacks = {}
478
478
 
479
479
  @socket_mutex = Mutex.new
480
+ @socket_send_mutex = Mutex.new
480
481
  @socket = nil # protected by socket_mutex
481
482
  @socket_id = 0 # protected by socket_mutex
482
483
 
@@ -672,7 +673,9 @@ module Tinkerforge
672
673
  end
673
674
 
674
675
  begin
675
- @socket.send request, 0
676
+ @socket_send_mutex.synchronize {
677
+ @socket.send request, 0
678
+ }
676
679
  rescue IOError
677
680
  handle_disconnect_by_peer DISCONNECT_REASON_ERROR, @socket_id, true
678
681
  raise NotConnectedException, 'Not connected'
@@ -820,7 +823,7 @@ module Tinkerforge
820
823
 
821
824
  pending_data += data
822
825
 
823
- while true
826
+ while @receive_flag
824
827
  if pending_data.length < 8
825
828
  # Wait for complete header
826
829
  break
@@ -909,7 +912,6 @@ module Tinkerforge
909
912
  # internal
910
913
  def dispatch_packet(packet)
911
914
  uid = get_uid_from_data packet
912
- length = get_length_from_data packet
913
915
  function_id = get_function_id_from_data packet
914
916
 
915
917
  if function_id == CALLBACK_ENUMERATE and \
@@ -954,6 +956,9 @@ module Tinkerforge
954
956
 
955
957
  # internal
956
958
  def disconnect_probe_loop(disconnect_probe_queue)
959
+ # NOTE: the disconnect probe thread is not allowed to hold the socket_mutex at any
960
+ # time because it is created and joined while the socket_mutex is locked
961
+
957
962
  request, _, _ = create_packet_header nil, 8, FUNCTION_DISCONNECT_PROBE
958
963
 
959
964
  while true
@@ -963,17 +968,17 @@ module Tinkerforge
963
968
  }
964
969
  rescue Timeout::Error
965
970
  if @disconnect_probe_flag
966
- @socket_mutex.synchronize {
967
- begin
971
+ begin
972
+ @socket_send_mutex.synchronize {
968
973
  @socket.send request, 0
969
- rescue IOError
970
- handle_disconnect_by_peer DISCONNECT_REASON_ERROR, @socket_id, false
971
- break
972
- rescue Errno::ECONNRESET
973
- handle_disconnect_by_peer DISCONNECT_REASON_SHUTDOWN, @socket_id, false
974
- break
975
- end
976
- }
974
+ }
975
+ rescue IOError
976
+ handle_disconnect_by_peer DISCONNECT_REASON_ERROR, @socket_id, false
977
+ break
978
+ rescue Errno::ECONNRESET
979
+ handle_disconnect_by_peer DISCONNECT_REASON_SHUTDOWN, @socket_id, false
980
+ break
981
+ end
977
982
  else
978
983
  @disconnect_probe_flag = true
979
984
  end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Tinkerforge
3
- VERSION = '2.0.8'
3
+ VERSION = '2.0.9'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinkerforge
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.8
4
+ version: 2.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-04 00:00:00.000000000 Z
12
+ date: 2013-08-23 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: matthias@tinkerforge.com
@@ -66,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ! '>='
68
68
  - !ruby/object:Gem::Version
69
- version: '0'
69
+ version: 1.9.0
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  none: false
72
72
  requirements: