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.



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

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.



358
359
360
# File 'lib/openc3/interfaces/linc_interface.rb', line 358

def handshake
  @handshake
end

Instance Method Details

#get_cmd_guidObject



386
387
388
# File 'lib/openc3/interfaces/linc_interface.rb', line 386

def get_cmd_guid
  return @cmd_guid
end

#got_your_handshake(handshake) ⇒ Object



381
382
383
384
# File 'lib/openc3/interfaces/linc_interface.rb', line 381

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

#wait_for_handshake(response_timeout) ⇒ Object



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

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