def create_from_response_pdu(resp_pdu, req_pdu):
        """ Create instance from response PDU.

        Response PDU is required together with the number of registers read.

        :param resp_pdu: Byte array with request PDU.
        :param quantity: Number of coils read.
        :return: Instance of :class:`ReadCoils`.
        """
        read_input_registers = ReadInputRegisters()
        read_input_registers.quantity = struct.unpack('>H', req_pdu[-2:])[0]

        fmt = '>' + (conf.TYPE_CHAR * read_input_registers.quantity)
        read_input_registers.data = list(struct.unpack(fmt, resp_pdu[2:]))

        return read_input_registers
def create_from_response_pdu ( resp_pdu , req_pdu ) : read_input_registers = ReadInputRegisters ( ) read_input_registers . quantity = struct . unpack ( '>H' , req_pdu [ - 2 : ] ) [ 0 ] fmt = '>' + ( conf . TYPE_CHAR * read_input_registers . quantity ) read_input_registers . data = list ( struct . unpack ( fmt , resp_pdu [ 2 : ] ) ) return read_input_registers
Create instance from response PDU.

        Response PDU is required together with the number of registers read.

        :param resp_pdu: Byte array with request PDU.
        :param quantity: Number of coils read.
        :return: Instance of :class:`ReadCoils`.