DLMS-SPODES 0.87.16__py3-none-any.whl → 0.88.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- DLMS_SPODES/Values/EN/__init__.py +1 -1
- DLMS_SPODES/Values/EN/actors.py +8 -8
- DLMS_SPODES/Values/EN/relation_to_obis_names.py +387 -387
- DLMS_SPODES/Values/RU/__init__.py +1 -1
- DLMS_SPODES/Values/RU/actors.py +8 -8
- DLMS_SPODES/Values/RU/relation_to_obis_names.py +396 -396
- DLMS_SPODES/__init__.py +6 -6
- DLMS_SPODES/configEN.ini +126 -126
- DLMS_SPODES/config_parser.py +53 -53
- DLMS_SPODES/cosem_interface_classes/Overview/__init__.py +0 -0
- DLMS_SPODES/cosem_interface_classes/Overview/class_id.py +107 -0
- DLMS_SPODES/cosem_interface_classes/__class_init__.py +3 -3
- DLMS_SPODES/cosem_interface_classes/__init__.py +3 -2
- DLMS_SPODES/cosem_interface_classes/activity_calendar.py +210 -254
- DLMS_SPODES/cosem_interface_classes/arbitrator.py +78 -105
- DLMS_SPODES/cosem_interface_classes/association_ln/abstract.py +50 -34
- DLMS_SPODES/cosem_interface_classes/association_ln/authentication_mechanism_name.py +25 -25
- DLMS_SPODES/cosem_interface_classes/association_ln/mechanism_id.py +25 -25
- DLMS_SPODES/cosem_interface_classes/association_ln/method.py +5 -5
- DLMS_SPODES/cosem_interface_classes/association_ln/ver0.py +440 -485
- DLMS_SPODES/cosem_interface_classes/association_ln/ver1.py +126 -133
- DLMS_SPODES/cosem_interface_classes/association_ln/ver2.py +30 -36
- DLMS_SPODES/cosem_interface_classes/association_ln/ver3.py +3 -4
- DLMS_SPODES/cosem_interface_classes/association_sn/ver0.py +14 -12
- DLMS_SPODES/cosem_interface_classes/clock.py +81 -131
- DLMS_SPODES/cosem_interface_classes/collection.py +2106 -2122
- DLMS_SPODES/cosem_interface_classes/cosem_interface_class.py +525 -583
- DLMS_SPODES/cosem_interface_classes/data.py +12 -21
- DLMS_SPODES/cosem_interface_classes/demand_register/ver0.py +32 -59
- DLMS_SPODES/cosem_interface_classes/disconnect_control.py +56 -74
- DLMS_SPODES/cosem_interface_classes/extended_register.py +18 -27
- DLMS_SPODES/cosem_interface_classes/gprs_modem_setup.py +33 -43
- DLMS_SPODES/cosem_interface_classes/gsm_diagnostic/ver0.py +78 -103
- DLMS_SPODES/cosem_interface_classes/gsm_diagnostic/ver1.py +42 -40
- DLMS_SPODES/cosem_interface_classes/gsm_diagnostic/ver2.py +6 -9
- DLMS_SPODES/cosem_interface_classes/iec_hdlc_setup/ver0.py +11 -11
- DLMS_SPODES/cosem_interface_classes/iec_hdlc_setup/ver1.py +27 -53
- DLMS_SPODES/cosem_interface_classes/iec_local_port_setup.py +9 -11
- DLMS_SPODES/cosem_interface_classes/image_transfer/image_transfer_status.py +15 -15
- DLMS_SPODES/cosem_interface_classes/image_transfer/ver0.py +54 -126
- DLMS_SPODES/cosem_interface_classes/implementations/__init__.py +3 -3
- DLMS_SPODES/cosem_interface_classes/implementations/arbitrator.py +19 -19
- DLMS_SPODES/cosem_interface_classes/implementations/data.py +491 -487
- DLMS_SPODES/cosem_interface_classes/implementations/profile_generic.py +85 -83
- DLMS_SPODES/cosem_interface_classes/ipv4_setup.py +42 -72
- DLMS_SPODES/cosem_interface_classes/limiter.py +77 -111
- DLMS_SPODES/cosem_interface_classes/ln_pattern.py +334 -333
- DLMS_SPODES/cosem_interface_classes/modem_configuration/ver0.py +51 -65
- DLMS_SPODES/cosem_interface_classes/modem_configuration/ver1.py +27 -39
- DLMS_SPODES/cosem_interface_classes/ntp_setup/ver0.py +48 -67
- DLMS_SPODES/cosem_interface_classes/obis.py +28 -23
- DLMS_SPODES/cosem_interface_classes/overview.py +198 -197
- DLMS_SPODES/cosem_interface_classes/parameter.py +548 -547
- DLMS_SPODES/cosem_interface_classes/parameters.py +172 -172
- DLMS_SPODES/cosem_interface_classes/profile_generic/ver0.py +90 -122
- DLMS_SPODES/cosem_interface_classes/profile_generic/ver1.py +268 -277
- DLMS_SPODES/cosem_interface_classes/push_setup/ver0.py +13 -12
- DLMS_SPODES/cosem_interface_classes/push_setup/ver1.py +9 -10
- DLMS_SPODES/cosem_interface_classes/push_setup/ver2.py +124 -166
- DLMS_SPODES/cosem_interface_classes/register.py +18 -45
- DLMS_SPODES/cosem_interface_classes/register_activation/ver0.py +45 -80
- DLMS_SPODES/cosem_interface_classes/register_monitor.py +33 -46
- DLMS_SPODES/cosem_interface_classes/reports.py +72 -70
- DLMS_SPODES/cosem_interface_classes/schedule.py +88 -176
- DLMS_SPODES/cosem_interface_classes/script_table.py +54 -87
- DLMS_SPODES/cosem_interface_classes/security_setup/ver0.py +45 -68
- DLMS_SPODES/cosem_interface_classes/security_setup/ver1.py +122 -158
- DLMS_SPODES/cosem_interface_classes/single_action_schedule.py +34 -50
- DLMS_SPODES/cosem_interface_classes/special_days_table.py +54 -84
- DLMS_SPODES/cosem_interface_classes/tcp_udp_setup.py +20 -42
- DLMS_SPODES/cosem_pdu.py +93 -93
- DLMS_SPODES/enums.py +625 -625
- DLMS_SPODES/exceptions.py +106 -106
- DLMS_SPODES/firmwares.py +99 -99
- DLMS_SPODES/hdlc/frame.py +875 -875
- DLMS_SPODES/hdlc/sub_layer.py +54 -54
- DLMS_SPODES/literals.py +17 -17
- DLMS_SPODES/obis/__init__.py +1 -1
- DLMS_SPODES/obis/media_id.py +931 -931
- DLMS_SPODES/pardata.py +22 -22
- DLMS_SPODES/pdu_enums.py +98 -98
- DLMS_SPODES/relation_to_OBIS.py +463 -465
- DLMS_SPODES/settings.py +551 -551
- DLMS_SPODES/types/choices.py +140 -142
- DLMS_SPODES/types/common_data_types.py +2379 -2401
- DLMS_SPODES/types/cosem_service_types.py +109 -109
- DLMS_SPODES/types/implementations/arrays.py +25 -25
- DLMS_SPODES/types/implementations/bitstrings.py +97 -97
- DLMS_SPODES/types/implementations/double_long_usingneds.py +35 -35
- DLMS_SPODES/types/implementations/enums.py +57 -57
- DLMS_SPODES/types/implementations/integers.py +12 -11
- DLMS_SPODES/types/implementations/long_unsigneds.py +127 -127
- DLMS_SPODES/types/implementations/octet_string.py +11 -11
- DLMS_SPODES/types/implementations/structs.py +64 -64
- DLMS_SPODES/types/type_alias.py +74 -0
- DLMS_SPODES/types/useful_types.py +627 -677
- {dlms_spodes-0.87.16.dist-info → dlms_spodes-0.88.1.dist-info}/METADATA +30 -30
- dlms_spodes-0.88.1.dist-info/RECORD +118 -0
- {dlms_spodes-0.87.16.dist-info → dlms_spodes-0.88.1.dist-info}/WHEEL +1 -1
- DLMS_SPODES/cosem_interface_classes/a_parameter.py +0 -20
- DLMS_SPODES/cosem_interface_classes/attr_indexes.py +0 -12
- dlms_spodes-0.87.16.dist-info/RECORD +0 -117
- {dlms_spodes-0.87.16.dist-info → dlms_spodes-0.88.1.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
"""all realisation cdt.Integer subclasses"""
|
|
2
|
-
from ...types import common_data_types as cdt
|
|
3
|
-
from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"""all realisation cdt.Integer subclasses"""
|
|
2
|
+
from ...types import common_data_types as cdt
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Only0(cdt.Integer, value=0):
|
|
7
|
+
""" Limited Integer only 0 """
|
|
8
|
+
def __call__(self, *args: Any, **kwargs: Any) -> "Only0":
|
|
9
|
+
return INTEGER_0
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
INTEGER_0 = Only0()
|
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
from dataclasses import dataclass
|
|
2
|
-
from ...types import common_data_types as cdt
|
|
3
|
-
from ...cosem_interface_classes import overview
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class ClassId(cdt.LongUnsigned):
|
|
7
|
-
""" Class ID type """
|
|
8
|
-
DEFAULT = 1
|
|
9
|
-
|
|
10
|
-
def validate(self):
|
|
11
|
-
if not int(self) in overview.ClassID.get_all_id():
|
|
12
|
-
raise ValueError(F'Unknown DLMS class with ID {int(self)}')
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@dataclass(frozen=True)
|
|
16
|
-
class ClassIDCDT:
|
|
17
|
-
DATA = ClassId(int(overview.ClassID.DATA))
|
|
18
|
-
REGISTER = ClassId(int(overview.ClassID.REGISTER))
|
|
19
|
-
EXT_REGISTER = ClassId(int(overview.ClassID.EXT_REGISTER))
|
|
20
|
-
DEMAND_REGISTER = ClassId(int(overview.ClassID.DEMAND_REGISTER))
|
|
21
|
-
REGISTER_ACTIVATION = ClassId(int(overview.ClassID.REGISTER_ACTIVATION))
|
|
22
|
-
PROFILE_GENERIC = ClassId(int(overview.ClassID.PROFILE_GENERIC))
|
|
23
|
-
CLOCK = ClassId(int(overview.ClassID.CLOCK))
|
|
24
|
-
SCRIPT_TABLE = ClassId(int(overview.ClassID.SCRIPT_TABLE))
|
|
25
|
-
SCHEDULE = ClassId(int(overview.ClassID.SCHEDULE))
|
|
26
|
-
SPECIAL_DAYS_TABLE = ClassId(int(overview.ClassID.SPECIAL_DAYS_TABLE))
|
|
27
|
-
ASSOCIATION_SN_CLASS = ClassId(int(overview.ClassID.ASSOCIATION_SN))
|
|
28
|
-
ASSOCIATION_LN_CLASS = ClassId(int(overview.ClassID.ASSOCIATION_LN))
|
|
29
|
-
SAP_ASSIGNMENT = ClassId(int(overview.ClassID.SAP_ASSIGNMENT))
|
|
30
|
-
IMAGE_TRANSFER = ClassId(int(overview.ClassID.IMAGE_TRANSFER))
|
|
31
|
-
IEC_LOCAL_PORT_SETUP = ClassId(int(overview.ClassID.IEC_LOCAL_PORT_SETUP))
|
|
32
|
-
ACTIVITY_CALENDAR = ClassId(int(overview.ClassID.ACTIVITY_CALENDAR))
|
|
33
|
-
REGISTER_MONITOR = ClassId(int(overview.ClassID.REGISTER_MONITOR))
|
|
34
|
-
SINGLE_ACTION_SCHEDULE = ClassId(int(overview.ClassID.SINGLE_ACTION_SCHEDULE))
|
|
35
|
-
IEC_HDLC_SETUP = ClassId(int(overview.ClassID.IEC_HDLC_SETUP))
|
|
36
|
-
IEC_TWISTED_PAIR__1__SETUP = ClassId(int(overview.ClassID.IEC_TWISTED_PAIR_1_SETUP))
|
|
37
|
-
M_BUS_SLAVE_PORT_SETUP = ClassId(int(overview.ClassID.M_BUS_SLAVE_PORT_SETUP))
|
|
38
|
-
UTILITY_TABLES = ClassId(int(overview.ClassID.UTILITY_TABLES))
|
|
39
|
-
MODEM_CONFIGURATION = ClassId(int(overview.ClassID.MODEM_CONFIGURATION))
|
|
40
|
-
AUTO_ANSWER = ClassId(int(overview.ClassID.AUTO_ANSWER))
|
|
41
|
-
AUTO_CONNECT = ClassId(int(overview.ClassID.AUTO_CONNECT))
|
|
42
|
-
COSEM_DATA_PROTECTION = ClassId(int(overview.ClassID.COSEM_DATA_PROTECTION))
|
|
43
|
-
PUSH_SETUP = ClassId(int(overview.ClassID.PUSH_SETUP))
|
|
44
|
-
TCP_UDP_SETUP = ClassId(int(overview.ClassID.TCP_UDP_SETUP))
|
|
45
|
-
IPV4_SETUP = ClassId(int(overview.ClassID.IPV4_SETUP))
|
|
46
|
-
PRIME_NB_OFDM_PLC_MAC_ADDRESS_SETUP = ClassId(int(overview.ClassID.PRIME_NB_OFDM_PLC_MAC_ADDRESS_SETUP))
|
|
47
|
-
PPP_SETUP = ClassId(int(overview.ClassID.PPP_SETUP))
|
|
48
|
-
GPRS_MODEM_SETUP = ClassId(int(overview.ClassID.GPRS_MODEM_SETUP))
|
|
49
|
-
SMTP_SETUP = ClassId(int(overview.ClassID.SMTP_SETUP))
|
|
50
|
-
GSM_DIAGNOSTIC = ClassId(int(overview.ClassID.GSM_DIAGNOSTIC))
|
|
51
|
-
IPV6_SETUP = ClassId(int(overview.ClassID.IPV6_SETUP))
|
|
52
|
-
S_FSK_PHY_MAC_SET_UP = ClassId(int(overview.ClassID.S_FSK_PHY_MAC_SET_UP))
|
|
53
|
-
S_FSK_ACTIVE_INITIATOR = ClassId(int(overview.ClassID.S_FSK_ACTIVE_INITIATOR))
|
|
54
|
-
S_FSK_MAC_SYNCHRONIZATION_TIMEOUTS = ClassId(int(overview.ClassID.S_FSK_MAC_SYNCHRONIZATION_TIMEOUTS))
|
|
55
|
-
S_FSK_MAC_COUNTERS = ClassId(int(overview.ClassID.S_FSK_MAC_COUNTERS))
|
|
56
|
-
IEC_61334_4_32_LLC_SETUP = ClassId(int(overview.ClassID.IEC_61334_4_32_LLC_SETUP))
|
|
57
|
-
S_FSK_REPORTING_SYSTEM_LIST = ClassId(int(overview.ClassID.S_FSK_REPORTING_SYSTEM_LIST))
|
|
58
|
-
ISO_IEC_8802_2_LLC_TYPE_1_SETUP = ClassId(int(overview.ClassID.ISO_IEC_8802_2_LLC_TYPE_1_SETUP))
|
|
59
|
-
ISO_IEC_8802_2_LLC_TYPE_2_SETUP = ClassId(int(overview.ClassID.ISO_IEC_8802_2_LLC_TYPE_2_SETUP))
|
|
60
|
-
ISO_IEC_8802_2_LLC_TYPE_3_SETUP = ClassId(int(overview.ClassID.ISO_IEC_8802_2_LLC_TYPE_3_SETUP))
|
|
61
|
-
REGISTER_TABLE = ClassId(int(overview.ClassID.REGISTER_TABLE))
|
|
62
|
-
COMPACT_DATA = ClassId(int(overview.ClassID.COMPACT_DATA))
|
|
63
|
-
STATUS_MAPPING = ClassId(int(overview.ClassID.STATUS_MAPPING))
|
|
64
|
-
SECURITY_SETUP = ClassId(int(overview.ClassID.SECURITY_SETUP))
|
|
65
|
-
PARAMETER_MONITOR = ClassId(int(overview.ClassID.PARAMETER_MONITOR))
|
|
66
|
-
SENSOR_MANAGER_INTERFACE_CLASS = ClassId(int(overview.ClassID.SENSOR_MANAGER_INTERFACE_CLASS))
|
|
67
|
-
ARBITRATOR = ClassId(int(overview.ClassID.ARBITRATOR))
|
|
68
|
-
DISCONNECT_CONTROL = ClassId(int(overview.ClassID.DISCONNECT_CONTROL))
|
|
69
|
-
LIMITER = ClassId(int(overview.ClassID.LIMITER))
|
|
70
|
-
M_BUS_CLIENT = ClassId(int(overview.ClassID.M_BUS_CLIENT))
|
|
71
|
-
WIRELESS_MODE_Q_CHANNEL = ClassId(int(overview.ClassID.WIRELESS_MODE_Q_CHANNEL))
|
|
72
|
-
M_BUS_MASTER_PORT_SETUP = ClassId(int(overview.ClassID.M_BUS_MASTER_PORT_SETUP))
|
|
73
|
-
DLMS_COSEM_SERVER_M_BUS_PORT_SETUP = ClassId(int(overview.ClassID.DLMS_COSEM_SERVER_M_BUS_PORT_SETUP))
|
|
74
|
-
M_BUS_DIAGNOSTIC = ClassId(int(overview.ClassID.M_BUS_DIAGNOSTIC))
|
|
75
|
-
_61334_4_32_LLC_SSCS_SETUP = ClassId(int(overview.ClassID._61334_4_32_LLC_SSCS_SETUP))
|
|
76
|
-
PRIME_NB_OFDM_PLC_PHYSICAL_LAYER_COUNTERS = ClassId(int(overview.ClassID.PRIME_NB_OFDM_PLC_PHYSICAL_LAYER_COUNTERS))
|
|
77
|
-
PRIME_NB_OFDM_PLC_MAC_SETUP = ClassId(int(overview.ClassID.PRIME_NB_OFDM_PLC_MAC_SETUP))
|
|
78
|
-
PRIME_NB_OFDM_PLC_MAC_FUNCTIONAL_PARAMETERS = ClassId(int(overview.ClassID.PRIME_NB_OFDM_PLC_MAC_FUNCTIONAL_PARAMETERS))
|
|
79
|
-
PRIME_NB_OFDM_PLC_MAC_COUNTERS = ClassId(int(overview.ClassID.PRIME_NB_OFDM_PLC_MAC_COUNTERS))
|
|
80
|
-
PRIME_NB_OFDM_PLC_MAC_NETWORK_ADMINISTRATION_DATA = ClassId(int(overview.ClassID.PRIME_NB_OFDM_PLC_MAC_NETWORK_ADMINISTRATION_DATA))
|
|
81
|
-
PRIME_NB_OFDM_PLC_APPLICATION_IDENTIFICATION = ClassId(int(overview.ClassID.PRIME_NB_OFDM_PLC_APPLICATION_IDENTIFICATION))
|
|
82
|
-
G3_PLC_MAC_LAYER_COUNTERS = ClassId(int(overview.ClassID.G3_PLC_MAC_LAYER_COUNTERS))
|
|
83
|
-
G3_PLC_MAC_SETUP = ClassId(int(overview.ClassID.G3_PLC_MAC_SETUP))
|
|
84
|
-
G3_PLC_MAC_6LOWPAN_ADAPTATION_LAYER_SETUP = ClassId(int(overview.ClassID.G3_PLC_MAC_6LOWPAN_ADAPTATION_LAYER_SETUP))
|
|
85
|
-
WI_SUN_SETUP = ClassId(int(overview.ClassID.WI_SUN_SETUP))
|
|
86
|
-
WI_SUN_DIAGNOSTIC = ClassId(int(overview.ClassID.WI_SUN_DIAGNOSTIC))
|
|
87
|
-
RPL_DIAGNOSTIC = ClassId(int(overview.ClassID.RPL_DIAGNOSTIC))
|
|
88
|
-
MPL_DIAGNOSTIC = ClassId(int(overview.ClassID.MPL_DIAGNOSTIC))
|
|
89
|
-
NTP_SETUP = ClassId(int(overview.ClassID.NTP_SETUP))
|
|
90
|
-
ZIGBEE_SAS_STARTUP = ClassId(int(overview.ClassID.ZIGBEE_SAS_STARTUP))
|
|
91
|
-
ZIGBEE_SAS_JOIN = ClassId(int(overview.ClassID.ZIGBEE_SAS_JOIN))
|
|
92
|
-
ZIGBEE_SAS_APS_FRAGMENTATION = ClassId(int(overview.ClassID.ZIGBEE_SAS_APS_FRAGMENTATION))
|
|
93
|
-
ZIGBEE_NETWORK_CONTROL = ClassId(int(overview.ClassID.ZIGBEE_NETWORK_CONTROL))
|
|
94
|
-
ZIGBEE_TUNNEL_SETUP = ClassId(int(overview.ClassID.ZIGBEE_TUNNEL_SETUP))
|
|
95
|
-
ACCOUNT = ClassId(int(overview.ClassID.ACCOUNT))
|
|
96
|
-
CREDIT_INTERFACE_CLASS = ClassId(int(overview.ClassID.CREDIT_INTERFACE_CLASS))
|
|
97
|
-
CHARGE = ClassId(int(overview.ClassID.CHARGE))
|
|
98
|
-
TOKEN_GATEWAY = ClassId(int(overview.ClassID.TOKEN_GATEWAY))
|
|
99
|
-
FUNCTION_CONTROL = ClassId(int(overview.ClassID.FUNCTION_CONTROL))
|
|
100
|
-
ARRAY_MANAGER = ClassId(int(overview.ClassID.ARRAY_MANAGER))
|
|
101
|
-
COMMUNICATION_PORT_PROTECTION = ClassId(int(overview.ClassID.COMMUNICATION_PORT_PROTECTION))
|
|
102
|
-
SCHC_LPWAN_SETUP = ClassId(int(overview.ClassID.SCHC_LPWAN_SETUP))
|
|
103
|
-
SCHC_LPWAN_DIAGNOSTIC = ClassId(int(overview.ClassID.SCHC_LPWAN_DIAGNOSTIC))
|
|
104
|
-
LoRaWAN_SETUP = ClassId(int(overview.ClassID.LoRaWAN_SETUP))
|
|
105
|
-
LoRaWAN_DIAGNOSTIC = ClassId(int(overview.ClassID.LoRaWAN_DIAGNOSTIC))
|
|
106
|
-
ISO_IEC14908_IDENTIFICATION = ClassId(int(overview.ClassID.ISO_IEC14908_IDENTIFICATION))
|
|
107
|
-
ISO_IEC14908_PROTOCOL_SETUP = ClassId(int(overview.ClassID.ISO_IEC14908_PROTOCOL_SETUP))
|
|
108
|
-
ISO_IEC14908_PROTOCOL_STATUS = ClassId(int(overview.ClassID.ISO_IEC14908_PROTOCOL_STATUS))
|
|
109
|
-
ISO_IEC14908_PROTOCOL_DIAGNOSTIC = ClassId(int(overview.ClassID.ISO_IEC14908_PROTOCOL_DIAGNOSTIC))
|
|
110
|
-
HS_PLC_ISO_IEC_12139_1_MAC_SETUP = ClassId(int(overview.ClassID.HS_PLC_ISO_IEC_12139_1_MAC_SETUP))
|
|
111
|
-
HS_PLC_ISO_IEC_12139_1_CPAS_SETUP = ClassId(int(overview.ClassID.HS_PLC_ISO_IEC_12139_1_CPAS_SETUP))
|
|
112
|
-
HS_PLC_ISO_IEC_12139_1_IP_SSAS_SETUP = ClassId(int(overview.ClassID.HS_PLC_ISO_IEC_12139_1_IP_SSAS_SETUP))
|
|
113
|
-
HS_PLC_ISO_IEC_12139_1_HDLC_SSAS_SETUP = ClassId(int(overview.ClassID.HS_PLC_ISO_IEC_12139_1_HDLC_SSAS_SETUP))
|
|
114
|
-
LTE_MONITORING = ClassId(int(overview.ClassID.LTE_MONITORING))
|
|
115
|
-
CLIENT_SETUP = ClassId(int(overview.ClassID.CLIENT_SETUP))
|
|
116
|
-
|
|
117
|
-
@classmethod
|
|
118
|
-
def get_all_id(cls) -> tuple[int]:
|
|
119
|
-
"""return all id container in build-in <int>"""
|
|
120
|
-
return tuple(map(int, filter(lambda it: isinstance(it, ClassId), cls.__dict__.values())))
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
class ServerSAP(cdt.LongUnsigned):
|
|
124
|
-
|
|
125
|
-
def validate(self):
|
|
126
|
-
if int.from_bytes(self.contents, 'big') > 0x3FFF:
|
|
127
|
-
raise ValueError(F'The range for the server_SAP is 0x000…0x3FFF, but got {self.contents.hex()}')
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from ...types import common_data_types as cdt
|
|
3
|
+
from ...cosem_interface_classes import overview
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ClassId(cdt.LongUnsigned):
|
|
7
|
+
""" Class ID type """
|
|
8
|
+
DEFAULT = 1
|
|
9
|
+
|
|
10
|
+
def validate(self):
|
|
11
|
+
if not int(self) in overview.ClassID.get_all_id():
|
|
12
|
+
raise ValueError(F'Unknown DLMS class with ID {int(self)}')
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass(frozen=True)
|
|
16
|
+
class ClassIDCDT:
|
|
17
|
+
DATA = ClassId(int(overview.ClassID.DATA))
|
|
18
|
+
REGISTER = ClassId(int(overview.ClassID.REGISTER))
|
|
19
|
+
EXT_REGISTER = ClassId(int(overview.ClassID.EXT_REGISTER))
|
|
20
|
+
DEMAND_REGISTER = ClassId(int(overview.ClassID.DEMAND_REGISTER))
|
|
21
|
+
REGISTER_ACTIVATION = ClassId(int(overview.ClassID.REGISTER_ACTIVATION))
|
|
22
|
+
PROFILE_GENERIC = ClassId(int(overview.ClassID.PROFILE_GENERIC))
|
|
23
|
+
CLOCK = ClassId(int(overview.ClassID.CLOCK))
|
|
24
|
+
SCRIPT_TABLE = ClassId(int(overview.ClassID.SCRIPT_TABLE))
|
|
25
|
+
SCHEDULE = ClassId(int(overview.ClassID.SCHEDULE))
|
|
26
|
+
SPECIAL_DAYS_TABLE = ClassId(int(overview.ClassID.SPECIAL_DAYS_TABLE))
|
|
27
|
+
ASSOCIATION_SN_CLASS = ClassId(int(overview.ClassID.ASSOCIATION_SN))
|
|
28
|
+
ASSOCIATION_LN_CLASS = ClassId(int(overview.ClassID.ASSOCIATION_LN))
|
|
29
|
+
SAP_ASSIGNMENT = ClassId(int(overview.ClassID.SAP_ASSIGNMENT))
|
|
30
|
+
IMAGE_TRANSFER = ClassId(int(overview.ClassID.IMAGE_TRANSFER))
|
|
31
|
+
IEC_LOCAL_PORT_SETUP = ClassId(int(overview.ClassID.IEC_LOCAL_PORT_SETUP))
|
|
32
|
+
ACTIVITY_CALENDAR = ClassId(int(overview.ClassID.ACTIVITY_CALENDAR))
|
|
33
|
+
REGISTER_MONITOR = ClassId(int(overview.ClassID.REGISTER_MONITOR))
|
|
34
|
+
SINGLE_ACTION_SCHEDULE = ClassId(int(overview.ClassID.SINGLE_ACTION_SCHEDULE))
|
|
35
|
+
IEC_HDLC_SETUP = ClassId(int(overview.ClassID.IEC_HDLC_SETUP))
|
|
36
|
+
IEC_TWISTED_PAIR__1__SETUP = ClassId(int(overview.ClassID.IEC_TWISTED_PAIR_1_SETUP))
|
|
37
|
+
M_BUS_SLAVE_PORT_SETUP = ClassId(int(overview.ClassID.M_BUS_SLAVE_PORT_SETUP))
|
|
38
|
+
UTILITY_TABLES = ClassId(int(overview.ClassID.UTILITY_TABLES))
|
|
39
|
+
MODEM_CONFIGURATION = ClassId(int(overview.ClassID.MODEM_CONFIGURATION))
|
|
40
|
+
AUTO_ANSWER = ClassId(int(overview.ClassID.AUTO_ANSWER))
|
|
41
|
+
AUTO_CONNECT = ClassId(int(overview.ClassID.AUTO_CONNECT))
|
|
42
|
+
COSEM_DATA_PROTECTION = ClassId(int(overview.ClassID.COSEM_DATA_PROTECTION))
|
|
43
|
+
PUSH_SETUP = ClassId(int(overview.ClassID.PUSH_SETUP))
|
|
44
|
+
TCP_UDP_SETUP = ClassId(int(overview.ClassID.TCP_UDP_SETUP))
|
|
45
|
+
IPV4_SETUP = ClassId(int(overview.ClassID.IPV4_SETUP))
|
|
46
|
+
PRIME_NB_OFDM_PLC_MAC_ADDRESS_SETUP = ClassId(int(overview.ClassID.PRIME_NB_OFDM_PLC_MAC_ADDRESS_SETUP))
|
|
47
|
+
PPP_SETUP = ClassId(int(overview.ClassID.PPP_SETUP))
|
|
48
|
+
GPRS_MODEM_SETUP = ClassId(int(overview.ClassID.GPRS_MODEM_SETUP))
|
|
49
|
+
SMTP_SETUP = ClassId(int(overview.ClassID.SMTP_SETUP))
|
|
50
|
+
GSM_DIAGNOSTIC = ClassId(int(overview.ClassID.GSM_DIAGNOSTIC))
|
|
51
|
+
IPV6_SETUP = ClassId(int(overview.ClassID.IPV6_SETUP))
|
|
52
|
+
S_FSK_PHY_MAC_SET_UP = ClassId(int(overview.ClassID.S_FSK_PHY_MAC_SET_UP))
|
|
53
|
+
S_FSK_ACTIVE_INITIATOR = ClassId(int(overview.ClassID.S_FSK_ACTIVE_INITIATOR))
|
|
54
|
+
S_FSK_MAC_SYNCHRONIZATION_TIMEOUTS = ClassId(int(overview.ClassID.S_FSK_MAC_SYNCHRONIZATION_TIMEOUTS))
|
|
55
|
+
S_FSK_MAC_COUNTERS = ClassId(int(overview.ClassID.S_FSK_MAC_COUNTERS))
|
|
56
|
+
IEC_61334_4_32_LLC_SETUP = ClassId(int(overview.ClassID.IEC_61334_4_32_LLC_SETUP))
|
|
57
|
+
S_FSK_REPORTING_SYSTEM_LIST = ClassId(int(overview.ClassID.S_FSK_REPORTING_SYSTEM_LIST))
|
|
58
|
+
ISO_IEC_8802_2_LLC_TYPE_1_SETUP = ClassId(int(overview.ClassID.ISO_IEC_8802_2_LLC_TYPE_1_SETUP))
|
|
59
|
+
ISO_IEC_8802_2_LLC_TYPE_2_SETUP = ClassId(int(overview.ClassID.ISO_IEC_8802_2_LLC_TYPE_2_SETUP))
|
|
60
|
+
ISO_IEC_8802_2_LLC_TYPE_3_SETUP = ClassId(int(overview.ClassID.ISO_IEC_8802_2_LLC_TYPE_3_SETUP))
|
|
61
|
+
REGISTER_TABLE = ClassId(int(overview.ClassID.REGISTER_TABLE))
|
|
62
|
+
COMPACT_DATA = ClassId(int(overview.ClassID.COMPACT_DATA))
|
|
63
|
+
STATUS_MAPPING = ClassId(int(overview.ClassID.STATUS_MAPPING))
|
|
64
|
+
SECURITY_SETUP = ClassId(int(overview.ClassID.SECURITY_SETUP))
|
|
65
|
+
PARAMETER_MONITOR = ClassId(int(overview.ClassID.PARAMETER_MONITOR))
|
|
66
|
+
SENSOR_MANAGER_INTERFACE_CLASS = ClassId(int(overview.ClassID.SENSOR_MANAGER_INTERFACE_CLASS))
|
|
67
|
+
ARBITRATOR = ClassId(int(overview.ClassID.ARBITRATOR))
|
|
68
|
+
DISCONNECT_CONTROL = ClassId(int(overview.ClassID.DISCONNECT_CONTROL))
|
|
69
|
+
LIMITER = ClassId(int(overview.ClassID.LIMITER))
|
|
70
|
+
M_BUS_CLIENT = ClassId(int(overview.ClassID.M_BUS_CLIENT))
|
|
71
|
+
WIRELESS_MODE_Q_CHANNEL = ClassId(int(overview.ClassID.WIRELESS_MODE_Q_CHANNEL))
|
|
72
|
+
M_BUS_MASTER_PORT_SETUP = ClassId(int(overview.ClassID.M_BUS_MASTER_PORT_SETUP))
|
|
73
|
+
DLMS_COSEM_SERVER_M_BUS_PORT_SETUP = ClassId(int(overview.ClassID.DLMS_COSEM_SERVER_M_BUS_PORT_SETUP))
|
|
74
|
+
M_BUS_DIAGNOSTIC = ClassId(int(overview.ClassID.M_BUS_DIAGNOSTIC))
|
|
75
|
+
_61334_4_32_LLC_SSCS_SETUP = ClassId(int(overview.ClassID._61334_4_32_LLC_SSCS_SETUP))
|
|
76
|
+
PRIME_NB_OFDM_PLC_PHYSICAL_LAYER_COUNTERS = ClassId(int(overview.ClassID.PRIME_NB_OFDM_PLC_PHYSICAL_LAYER_COUNTERS))
|
|
77
|
+
PRIME_NB_OFDM_PLC_MAC_SETUP = ClassId(int(overview.ClassID.PRIME_NB_OFDM_PLC_MAC_SETUP))
|
|
78
|
+
PRIME_NB_OFDM_PLC_MAC_FUNCTIONAL_PARAMETERS = ClassId(int(overview.ClassID.PRIME_NB_OFDM_PLC_MAC_FUNCTIONAL_PARAMETERS))
|
|
79
|
+
PRIME_NB_OFDM_PLC_MAC_COUNTERS = ClassId(int(overview.ClassID.PRIME_NB_OFDM_PLC_MAC_COUNTERS))
|
|
80
|
+
PRIME_NB_OFDM_PLC_MAC_NETWORK_ADMINISTRATION_DATA = ClassId(int(overview.ClassID.PRIME_NB_OFDM_PLC_MAC_NETWORK_ADMINISTRATION_DATA))
|
|
81
|
+
PRIME_NB_OFDM_PLC_APPLICATION_IDENTIFICATION = ClassId(int(overview.ClassID.PRIME_NB_OFDM_PLC_APPLICATION_IDENTIFICATION))
|
|
82
|
+
G3_PLC_MAC_LAYER_COUNTERS = ClassId(int(overview.ClassID.G3_PLC_MAC_LAYER_COUNTERS))
|
|
83
|
+
G3_PLC_MAC_SETUP = ClassId(int(overview.ClassID.G3_PLC_MAC_SETUP))
|
|
84
|
+
G3_PLC_MAC_6LOWPAN_ADAPTATION_LAYER_SETUP = ClassId(int(overview.ClassID.G3_PLC_MAC_6LOWPAN_ADAPTATION_LAYER_SETUP))
|
|
85
|
+
WI_SUN_SETUP = ClassId(int(overview.ClassID.WI_SUN_SETUP))
|
|
86
|
+
WI_SUN_DIAGNOSTIC = ClassId(int(overview.ClassID.WI_SUN_DIAGNOSTIC))
|
|
87
|
+
RPL_DIAGNOSTIC = ClassId(int(overview.ClassID.RPL_DIAGNOSTIC))
|
|
88
|
+
MPL_DIAGNOSTIC = ClassId(int(overview.ClassID.MPL_DIAGNOSTIC))
|
|
89
|
+
NTP_SETUP = ClassId(int(overview.ClassID.NTP_SETUP))
|
|
90
|
+
ZIGBEE_SAS_STARTUP = ClassId(int(overview.ClassID.ZIGBEE_SAS_STARTUP))
|
|
91
|
+
ZIGBEE_SAS_JOIN = ClassId(int(overview.ClassID.ZIGBEE_SAS_JOIN))
|
|
92
|
+
ZIGBEE_SAS_APS_FRAGMENTATION = ClassId(int(overview.ClassID.ZIGBEE_SAS_APS_FRAGMENTATION))
|
|
93
|
+
ZIGBEE_NETWORK_CONTROL = ClassId(int(overview.ClassID.ZIGBEE_NETWORK_CONTROL))
|
|
94
|
+
ZIGBEE_TUNNEL_SETUP = ClassId(int(overview.ClassID.ZIGBEE_TUNNEL_SETUP))
|
|
95
|
+
ACCOUNT = ClassId(int(overview.ClassID.ACCOUNT))
|
|
96
|
+
CREDIT_INTERFACE_CLASS = ClassId(int(overview.ClassID.CREDIT_INTERFACE_CLASS))
|
|
97
|
+
CHARGE = ClassId(int(overview.ClassID.CHARGE))
|
|
98
|
+
TOKEN_GATEWAY = ClassId(int(overview.ClassID.TOKEN_GATEWAY))
|
|
99
|
+
FUNCTION_CONTROL = ClassId(int(overview.ClassID.FUNCTION_CONTROL))
|
|
100
|
+
ARRAY_MANAGER = ClassId(int(overview.ClassID.ARRAY_MANAGER))
|
|
101
|
+
COMMUNICATION_PORT_PROTECTION = ClassId(int(overview.ClassID.COMMUNICATION_PORT_PROTECTION))
|
|
102
|
+
SCHC_LPWAN_SETUP = ClassId(int(overview.ClassID.SCHC_LPWAN_SETUP))
|
|
103
|
+
SCHC_LPWAN_DIAGNOSTIC = ClassId(int(overview.ClassID.SCHC_LPWAN_DIAGNOSTIC))
|
|
104
|
+
LoRaWAN_SETUP = ClassId(int(overview.ClassID.LoRaWAN_SETUP))
|
|
105
|
+
LoRaWAN_DIAGNOSTIC = ClassId(int(overview.ClassID.LoRaWAN_DIAGNOSTIC))
|
|
106
|
+
ISO_IEC14908_IDENTIFICATION = ClassId(int(overview.ClassID.ISO_IEC14908_IDENTIFICATION))
|
|
107
|
+
ISO_IEC14908_PROTOCOL_SETUP = ClassId(int(overview.ClassID.ISO_IEC14908_PROTOCOL_SETUP))
|
|
108
|
+
ISO_IEC14908_PROTOCOL_STATUS = ClassId(int(overview.ClassID.ISO_IEC14908_PROTOCOL_STATUS))
|
|
109
|
+
ISO_IEC14908_PROTOCOL_DIAGNOSTIC = ClassId(int(overview.ClassID.ISO_IEC14908_PROTOCOL_DIAGNOSTIC))
|
|
110
|
+
HS_PLC_ISO_IEC_12139_1_MAC_SETUP = ClassId(int(overview.ClassID.HS_PLC_ISO_IEC_12139_1_MAC_SETUP))
|
|
111
|
+
HS_PLC_ISO_IEC_12139_1_CPAS_SETUP = ClassId(int(overview.ClassID.HS_PLC_ISO_IEC_12139_1_CPAS_SETUP))
|
|
112
|
+
HS_PLC_ISO_IEC_12139_1_IP_SSAS_SETUP = ClassId(int(overview.ClassID.HS_PLC_ISO_IEC_12139_1_IP_SSAS_SETUP))
|
|
113
|
+
HS_PLC_ISO_IEC_12139_1_HDLC_SSAS_SETUP = ClassId(int(overview.ClassID.HS_PLC_ISO_IEC_12139_1_HDLC_SSAS_SETUP))
|
|
114
|
+
LTE_MONITORING = ClassId(int(overview.ClassID.LTE_MONITORING))
|
|
115
|
+
CLIENT_SETUP = ClassId(int(overview.ClassID.CLIENT_SETUP))
|
|
116
|
+
|
|
117
|
+
@classmethod
|
|
118
|
+
def get_all_id(cls) -> tuple[int]:
|
|
119
|
+
"""return all id container in build-in <int>"""
|
|
120
|
+
return tuple(map(int, filter(lambda it: isinstance(it, ClassId), cls.__dict__.values())))
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class ServerSAP(cdt.LongUnsigned):
|
|
124
|
+
|
|
125
|
+
def validate(self):
|
|
126
|
+
if int.from_bytes(self.contents, 'big') > 0x3FFF:
|
|
127
|
+
raise ValueError(F'The range for the server_SAP is 0x000…0x3FFF, but got {self.contents.hex()}')
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
from ...types import common_data_types as cdt
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class LDN(cdt.OctetString):
|
|
5
|
-
"""for ldn. todo: check length in initialisation"""
|
|
6
|
-
def get_manufacturer(self) -> bytes:
|
|
7
|
-
return self.contents[:3]
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class ID(cdt.OctetString):
|
|
11
|
-
"""for all implementation of Identifiers"""
|
|
1
|
+
from ...types import common_data_types as cdt
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class LDN(cdt.OctetString):
|
|
5
|
+
"""for ldn. todo: check length in initialisation"""
|
|
6
|
+
def get_manufacturer(self) -> bytes:
|
|
7
|
+
return self.contents[:3]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ID(cdt.OctetString):
|
|
11
|
+
"""for all implementation of Identifiers"""
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
""" COMMON Structs """
|
|
2
|
-
from abc import ABC, abstractmethod
|
|
3
|
-
from ...types import common_data_types as cdt, cosem_service_types as cst
|
|
4
|
-
from . import long_unsigneds
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class ActionItem(cdt.Structure):
|
|
8
|
-
script_logical_name: cst.LogicalName
|
|
9
|
-
script_selector: cdt.LongUnsigned
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class ValueDefinition(cdt.Structure):
|
|
13
|
-
""" Defines an attribute of an object to be monitored. Only attributes with simple data types are allowed. """
|
|
14
|
-
class_id: long_unsigneds.ClassId
|
|
15
|
-
logical_name: cst.LogicalName
|
|
16
|
-
attribute_index: cdt.Integer
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class RestrictionByDate(cdt.Structure):
|
|
20
|
-
from_date: cst.OctetStringDate
|
|
21
|
-
to_date: cst.OctetStringDate
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class RestrictionByEntry(cdt.Structure):
|
|
25
|
-
from_entry: cdt.DoubleLongUnsigned
|
|
26
|
-
to_entry: cdt.DoubleLongUnsigned
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class CaptureObjectDefinition(cdt.Structure):
|
|
30
|
-
""" Capture objects that are assigned to the object instance. Upon a call of the capture (data) method or automatically
|
|
31
|
-
in defined intervals, the selected attributes are copied into the buffer of the profile. """
|
|
32
|
-
DEFAULT = b'\x02\x04\x12\x00\x08\x09\x06\x00\x00\x01\x00\x00\xff\x0f\x02\x12\x00\x00'
|
|
33
|
-
class_id: long_unsigneds.ClassId
|
|
34
|
-
logical_name: cst.LogicalName
|
|
35
|
-
attribute_index: cdt.Integer
|
|
36
|
-
data_index: cdt.LongUnsigned
|
|
37
|
-
|
|
38
|
-
def __hash__(self):
|
|
39
|
-
return int.from_bytes(self.logical_name.contents+self.attribute_index.contents+self.data_index.contents, 'big')
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
class WindowElement(cdt.Structure):
|
|
43
|
-
start_time: cst.OctetStringDateTime
|
|
44
|
-
end_time: cst.OctetStringDateTime
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
class AccessRight(cdt.Structure):
|
|
48
|
-
""" TODO: maybe more nested description"""
|
|
49
|
-
attribute_access: cdt.Array
|
|
50
|
-
method_access: cdt.Array
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
class ObjectListElement(cdt.Structure):
|
|
54
|
-
"""common for AssociationLN"""
|
|
55
|
-
class_id: long_unsigneds.ClassId
|
|
56
|
-
version: cdt.Unsigned
|
|
57
|
-
logical_name: cst.LogicalName
|
|
58
|
-
access_rights: AccessRight
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
class UserListEntry(cdt.Structure):
|
|
62
|
-
"""user_list_entry"""
|
|
63
|
-
user_id: cdt.Unsigned
|
|
64
|
-
user_name: cdt.VisibleString
|
|
1
|
+
""" COMMON Structs """
|
|
2
|
+
from abc import ABC, abstractmethod
|
|
3
|
+
from ...types import common_data_types as cdt, cosem_service_types as cst
|
|
4
|
+
from . import long_unsigneds
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ActionItem(cdt.Structure):
|
|
8
|
+
script_logical_name: cst.LogicalName
|
|
9
|
+
script_selector: cdt.LongUnsigned
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ValueDefinition(cdt.Structure):
|
|
13
|
+
""" Defines an attribute of an object to be monitored. Only attributes with simple data types are allowed. """
|
|
14
|
+
class_id: long_unsigneds.ClassId
|
|
15
|
+
logical_name: cst.LogicalName
|
|
16
|
+
attribute_index: cdt.Integer
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class RestrictionByDate(cdt.Structure):
|
|
20
|
+
from_date: cst.OctetStringDate
|
|
21
|
+
to_date: cst.OctetStringDate
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class RestrictionByEntry(cdt.Structure):
|
|
25
|
+
from_entry: cdt.DoubleLongUnsigned
|
|
26
|
+
to_entry: cdt.DoubleLongUnsigned
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class CaptureObjectDefinition(cdt.Structure):
|
|
30
|
+
""" Capture objects that are assigned to the object instance. Upon a call of the capture (data) method or automatically
|
|
31
|
+
in defined intervals, the selected attributes are copied into the buffer of the profile. """
|
|
32
|
+
DEFAULT = b'\x02\x04\x12\x00\x08\x09\x06\x00\x00\x01\x00\x00\xff\x0f\x02\x12\x00\x00'
|
|
33
|
+
class_id: long_unsigneds.ClassId
|
|
34
|
+
logical_name: cst.LogicalName
|
|
35
|
+
attribute_index: cdt.Integer
|
|
36
|
+
data_index: cdt.LongUnsigned
|
|
37
|
+
|
|
38
|
+
def __hash__(self):
|
|
39
|
+
return int.from_bytes(self.logical_name.contents+self.attribute_index.contents+self.data_index.contents, 'big')
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class WindowElement(cdt.Structure):
|
|
43
|
+
start_time: cst.OctetStringDateTime
|
|
44
|
+
end_time: cst.OctetStringDateTime
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class AccessRight(cdt.Structure):
|
|
48
|
+
""" TODO: maybe more nested description"""
|
|
49
|
+
attribute_access: cdt.Array
|
|
50
|
+
method_access: cdt.Array
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class ObjectListElement(cdt.Structure):
|
|
54
|
+
"""common for AssociationLN"""
|
|
55
|
+
class_id: long_unsigneds.ClassId
|
|
56
|
+
version: cdt.Unsigned
|
|
57
|
+
logical_name: cst.LogicalName
|
|
58
|
+
access_rights: AccessRight
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class UserListEntry(cdt.Structure):
|
|
62
|
+
"""user_list_entry"""
|
|
63
|
+
user_id: cdt.Unsigned
|
|
64
|
+
user_name: cdt.VisibleString
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from struct import Struct
|
|
3
|
+
from StructResult import result
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
type Obis = bytes # bytes[6]
|
|
7
|
+
type Index = int # 0..
|
|
8
|
+
type GruoupI = int # group index of Obis 0..
|
|
9
|
+
type Attr = bytes # bytes[7]
|
|
10
|
+
type Encoding = bytes # bytes[1..]
|
|
11
|
+
type LN = str # logical name as "a.b.c.d.e.f"
|
|
12
|
+
type Tag = bytes # bytes[1] CDT tag
|
|
13
|
+
type AttrDesc = bytes # bytes[]
|
|
14
|
+
|
|
15
|
+
def attr2obis(attr: Attr) -> Obis:
|
|
16
|
+
return attr[:6]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def attr2a(attr: Attr | Obis) -> GruoupI:
|
|
20
|
+
return attr[0]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def attr2b(attr: Attr | Obis) -> GruoupI:
|
|
24
|
+
return attr[1]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def attr2c(attr: Attr | Obis) -> GruoupI:
|
|
28
|
+
return attr[2]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def attr2d(attr: Attr | Obis) -> GruoupI:
|
|
32
|
+
return attr[3]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def attr2e(attr: Attr | Obis) -> GruoupI:
|
|
36
|
+
return attr[4]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def attr2f(attr: Attr | Obis) -> GruoupI:
|
|
40
|
+
return attr[5]
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def attr2i(attr: Attr) -> Index:
|
|
44
|
+
return attr[6]
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
obis2attr_pat = Struct(">6sB")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def unpack_attr(attr: Attr) -> tuple[Obis, Index]:
|
|
51
|
+
return obis2attr_pat.unpack(attr)
|
|
52
|
+
|
|
53
|
+
def pack_attr(obis: Obis, i: Index) -> Attr:
|
|
54
|
+
return obis2attr_pat.pack(obis, i)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
ln_pattern = re.compile("(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})")
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def ln2obis(ln: str) -> result.SimpleOrError[Obis]:
|
|
61
|
+
""" create Obis from string type ddd.ddd.ddd.ddd.ddd.ddd, ex.: 0.0.1.0.0.255 """
|
|
62
|
+
if (res := ln_pattern.search(ln)) is None:
|
|
63
|
+
return result.Error.from_e(ValueError(F"got wrong {ln=}"), "ln2obis")
|
|
64
|
+
return result.Simple(bytes(map(int, res.groups())))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
__all__ = [
|
|
68
|
+
"Obis",
|
|
69
|
+
"Attr",
|
|
70
|
+
"AttrDesc",
|
|
71
|
+
"Encoding",
|
|
72
|
+
"Index",
|
|
73
|
+
"Tag"
|
|
74
|
+
]
|