Class: OpenC3::XtceParser

Inherits:
Object show all
Defined in:
lib/openc3/packets/parsers/xtce_parser.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#current_target_nameObject

Returns the value of attribute current_target_name.



28
29
30
# File 'lib/openc3/packets/parsers/xtce_parser.rb', line 28

def current_target_name
  @current_target_name
end

Class Method Details

.process(commands, telemetry, warnings, filename, target_name = nil) ⇒ Object

Processes a XTCE formatted OpenC3 configuration file

Parameters:

  • commands (Hash<String=>Packet>)

    Hash of all the command packets keyed by the packet name.

  • telemetry (Hash<String=>Packet>)

    Hash of all the telemetry packets keyed by the packet name.

  • warnings (Array<String>)

    Array of strings listing all the warnings that were created while parsing the configuration

  • filename (String)

    The name of the configuration file

  • target_name (String) (defaults to: nil)

    Override the target name found in the XTCE file



40
41
42
# File 'lib/openc3/packets/parsers/xtce_parser.rb', line 40

def self.process(commands, telemetry, warnings, filename, target_name = nil)
  XtceParser.new(commands, telemetry, warnings, filename, target_name)
end

.reverse_packet_order(target_name, cmd_or_tlm_hash) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/openc3/packets/parsers/xtce_parser.rb', line 44

def self.reverse_packet_order(target_name, cmd_or_tlm_hash)
  if cmd_or_tlm_hash[target_name]
    packets = []
    names_to_remove = []
    cmd_or_tlm_hash[target_name].each do |packet_name, packet|
      packets << packet
      names_to_remove << packet_name
    end
    cmd_or_tlm_hash[target_name].length.times do |i|
      cmd_or_tlm_hash[target_name].delete(names_to_remove[i])
    end
    packets.reverse_each do |packet|
      cmd_or_tlm_hash[target_name][packet.packet_name] = packet
    end
  end
end