Abstract root class for all other BitPacket classes. Initially, a field only has a name and no value. Field subclasses must provide field details, such as the size of the field, the implementation of how the field value will look like, that is, how the field should be built, and other field related details.
Initialize the field with the given name. And identity (returning the field’s value) calibration curve is set by default.
Returns the given array appended with the field byte representation to it.
Returns a string of bytes representing this field.
Returns the calibration curve function.
Returns the engineering value of this field. The engineering value is the result of applying a calibration curve to the value of this field. Some fields might represent temperatures, angles, etc. that need to be converted from its digital form to its analog form. This function will return the value after the conversion is done.
Returns a list of the children of this field. An empty list is returned if the field does not have any children.
Returns the hexadecimal integer representation of this field. That is, the bytes forming this field in its integer representation.
Returns the name of the field.
Returns the parent of this field, or None if the field is not part of any other field.
Returns the root of this field. The root is the top level container that this field belongs to, if any. If the field is not part of any other field the root is the field itself.
Sets the given array bytes to the field. This function does the same as calling set_bytes with the bytes of the array.
Sets a string of bytes to the field.
Sets the calibration curve to be applied to this field in order to obtain a desired conversion. Some fields might represent temperatures, angles, etc. that need to be converted from its digital form to its analog form. The calibration curve provides the functionality to perform this conversion.
Sets this field with the contents of the given stream. Note that only the bytes necessary for this field will be obtained from the stream. This means that the stream cursor will only advance as many bytes as the size of this field.
Sets a new value to the field.
Returns the size of the field.
Returns a human-readable representation of the engineering value. This function will first calculate the engineering value (by applying the calibration curve) and will return the string representation of it.
Returns a human-readable representation of the hexadecimal value of this field. Note that the type of the field can be a float, integer, etc. This is the real representation (in memory) of the value.
Returns a human-readable representation of the value of this field. Note that the type of the field can be a float, integer, etc. So, the representation might be different for each type.
Fill the given byte stream with the contents of this field.
Returns the value of the field.
This the abstract class for all bit fields sub-classes. All bit fields must inherit from this class and implement the non-implemented methods in it.
Returns the name of the field.