Class: OpenC3::CcsdsPacket

Inherits:
Packet show all
Defined in:
lib/openc3/ccsds/ccsds_packet.rb

Overview

Packet which defines the required CCSDS items which include Version, Type, Secondary Header Flag, APID, Sequence Flags, Sequence Count and Length. It will optionally include a data item which will contain the rest of the CCSDS packet data. This is optional to make it easier to subclass this packet and add secondary header fields.

Constant Summary collapse

TELEMETRY =

CCSDS telemetry type

0
COMMAND =

CCSDS telecommand type

1
MIDDLE =

CCSDS sequence flag indicating continuation packet

0
CONTINUATION =

CCSDS sequence flag indicating continuation packet

0
FIRST =

CCSDS sequence flag indicating the first packet

1
LAST =

CCSDS sequence flag indicating the last packet

2
STANDALONE =

CCSDS sequence flag indicating a stand alone packet

3
LENGTH_FIELD_OFFSET =

Length Field Offset to number of bytes in entire packet

7

Constants inherited from Packet

Packet::ANY_STATE, Packet::RESERVED_ITEM_NAMES, Packet::VALUE_TYPES

Instance Attribute Summary

Attributes inherited from Packet

#abstract, #cmd_or_tlm, #description, #disabled, #error_response, #extra, #given_values, #hazardous, #hazardous_description, #hidden, #ignore_overlap, #messages_disabled, #packet_name, #packet_rate, #raw, #received_count, #received_time, #related_items, #response, #screen, #stored, #target_name, #template, #virtual

Instance Method Summary collapse

Methods inherited from Packet

#append_item, #as_json, #buffer=, #check_bit_offsets, #check_limits, #clear_all_non_derived_items, #clear_config_name, #clone, #config_name, #decom, #define, #define_item, #define_reserved_items, #disable_limits, #enable_limits, #formatted, from_json, #get_item, #id_items, #identified?, #identify?, #limits_change_callback=, #limits_items, #meta, #meta=, next_bit_offset, #out_of_limits, #packed?, #packet_time, #packet_time=, #process, #processors, #read, #read_all, #read_all_with_limits_states, #read_id_values, #read_item, #read_items, #reset, #restore_defaults, #set_received_time_fast, #to_config, #update_id_items, #update_limits_items_cache, #write, #write_item, #write_items

Constructor Details

#initialize(target_name = nil, packet_name = nil, include_ccsds_data = true) ⇒ CcsdsPacket

Creates a CCSDS packet by setting the target and packet name and then defining all the fields in a CCSDS packet with a primary header. If a secondary header is desired, define a secondary header field and then override the CcsdsData field to start after bit offset 48.

Parameters:

  • target_name (String) (defaults to: nil)

    The target name

  • packet_name (String) (defaults to: nil)

    The packet name



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/openc3/ccsds/ccsds_packet.rb', line 58

def initialize(target_name = nil, packet_name = nil, include_ccsds_data = true)
  super(target_name, packet_name, :BIG_ENDIAN)
  define_item('CcsdsVersion', 0, 3, :UINT)
  define_item('CcsdsType', 3, 1, :UINT)
  define_item('CcsdsShf', 4, 1, :UINT)
  define_item('CcsdsApid', 5, 11, :UINT)
  define_item('CcsdsSeqflags', 16, 2, :UINT)
  item = define_item('CcsdsSeqcnt', 18, 14, :UINT)
  item.overflow = :TRUNCATE
  define_item('CcsdsLength', 32, 16, :UINT)
  define_item('CcsdsData', 48, 0, :BLOCK) if include_ccsds_data
end