diff --git a/pymodbus/bit_read_message.py b/pymodbus/bit_read_message.py index 01434920d..3be707c28 100644 --- a/pymodbus/bit_read_message.py +++ b/pymodbus/bit_read_message.py @@ -61,7 +61,7 @@ def __str__(self): class ReadBitsResponseBase(ModbusResponse): - ''' Base class for Messages responding to bit-reading values ''' + ''' Base class for Messages responding to bit-reading values. The requested bits can be found in the .bits list. ''' _rtu_byte_count_pos = 2 @@ -71,6 +71,8 @@ def __init__(self, values, **kwargs): :param values: The requested values to be returned ''' ModbusResponse.__init__(self, **kwargs) + + #: A list of booleans representing bit values self.bits = values or [] def encode(self): @@ -147,7 +149,7 @@ def execute(self, context): request is valid against the current datastore. :param context: The datastore to request from - :returns: The initializes response message, exception message otherwise + :returns: An initialized :py:class:`~pymodbus.register_read_message.ReadCoilsResponse`, or an :py:class:`~pymodbus.pdu.ExceptionResponse` if an error occurred ''' if not (1 <= self.count <= 0x7d0): return self.doException(merror.IllegalValue) @@ -169,6 +171,8 @@ class ReadCoilsResponse(ReadBitsResponseBase): remaining bits in the final data byte will be padded with zeros (toward the high order end of the byte). The Byte Count field specifies the quantity of complete bytes of data. + + The requested coils can be found in boolean form in the .bits list. ''' function_code = 1 @@ -206,7 +210,7 @@ def execute(self, context): request is valid against the current datastore. :param context: The datastore to request from - :returns: The initializes response message, exception message otherwise + :returns: An initialized :py:class:`~pymodbus.register_read_message.ReadDiscreteInputsResponse`, or an :py:class:`~pymodbus.pdu.ExceptionResponse` if an error occurred ''' if not (1 <= self.count <= 0x7d0): return self.doException(merror.IllegalValue) @@ -228,6 +232,8 @@ class ReadDiscreteInputsResponse(ReadBitsResponseBase): remaining bits in the final data byte will be padded with zeros (toward the high order end of the byte). The Byte Count field specifies the quantity of complete bytes of data. + + The requested coils can be found in boolean form in the .bits list. ''' function_code = 2 diff --git a/pymodbus/register_read_message.py b/pymodbus/register_read_message.py index 1c406ead3..a5f6b65dc 100644 --- a/pymodbus/register_read_message.py +++ b/pymodbus/register_read_message.py @@ -56,7 +56,9 @@ def __str__(self): class ReadRegistersResponseBase(ModbusResponse): ''' - Base class for responsing to a modbus register read + Base class for responding to a modbus register read. + + The requested registers can be found in the .registers list. ''' _rtu_byte_count_pos = 2 @@ -67,6 +69,8 @@ def __init__(self, values, **kwargs): :param values: The values to write to ''' ModbusResponse.__init__(self, **kwargs) + + #: A list of register values self.registers = values or [] def encode(self): @@ -127,7 +131,7 @@ def execute(self, context): ''' Run a read holding request against a datastore :param context: The datastore to request from - :returns: An initialized response, exception message otherwise + :returns: An initialized :py:class:`~pymodbus.register_read_message.ReadHoldingRegistersResponse`, or an :py:class:`~pymodbus.pdu.ExceptionResponse` if an error occurred ''' if not (1 <= self.count <= 0x7d): return self.doException(merror.IllegalValue) @@ -144,6 +148,8 @@ class ReadHoldingRegistersResponse(ReadRegistersResponseBase): starting register address and the number of registers. In the PDU Registers are addressed starting at zero. Therefore registers numbered 1-16 are addressed as 0-15. + + The requested registers can be found in the .registers list. ''' function_code = 3 @@ -177,7 +183,7 @@ def execute(self, context): ''' Run a read input request against a datastore :param context: The datastore to request from - :returns: An initialized response, exception message otherwise + :returns: An initialized :py:class:`~pymodbus.register_read_message.ReadInputRegistersResponse`, or an :py:class:`~pymodbus.pdu.ExceptionResponse` if an error occurred ''' if not (1 <= self.count <= 0x7d): return self.doException(merror.IllegalValue) @@ -194,6 +200,8 @@ class ReadInputRegistersResponse(ReadRegistersResponseBase): starting register address and the number of registers. In the PDU Registers are addressed starting at zero. Therefore input registers numbered 1-16 are addressed as 0-15. + + The requested registers can be found in the .registers list. ''' function_code = 4 @@ -269,7 +277,7 @@ def execute(self, context): ''' Run a write single register request against a datastore :param context: The datastore to request from - :returns: An initialized response, exception message otherwise + :returns: An initialized :py:class:`~pymodbus.register_read_message.ReadWriteMultipleRegistersResponse`, or an :py:class:`~pymodbus.pdu.ExceptionResponse` if an error occurred ''' if not (1 <= self.read_count <= 0x07d): return self.doException(merror.IllegalValue) @@ -311,6 +319,8 @@ class ReadWriteMultipleRegistersResponse(ModbusResponse): The normal response contains the data from the group of registers that were read. The byte count field specifies the quantity of bytes to follow in the read data field. + + The requested registers can be found in the .registers list. ''' function_code = 23 _rtu_byte_count_pos = 2