1616import struct
1717
1818# pylint: disable=missing-type-doc
19- from collections import OrderedDict
20-
2119from pymodbus .constants import DeviceInformation
2220from pymodbus .utilities import dict_property
2321
@@ -34,59 +32,57 @@ class ModbusPlusStatistics:
3432 For more information, see the modbus implementation guide page 87.
3533 """
3634
37- stat_data = OrderedDict (
38- {
39- "node_type_id" : [0x00 ] * 2 , # 00
40- "software_version_number" : [0x00 ] * 2 , # 01
41- "network_address" : [0x00 ] * 2 , # 02
42- "mac_state_variable" : [0x00 ] * 2 , # 03
43- "peer_status_code" : [0x00 ] * 2 , # 04
44- "token_pass_counter" : [0x00 ] * 2 , # 05
45- "token_rotation_time" : [0x00 ] * 2 , # 06
46- "program_master_token_failed" : [0x00 ], # 07 hi
47- "data_master_token_failed" : [0x00 ], # 07 lo
48- "program_master_token_owner" : [0x00 ], # 08 hi
49- "data_master_token_owner" : [0x00 ], # 08 lo
50- "program_id_token_owner" : [0x00 ], # 09 hi
51- "data_id_token_owner" : [0x00 ], # 09 lo
52- "data_id_command_transfer" : [0x00 ], # 10 hi
53- "__unused_10_lowbit" : [0x00 ], # 10 lo
54- "program_id_command_transfer" : [0x00 ], # 11 hi
55- "program_master_rsp_transfer" : [0x00 ], # 11 lo
56- "program_id_auto_logout" : [0x00 ], # 12 hi
57- "program_master_connect_status" : [0x00 ], # 12 lo
58- "receive_buffer_dma_overrun" : [0x00 ], # 13 hi
59- "pretransmit_deferral_error" : [0x00 ], # 13 lo
60- "frame_size_error" : [0x00 ], # 14 hi
61- "repeated_command_received" : [0x00 ], # 14 lo
62- "receiver_alignment_error" : [0x00 ], # 15 hi
63- "receiver_collision_abort_error" : [0x00 ], # 15 lo
64- "bad_packet_length_error" : [0x00 ], # 16 hi
65- "receiver_crc_error" : [0x00 ], # 16 lo
66- "transmit_buffer_dma_underrun" : [0x00 ], # 17 hi
67- "bad_link_address_error" : [0x00 ], # 17 lo
68- "bad_mac_function_code_error" : [0x00 ], # 18 hi
69- "internal_packet_length_error" : [0x00 ], # 18 lo
70- "communication_failed_error" : [0x00 ], # 19 hi
71- "communication_retries" : [0x00 ], # 19 lo
72- "no_response_error" : [0x00 ], # 20 hi
73- "good_receive_packet" : [0x00 ], # 20 lo
74- "unexpected_path_error" : [0x00 ], # 21 hi
75- "exception_response_error" : [0x00 ], # 21 lo
76- "forgotten_transaction_error" : [0x00 ], # 22 hi
77- "unexpected_response_error" : [0x00 ], # 22 lo
78- "active_station_bit_map" : [0x00 ] * 8 , # 23-26
79- "token_station_bit_map" : [0x00 ] * 8 , # 27-30
80- "global_data_bit_map" : [0x00 ] * 8 , # 31-34
81- "receive_buffer_use_bit_map" : [0x00 ] * 8 , # 35-37
82- "data_master_output_path" : [0x00 ] * 8 , # 38-41
83- "data_id_input_path" : [0x00 ] * 8 , # 42-45
84- "program_master_outptu_path" : [0x00 ] * 8 , # 46-49
85- "program_id_input_path" : [0x00 ] * 8 , # 50-53
86- }
87- )
88-
89- def __init__ (self ):
35+ stat_data : dict [str , list [int ]] = {
36+ "node_type_id" : [0x00 ] * 2 , # 00
37+ "software_version_number" : [0x00 ] * 2 , # 01
38+ "network_address" : [0x00 ] * 2 , # 02
39+ "mac_state_variable" : [0x00 ] * 2 , # 03
40+ "peer_status_code" : [0x00 ] * 2 , # 04
41+ "token_pass_counter" : [0x00 ] * 2 , # 05
42+ "token_rotation_time" : [0x00 ] * 2 , # 06
43+ "program_master_token_failed" : [0x00 ], # 07 hi
44+ "data_master_token_failed" : [0x00 ], # 07 lo
45+ "program_master_token_owner" : [0x00 ], # 08 hi
46+ "data_master_token_owner" : [0x00 ], # 08 lo
47+ "program_id_token_owner" : [0x00 ], # 09 hi
48+ "data_id_token_owner" : [0x00 ], # 09 lo
49+ "data_id_command_transfer" : [0x00 ], # 10 hi
50+ "__unused_10_lowbit" : [0x00 ], # 10 lo
51+ "program_id_command_transfer" : [0x00 ], # 11 hi
52+ "program_master_rsp_transfer" : [0x00 ], # 11 lo
53+ "program_id_auto_logout" : [0x00 ], # 12 hi
54+ "program_master_connect_status" : [0x00 ], # 12 lo
55+ "receive_buffer_dma_overrun" : [0x00 ], # 13 hi
56+ "pretransmit_deferral_error" : [0x00 ], # 13 lo
57+ "frame_size_error" : [0x00 ], # 14 hi
58+ "repeated_command_received" : [0x00 ], # 14 lo
59+ "receiver_alignment_error" : [0x00 ], # 15 hi
60+ "receiver_collision_abort_error" : [0x00 ], # 15 lo
61+ "bad_packet_length_error" : [0x00 ], # 16 hi
62+ "receiver_crc_error" : [0x00 ], # 16 lo
63+ "transmit_buffer_dma_underrun" : [0x00 ], # 17 hi
64+ "bad_link_address_error" : [0x00 ], # 17 lo
65+ "bad_mac_function_code_error" : [0x00 ], # 18 hi
66+ "internal_packet_length_error" : [0x00 ], # 18 lo
67+ "communication_failed_error" : [0x00 ], # 19 hi
68+ "communication_retries" : [0x00 ], # 19 lo
69+ "no_response_error" : [0x00 ], # 20 hi
70+ "good_receive_packet" : [0x00 ], # 20 lo
71+ "unexpected_path_error" : [0x00 ], # 21 hi
72+ "exception_response_error" : [0x00 ], # 21 lo
73+ "forgotten_transaction_error" : [0x00 ], # 22 hi
74+ "unexpected_response_error" : [0x00 ], # 22 lo
75+ "active_station_bit_map" : [0x00 ] * 8 , # 23-26
76+ "token_station_bit_map" : [0x00 ] * 8 , # 27-30
77+ "global_data_bit_map" : [0x00 ] * 8 , # 31-34
78+ "receive_buffer_use_bit_map" : [0x00 ] * 8 , # 35-37
79+ "data_master_output_path" : [0x00 ] * 8 , # 38-41
80+ "data_id_input_path" : [0x00 ] * 8 , # 42-45
81+ "program_master_outptu_path" : [0x00 ] * 8 , # 46-49
82+ "program_id_input_path" : [0x00 ] * 8 , # 50-53
83+ }
84+
85+ def __init__ (self ) -> None :
9086 """Initialize the modbus plus statistics with the default information."""
9187 self .reset ()
9288
0 commit comments