Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 51 additions & 55 deletions pymodbus/pdu/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import struct

# pylint: disable=missing-type-doc
from collections import OrderedDict

from pymodbus.constants import DeviceInformation
from pymodbus.utilities import dict_property

Expand All @@ -34,59 +32,57 @@ class ModbusPlusStatistics:
For more information, see the modbus implementation guide page 87.
"""

stat_data = OrderedDict(
{
"node_type_id": [0x00] * 2, # 00
"software_version_number": [0x00] * 2, # 01
"network_address": [0x00] * 2, # 02
"mac_state_variable": [0x00] * 2, # 03
"peer_status_code": [0x00] * 2, # 04
"token_pass_counter": [0x00] * 2, # 05
"token_rotation_time": [0x00] * 2, # 06
"program_master_token_failed": [0x00], # 07 hi
"data_master_token_failed": [0x00], # 07 lo
"program_master_token_owner": [0x00], # 08 hi
"data_master_token_owner": [0x00], # 08 lo
"program_id_token_owner": [0x00], # 09 hi
"data_id_token_owner": [0x00], # 09 lo
"data_id_command_transfer": [0x00], # 10 hi
"__unused_10_lowbit": [0x00], # 10 lo
"program_id_command_transfer": [0x00], # 11 hi
"program_master_rsp_transfer": [0x00], # 11 lo
"program_id_auto_logout": [0x00], # 12 hi
"program_master_connect_status": [0x00], # 12 lo
"receive_buffer_dma_overrun": [0x00], # 13 hi
"pretransmit_deferral_error": [0x00], # 13 lo
"frame_size_error": [0x00], # 14 hi
"repeated_command_received": [0x00], # 14 lo
"receiver_alignment_error": [0x00], # 15 hi
"receiver_collision_abort_error": [0x00], # 15 lo
"bad_packet_length_error": [0x00], # 16 hi
"receiver_crc_error": [0x00], # 16 lo
"transmit_buffer_dma_underrun": [0x00], # 17 hi
"bad_link_address_error": [0x00], # 17 lo
"bad_mac_function_code_error": [0x00], # 18 hi
"internal_packet_length_error": [0x00], # 18 lo
"communication_failed_error": [0x00], # 19 hi
"communication_retries": [0x00], # 19 lo
"no_response_error": [0x00], # 20 hi
"good_receive_packet": [0x00], # 20 lo
"unexpected_path_error": [0x00], # 21 hi
"exception_response_error": [0x00], # 21 lo
"forgotten_transaction_error": [0x00], # 22 hi
"unexpected_response_error": [0x00], # 22 lo
"active_station_bit_map": [0x00] * 8, # 23-26
"token_station_bit_map": [0x00] * 8, # 27-30
"global_data_bit_map": [0x00] * 8, # 31-34
"receive_buffer_use_bit_map": [0x00] * 8, # 35-37
"data_master_output_path": [0x00] * 8, # 38-41
"data_id_input_path": [0x00] * 8, # 42-45
"program_master_outptu_path": [0x00] * 8, # 46-49
"program_id_input_path": [0x00] * 8, # 50-53
}
)

def __init__(self):
stat_data: dict[str, list[int]] = {
"node_type_id": [0x00] * 2, # 00
"software_version_number": [0x00] * 2, # 01
"network_address": [0x00] * 2, # 02
"mac_state_variable": [0x00] * 2, # 03
"peer_status_code": [0x00] * 2, # 04
"token_pass_counter": [0x00] * 2, # 05
"token_rotation_time": [0x00] * 2, # 06
"program_master_token_failed": [0x00], # 07 hi
"data_master_token_failed": [0x00], # 07 lo
"program_master_token_owner": [0x00], # 08 hi
"data_master_token_owner": [0x00], # 08 lo
"program_id_token_owner": [0x00], # 09 hi
"data_id_token_owner": [0x00], # 09 lo
"data_id_command_transfer": [0x00], # 10 hi
"__unused_10_lowbit": [0x00], # 10 lo
"program_id_command_transfer": [0x00], # 11 hi
"program_master_rsp_transfer": [0x00], # 11 lo
"program_id_auto_logout": [0x00], # 12 hi
"program_master_connect_status": [0x00], # 12 lo
"receive_buffer_dma_overrun": [0x00], # 13 hi
"pretransmit_deferral_error": [0x00], # 13 lo
"frame_size_error": [0x00], # 14 hi
"repeated_command_received": [0x00], # 14 lo
"receiver_alignment_error": [0x00], # 15 hi
"receiver_collision_abort_error": [0x00], # 15 lo
"bad_packet_length_error": [0x00], # 16 hi
"receiver_crc_error": [0x00], # 16 lo
"transmit_buffer_dma_underrun": [0x00], # 17 hi
"bad_link_address_error": [0x00], # 17 lo
"bad_mac_function_code_error": [0x00], # 18 hi
"internal_packet_length_error": [0x00], # 18 lo
"communication_failed_error": [0x00], # 19 hi
"communication_retries": [0x00], # 19 lo
"no_response_error": [0x00], # 20 hi
"good_receive_packet": [0x00], # 20 lo
"unexpected_path_error": [0x00], # 21 hi
"exception_response_error": [0x00], # 21 lo
"forgotten_transaction_error": [0x00], # 22 hi
"unexpected_response_error": [0x00], # 22 lo
"active_station_bit_map": [0x00] * 8, # 23-26
"token_station_bit_map": [0x00] * 8, # 27-30
"global_data_bit_map": [0x00] * 8, # 31-34
"receive_buffer_use_bit_map": [0x00] * 8, # 35-37
"data_master_output_path": [0x00] * 8, # 38-41
"data_id_input_path": [0x00] * 8, # 42-45
"program_master_outptu_path": [0x00] * 8, # 46-49
"program_id_input_path": [0x00] * 8, # 50-53
}

def __init__(self) -> None:
"""Initialize the modbus plus statistics with the default information."""
self.reset()

Expand Down