factory
— Request/Response Decoders¶
API Documentation¶
Modbus Request/Response Decoder Factories¶
The following factories make it easy to decode request/response messages. To add a new request/response pair to be decodeable by the library, simply add them to the respective function lookup table (order doesn’t matter, but it does help keep things organized).
Regardless of how many functions are added to the lookup, O(1) behavior is kept as a result of a pre-computed lookup dictionary.
-
class
pymodbus.factory.
ServerDecoder
[source]¶ Request Message Factory (Server)
To add more implemented functions, simply add them to the list
-
decode
(message)[source]¶ Wrapper to decode a request packet
Parameters: message – The raw modbus request packet Returns: The decoded modbus message or None if error
-
-
class
pymodbus.factory.
ClientDecoder
[source]¶ Response Message Factory (Client)
To add more implemented functions, simply add them to the list
-
lookupPduClass
(function_code)[source]¶ Use function_code to determine the class of the PDU.
Parameters: function_code – The function code specified in a frame. Returns: The class of the PDU that has a matching function_code.
-