StringifyBytesConverter¶
- class ccsdspy.converters.StringifyBytesConverter(format='hex')[source]¶
Bases:
ConverterPost-processing conversion which converts byte arrays or multi-byte numbers to strings in numeric representations such as binary, hexadecimal, or octal.
To convert individual bytes, the input field should be defined as a
PacketArrayconstructed withdata_type="uint"andbit_length=8. Otherwise, each element is converted as a single entity.If the field is an array, the shape of the array is retained. The strings generated are not padded to a fixed length.
The converted strings contain prefixes such as
0b(binary),0x(hex), or0o(octal). If the number is signed and negative, the prefixes change to-0b(binary),-0x(hex), or-0o(octal).Instantiate a StringifyBytesConverter object
- Parameters:
- format{“bin”, “hex”, “oct”}
Format used to encode the bytes in a string.
Methods Summary
convert(field_array)Apply the conversion.
Methods Documentation