Class: Cosmos::LincHandshakeCommand
- Defined in:
- lib/cosmos/interfaces/linc_interface.rb
Overview
The LincHandshakeCommand class is used only by the LincInterface. It is the command with other required items that is passed to the telemetry thread so it can match it with the handshake.
Instance Attribute Summary collapse
-
#handshake ⇒ Object
Returns the value of attribute handshake.
Instance Method Summary collapse
- #get_cmd_guid ⇒ Object
- #got_your_handshake(handshake) ⇒ Object
-
#initialize(handshakes_mutex, cmd_guid) ⇒ LincHandshakeCommand
constructor
A new instance of LincHandshakeCommand.
- #wait_for_handshake(response_timeout) ⇒ Object
Constructor Details
#initialize(handshakes_mutex, cmd_guid) ⇒ LincHandshakeCommand
Returns a new instance of LincHandshakeCommand.
350 351 352 353 354 355 |
# File 'lib/cosmos/interfaces/linc_interface.rb', line 350 def initialize(handshakes_mutex,cmd_guid) @cmd_guid = cmd_guid @handshakes_mutex = handshakes_mutex @resource = ConditionVariable.new @handshake = nil end |
Instance Attribute Details
#handshake ⇒ Object
Returns the value of attribute handshake.
348 349 350 |
# File 'lib/cosmos/interfaces/linc_interface.rb', line 348 def handshake @handshake end |
Instance Method Details
#get_cmd_guid ⇒ Object
376 377 378 |
# File 'lib/cosmos/interfaces/linc_interface.rb', line 376 def get_cmd_guid return @cmd_guid end |
#got_your_handshake(handshake) ⇒ Object
371 372 373 374 |
# File 'lib/cosmos/interfaces/linc_interface.rb', line 371 def got_your_handshake(handshake) @handshake = handshake @resource.signal end |
#wait_for_handshake(response_timeout) ⇒ Object
357 358 359 360 361 362 363 364 365 366 367 368 369 |
# File 'lib/cosmos/interfaces/linc_interface.rb', line 357 def wait_for_handshake(response_timeout) timed_out = false @resource.wait(@handshakes_mutex,response_timeout) if @handshake timed_out = false else Logger.warn "#{@name}: No handshake - must be timeout." timed_out = true end return timed_out end |