uds.utilities.bytes_operations ============================== .. py:module:: uds.utilities.bytes_operations .. autoapi-nested-parse:: Module with bytes list operations implementation. Classes ------- .. autoapisummary:: uds.utilities.bytes_operations.Endianness Functions --------- .. autoapisummary:: uds.utilities.bytes_operations.bytes_list_to_int uds.utilities.bytes_operations.int_to_bytes_list Module Contents --------------- .. py:class:: Endianness Bases: :py:obj:`uds.utilities.enums.ValidatedEnum`, :py:obj:`aenum.StrEnum` .. autoapi-inheritance-diagram:: uds.utilities.bytes_operations.Endianness :parts: 1 :private-bases: Endianness values definitions. `Endianness `_ determines order of bytes in a bytes sequence. Initialize self. See help(type(self)) for accurate signature. .. py:attribute:: LITTLE_ENDIAN :type: Endianness :value: 'little' Little Endian stores the most significant byte at the largest memory address and the least significant byte at the smallest. .. py:attribute:: BIG_ENDIAN :type: Endianness :value: 'big' Big Endian stores the most significant byte at the smallest memory address and the least significant byte at the largest. .. py:function:: bytes_list_to_int(bytes_list, endianness = Endianness.BIG_ENDIAN) Convert a list of bytes to integer value. :param bytes_list: List of bytes to convert. :param endianness: Order of bytes to use. :return: The integer value represented by provided list of bytes. .. py:function:: int_to_bytes_list(int_value, list_size = None, endianness = Endianness.BIG_ENDIAN) Convert integer value to a list of bytes. :param int_value: Integer value to convert. :param list_size: Size of the output list. Use None to use the smallest possible list size. :param endianness: Order of bytes to use. :raise TypeError: At least one provided value has invalid type. :raise ValueError: At least one provided value is out of range. :raise InconsistentArgumentsError: Provided value of `list_size` is too small to contain entire `int_value`. :raise NotImplementedError: There is missing implementation for the provided Endianness. Please create an issue in our `Issues Tracking System `_ with detailed description if you face this error. :return: The value of bytes list that represents the provided integer value.