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.
310 311 312 313 314 315 |
# File 'lib/cosmos/interfaces/linc_interface.rb', line 310 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.
308 309 310 |
# File 'lib/cosmos/interfaces/linc_interface.rb', line 308 def handshake @handshake end |
Instance Method Details
#get_cmd_guid ⇒ Object
336 337 338 |
# File 'lib/cosmos/interfaces/linc_interface.rb', line 336 def get_cmd_guid return @cmd_guid end |
#got_your_handshake(handshake) ⇒ Object
331 332 333 334 |
# File 'lib/cosmos/interfaces/linc_interface.rb', line 331 def got_your_handshake(handshake) @handshake = handshake @resource.signal end |
#wait_for_handshake(response_timeout) ⇒ Object
317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/cosmos/interfaces/linc_interface.rb', line 317 def wait_for_handshake(response_timeout) timed_out = false @resource.wait(@handshakes_mutex,response_timeout) if @handshake timed_out = false else Logger.warn "No handshake - must be timeout." timed_out = true end return timed_out end |