Module author: Galen Collins <bashwork@gmail.com>
Section author: Galen Collins <bashwork@gmail.com>
Contains base classes for modbus request/response/error packets
Base class for all Modbus mesages
This value is used to uniquely identify a request response pair. It can be implemented as a simple counter
This is a constant set at 0 to indicate Modbus. It is put here for ease of expansion.
This is used to route the request to the correct child. In the TCP modbus, it is used for routing (or not used at all. However, for the serial versions, it is used to specify which child to perform the requests against.
This is used for LRC/CRC in the serial modbus protocols
Decodes data part of the message.
Parameters: | data – is a string object |
---|---|
Raises : | A not implemented exception |
Encodes the message
Raises : | A not implemented exception |
---|
Base class for a modbus request PDU
Builds an error response based on the function
Parameters: | exception – The exception to return |
---|---|
Raises : | An exception response |
Base class for a modbus response PDU
An enumeration of the valid modbus exceptions
Base class for a modbus exception PDU
Decodes a modbus exception response
Parameters: | data – The packet data to decode |
---|
Encodes a modbus exception response
Returns: | The encoded exception packet |
---|
Defines the Modbus slave exception type ‘Illegal Function’ This exception code is returned if the slave:
- does not implement the function code **or**
- is not in a state that allows it to process the function
This is here so this failure will run correctly
Parameters: | data – Not used |
---|
Builds an illegal function request error response
Parameters: | context – The current context for the message |
---|---|
Returns: | The error response packet |