Method: OpenC3::Telemetry#latest_packets

Defined in:
lib/openc3/packets/telemetry.rb

#latest_packets(target_name, item_name) ⇒ Array<Packet>

Returns The latest (most recently arrived) packets with the specified target and item.

Parameters:

  • target_name (String)

    The target name

  • item_name (String)

    The item name

Returns:

  • (Array<Packet>)

    The latest (most recently arrived) packets with the specified target and item.



211
212
213
214
215
216
217
218
219
220
221
# File 'lib/openc3/packets/telemetry.rb', line 211

def latest_packets(target_name, item_name)
  target_upcase = target_name.to_s.upcase
  item_upcase = item_name.to_s.upcase
  target_latest_data = @config.latest_data[target_upcase]
  raise "Telemetry target '#{target_upcase}' does not exist" unless target_latest_data

  packets = @config.latest_data[target_upcase][item_upcase]
  raise "Telemetry item '#{target_upcase} #{LATEST_PACKET_NAME} #{item_upcase}' does not exist" unless packets

  return packets
end