PacketField

class ccsdspy.PacketField(name, data_type, bit_length, bit_offset=None, byte_order='big')[source]

Bases: object

A field contained in a packet.

Parameters:
namestr

String identifier for the field. The name specified how you may call upon this data later.

data_type{‘uint’, ‘int’, ‘float’, ‘str’, ‘fill’}

Data type of the field.

bit_lengthint

Number of bits contained in the field.

bit_offsetint, optional

Bit offset into packet, including the primary header which is 48 bits long. If this is not specified, than the bit offset will the be calculated automatically from its position inside the packet definition.

byte_order{‘big’, ‘little’}, or custom string of digits like “4321”

Byte order of the field. Can be “big”, “little”, or an arbitrary ordering Specified as a string of digits like “2341”. Defaults to big endian.

Raises:
TypeError

If one of the arguments is not of the correct type.

ValueError

data_type or byte_order is invalid