@@ -71,7 +71,7 @@ class CallTypeResponse:
71
71
clear_after : int = 1
72
72
73
73
74
- class ModbusSimulatorServer : # pylint: disable=too-many-instance-attributes
74
+ class ModbusSimulatorServer :
75
75
"""**ModbusSimulatorServer**.
76
76
77
77
:param modbus_server: Server name in json file (default: "server")
@@ -201,7 +201,6 @@ def __init__(
201
201
self .refresh_rate = 0
202
202
self .register_filter : list [int ] = []
203
203
self .call_list : list [CallTracer ] = []
204
- self .request_lookup = DecodePDU (True ).lookup
205
204
self .call_monitor = CallTypeMonitor ()
206
205
self .call_response = CallTypeResponse ()
207
206
app_key = getattr (web , 'AppKey' , str ) # fall back to str for aiohttp < 3.9.0
@@ -376,7 +375,7 @@ def build_html_calls(self, params: dict, html: str) -> str:
376
375
else ""
377
376
)
378
377
function_codes = ""
379
- for function in self . request_lookup . values ():
378
+ for function in DecodePDU ( True ). list_function_codes ():
380
379
selected = (
381
380
"selected"
382
381
if function .function_code == self .call_monitor .function
@@ -392,9 +391,7 @@ def build_html_calls(self, params: dict, html: str) -> str:
392
391
del self .call_list [0 ]
393
392
call_rows = ""
394
393
for entry in reversed (self .call_list ):
395
- # req_obj = self.request_lookup[entry[1]]
396
394
call_rows += f"<tr><td>{ entry .call } - { entry .fc } </td><td>{ entry .address } </td><td>{ entry .count } </td><td>{ entry .data .decode ()} </td></tr>"
397
- # line += req_obj.funcion_code_name
398
395
new_html = (
399
396
html .replace ("<!--SIMULATION_ACTIVE-->" , simulation_action )
400
397
.replace ("FUNCTION_RANGE_START" , range_start_html )
@@ -543,11 +540,11 @@ def build_json_calls(self, params: dict) -> dict:
543
540
)
544
541
545
542
function_codes = []
546
- for function in self . request_lookup . values ():
543
+ for function in DecodePDU ( True ). list_function_codes ():
547
544
function_codes .append ({
548
- "value" : function . function_code ,
545
+ "value" : function ,
549
546
"text" : "function code name" ,
550
- "selected" : function . function_code == self .call_monitor .function
547
+ "selected" : function == self .call_monitor .function
551
548
})
552
549
553
550
simulation_action = "ACTIVE" if self .call_response .active != RESPONSE_INACTIVE else ""
0 commit comments