Class: OpenC3::LincHandshakeCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/openc3/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

Instance Method Summary collapse

Constructor Details

#initialize(handshakes_mutex, cmd_guid) ⇒ LincHandshakeCommand

Returns a new instance of LincHandshakeCommand.



362
363
364
365
366
367
# File 'lib/openc3/interfaces/linc_interface.rb', line 362

def initialize(handshakes_mutex, cmd_guid)
  @cmd_guid = cmd_guid
  @handshakes_mutex = handshakes_mutex
  @resource = ConditionVariable.new
  @handshake = nil
end

Instance Attribute Details

#handshakeObject

Returns the value of attribute handshake.



360
361
362
# File 'lib/openc3/interfaces/linc_interface.rb', line 360

def handshake
  @handshake
end

Instance Method Details

#get_cmd_guidObject



388
389
390
# File 'lib/openc3/interfaces/linc_interface.rb', line 388

def get_cmd_guid
  return @cmd_guid
end

#got_your_handshake(handshake) ⇒ Object



383
384
385
386
# File 'lib/openc3/interfaces/linc_interface.rb', line 383

def got_your_handshake(handshake)
  @handshake = handshake
  @resource.signal
end

#wait_for_handshake(response_timeout) ⇒ Object



369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/openc3/interfaces/linc_interface.rb', line 369

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