Method: OpenC3::Telemetry#identify!

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

#identify!(packet_data, target_names = nil) ⇒ Packet

Identifies an unknown buffer of data as a defined packet and sets the packet’s data to the given buffer. Identifying a packet uses the fields marked as ID_ITEM to identify if the buffer passed represents the packet defined. Incorrectly sized buffers are still processed but an error is logged.

Note: This affects all subsequent requests for the packet (for example using packet) which is why the method is marked with a bang!

Parameters:

  • packet_data (String)

    The binary packet data buffer

  • target_names (Array<String>) (defaults to: nil)

    List of target names to limit the search. The default value of nil means to search all known targets.

Returns:

  • (Packet)

    The identified packet with its data set to the given packet_data buffer. Returns nil if no packet could be identified.



267
268
269
270
271
# File 'lib/openc3/packets/telemetry.rb', line 267

def identify!(packet_data, target_names = nil)
  identified_packet = identify(packet_data, target_names)
  identified_packet.buffer = packet_data if identified_packet
  return identified_packet
end