From 8794a66f2c4aaa38e5b0374e0e46ff78aff9320b Mon Sep 17 00:00:00 2001 From: "DESKTOP-BB\\bruno" Date: Mon, 31 Jul 2023 13:33:08 +0200 Subject: [PATCH 1/3] Remove line disabling request_tracer in ModbusUdpServer --- pymodbus/server/async_io.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pymodbus/server/async_io.py b/pymodbus/server/async_io.py index 06bfc9ff1..150714404 100644 --- a/pymodbus/server/async_io.py +++ b/pymodbus/server/async_io.py @@ -487,7 +487,6 @@ def __init__( # asyncio future that will be done once server has started self.serving = asyncio.Future() self.serving_done = asyncio.Future() - self.request_tracer = None self.handle_local_echo = False def handle_new_connection(self): From f92804b482c80dede368662e975d5ab1824abce8 Mon Sep 17 00:00:00 2001 From: "DESKTOP-BB\\bruno" Date: Mon, 31 Jul 2023 13:34:41 +0200 Subject: [PATCH 2/3] Get request_tracer from kwargs in ModbusSerialServer --- pymodbus/server/async_io.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pymodbus/server/async_io.py b/pymodbus/server/async_io.py index 150714404..bd87f2333 100644 --- a/pymodbus/server/async_io.py +++ b/pymodbus/server/async_io.py @@ -556,6 +556,7 @@ def __init__( :param reconnect_delay: reconnect delay in seconds :param response_manipulator: Callback method for manipulating the response + :param request_tracer: Callback method for tracing """ super().__init__( CommParams( @@ -584,7 +585,7 @@ def __init__( self.control = ModbusControlBlock() if isinstance(identity, ModbusDeviceIdentification): self.control.Identity.update(identity) - self.request_tracer = None + self.request_tracer = kwargs.get("request_tracer", None) self.server = None self.control = ModbusControlBlock() identity = kwargs.get("identity") From 4f094fccca6d94a2e340e3c5c6b3d4ccb21d86cc Mon Sep 17 00:00:00 2001 From: "DESKTOP-BB\\bruno" Date: Mon, 31 Jul 2023 13:34:41 +0200 Subject: [PATCH 3/3] Get request_tracer from kwargs in ModbusSerialServer --- API_changes.rst | 6 ++++++ pymodbus/server/async_io.py | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/API_changes.rst b/API_changes.rst index 61d42148a..9f0c38033 100644 --- a/API_changes.rst +++ b/API_changes.rst @@ -2,6 +2,12 @@ PyModbus - API changes. ======================= +------------- +Version 3.4.2 +------------- +-ModbusSerialServer now accepts request_tracer=. + + ------------- Version 3.4.1 ------------- diff --git a/pymodbus/server/async_io.py b/pymodbus/server/async_io.py index 150714404..bd87f2333 100644 --- a/pymodbus/server/async_io.py +++ b/pymodbus/server/async_io.py @@ -556,6 +556,7 @@ def __init__( :param reconnect_delay: reconnect delay in seconds :param response_manipulator: Callback method for manipulating the response + :param request_tracer: Callback method for tracing """ super().__init__( CommParams( @@ -584,7 +585,7 @@ def __init__( self.control = ModbusControlBlock() if isinstance(identity, ModbusDeviceIdentification): self.control.Identity.update(identity) - self.request_tracer = None + self.request_tracer = kwargs.get("request_tracer", None) self.server = None self.control = ModbusControlBlock() identity = kwargs.get("identity")