diff --git a/examples/common/synchronous-server.py b/examples/common/synchronous-server.py index d10d78d8e..f46386472 100755 --- a/examples/common/synchronous-server.py +++ b/examples/common/synchronous-server.py @@ -19,6 +19,7 @@ from pymodbus.datastore import ModbusSequentialDataBlock from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext +from pymodbus.transaction import ModbusRtuFramer #---------------------------------------------------------------------------# # configure the service logging #---------------------------------------------------------------------------# @@ -103,6 +104,14 @@ #---------------------------------------------------------------------------# # run the server you want #---------------------------------------------------------------------------# +# Tcp: StartTcpServer(context, identity=identity, address=("localhost", 5020)) + +# Udp: #StartUdpServer(context, identity=identity, address=("localhost", 502)) + +# Ascii: #StartSerialServer(context, identity=identity, port='/dev/pts/3', timeout=1) + +# RTU: +#StartSerialServer(context, framer=ModbusRtuFramer, identity=identity, port='/dev/pts/3', timeout=.005) diff --git a/pymodbus/other_message.py b/pymodbus/other_message.py index 88e1be2ec..c122bb019 100644 --- a/pymodbus/other_message.py +++ b/pymodbus/other_message.py @@ -42,7 +42,7 @@ def decode(self, data): ''' pass - def execute(self): + def execute(self, context): ''' Run a read exeception status request against the store :returns: The populated response @@ -143,7 +143,7 @@ def decode(self, data): ''' pass - def execute(self): + def execute(self, context): ''' Run a read exeception status request against the store :returns: The populated response @@ -248,7 +248,7 @@ def decode(self, data): ''' pass - def execute(self): + def execute(self, context): ''' Run a read exeception status request against the store :returns: The populated response @@ -358,7 +358,7 @@ def decode(self, data): ''' pass - def execute(self): + def execute(self, context): ''' Run a read exeception status request against the store :returns: The populated response diff --git a/test/test_other_messages.py b/test/test_other_messages.py index 67e07a2ed..efa80c0dc 100644 --- a/test/test_other_messages.py +++ b/test/test_other_messages.py @@ -37,7 +37,7 @@ def testReadExceptionStatus(self): request = ReadExceptionStatusRequest() request.decode('\x12') self.assertEqual(request.encode(), '') - self.assertEqual(request.execute().function_code, 0x07) + self.assertEqual(request.execute(None).function_code, 0x07) response = ReadExceptionStatusResponse(0x12) self.assertEqual(response.encode(), '\x12') @@ -48,7 +48,7 @@ def testGetCommEventCounter(self): request = GetCommEventCounterRequest() request.decode('\x12') self.assertEqual(request.encode(), '') - self.assertEqual(request.execute().function_code, 0x0b) + self.assertEqual(request.execute(None).function_code, 0x0b) response = GetCommEventCounterResponse(0x12) self.assertEqual(response.encode(), '\x00\x00\x00\x12') @@ -63,7 +63,7 @@ def testGetCommEventLog(self): request = GetCommEventLogRequest() request.decode('\x12') self.assertEqual(request.encode(), '') - self.assertEqual(request.execute().function_code, 0x0c) + self.assertEqual(request.execute(None).function_code, 0x0c) response = GetCommEventLogResponse() self.assertEqual(response.encode(), '\x06\x00\x00\x00\x00\x00\x00') @@ -89,9 +89,9 @@ def testReportSlaveId(self): request = ReportSlaveIdRequest() request.decode('\x12') self.assertEqual(request.encode(), '') - self.assertEqual(request.execute().function_code, 0x11) + self.assertEqual(request.execute(None).function_code, 0x11) - response = ReportSlaveIdResponse(request.execute().identifier, True) + response = ReportSlaveIdResponse(request.execute(None).identifier, True) self.assertEqual(response.encode(), '\x0apymodbus\xff') response.decode('\x03\x12\x00') self.assertEqual(response.status, False)