class documentation

class RightNibbleBCD(Converter): (source)

View In Hierarchy

Converter for 2-digit binary-coded decimal with a single extra nibble

A single byte contains two decimal digits as if they were hex digits. The extraneous nibble appears in the rightmost byte, right-padded with a single hex digit.

Class Method get Converts bytes -> int from 2-digit binary coded decimal with an extra nibble on the right
Class Method set Converts int -> bytes as 2-digit binary coded decimal with an extra nibble on the right
@classmethod
def get(cls, data: bytes, **kwargs) -> _T: (source)

Converts bytes -> int from 2-digit binary coded decimal with an extra nibble on the right

Parameters
data:bytesThe raw bytes to convert
**kwargsUndocumented
Returns
_TThe number stored in data
@classmethod
def set(cls, value: _T, *, current: bytes = None, **kwargs) -> bytes: (source)

Converts int -> bytes as 2-digit binary coded decimal with an extra nibble on the right

Parameters
value:_TThe value to convert
current:bytesThe current value of the data section
**kwargsUndocumented
Returns
bytesThe bytes representing value in BCD