DLMS-SPODES 0.87.17__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.
Files changed (103) hide show
  1. DLMS_SPODES/Values/EN/__init__.py +1 -1
  2. DLMS_SPODES/Values/EN/actors.py +8 -8
  3. DLMS_SPODES/Values/EN/relation_to_obis_names.py +387 -387
  4. DLMS_SPODES/Values/RU/__init__.py +1 -1
  5. DLMS_SPODES/Values/RU/actors.py +8 -8
  6. DLMS_SPODES/Values/RU/relation_to_obis_names.py +396 -396
  7. DLMS_SPODES/__init__.py +6 -6
  8. DLMS_SPODES/configEN.ini +126 -126
  9. DLMS_SPODES/config_parser.py +53 -53
  10. DLMS_SPODES/cosem_interface_classes/Overview/__init__.py +0 -0
  11. DLMS_SPODES/cosem_interface_classes/Overview/class_id.py +107 -0
  12. DLMS_SPODES/cosem_interface_classes/__class_init__.py +3 -3
  13. DLMS_SPODES/cosem_interface_classes/__init__.py +3 -2
  14. DLMS_SPODES/cosem_interface_classes/activity_calendar.py +210 -254
  15. DLMS_SPODES/cosem_interface_classes/arbitrator.py +78 -105
  16. DLMS_SPODES/cosem_interface_classes/association_ln/abstract.py +50 -34
  17. DLMS_SPODES/cosem_interface_classes/association_ln/authentication_mechanism_name.py +25 -25
  18. DLMS_SPODES/cosem_interface_classes/association_ln/mechanism_id.py +25 -25
  19. DLMS_SPODES/cosem_interface_classes/association_ln/method.py +5 -5
  20. DLMS_SPODES/cosem_interface_classes/association_ln/ver0.py +440 -485
  21. DLMS_SPODES/cosem_interface_classes/association_ln/ver1.py +126 -133
  22. DLMS_SPODES/cosem_interface_classes/association_ln/ver2.py +30 -36
  23. DLMS_SPODES/cosem_interface_classes/association_ln/ver3.py +3 -4
  24. DLMS_SPODES/cosem_interface_classes/association_sn/ver0.py +14 -12
  25. DLMS_SPODES/cosem_interface_classes/clock.py +81 -131
  26. DLMS_SPODES/cosem_interface_classes/collection.py +2106 -2122
  27. DLMS_SPODES/cosem_interface_classes/cosem_interface_class.py +525 -583
  28. DLMS_SPODES/cosem_interface_classes/data.py +12 -21
  29. DLMS_SPODES/cosem_interface_classes/demand_register/ver0.py +32 -59
  30. DLMS_SPODES/cosem_interface_classes/disconnect_control.py +56 -74
  31. DLMS_SPODES/cosem_interface_classes/extended_register.py +18 -27
  32. DLMS_SPODES/cosem_interface_classes/gprs_modem_setup.py +33 -43
  33. DLMS_SPODES/cosem_interface_classes/gsm_diagnostic/ver0.py +78 -103
  34. DLMS_SPODES/cosem_interface_classes/gsm_diagnostic/ver1.py +42 -40
  35. DLMS_SPODES/cosem_interface_classes/gsm_diagnostic/ver2.py +6 -9
  36. DLMS_SPODES/cosem_interface_classes/iec_hdlc_setup/ver0.py +11 -11
  37. DLMS_SPODES/cosem_interface_classes/iec_hdlc_setup/ver1.py +27 -53
  38. DLMS_SPODES/cosem_interface_classes/iec_local_port_setup.py +9 -11
  39. DLMS_SPODES/cosem_interface_classes/image_transfer/image_transfer_status.py +15 -15
  40. DLMS_SPODES/cosem_interface_classes/image_transfer/ver0.py +54 -126
  41. DLMS_SPODES/cosem_interface_classes/implementations/__init__.py +3 -3
  42. DLMS_SPODES/cosem_interface_classes/implementations/arbitrator.py +19 -19
  43. DLMS_SPODES/cosem_interface_classes/implementations/data.py +491 -487
  44. DLMS_SPODES/cosem_interface_classes/implementations/profile_generic.py +85 -83
  45. DLMS_SPODES/cosem_interface_classes/ipv4_setup.py +42 -72
  46. DLMS_SPODES/cosem_interface_classes/limiter.py +77 -111
  47. DLMS_SPODES/cosem_interface_classes/ln_pattern.py +334 -333
  48. DLMS_SPODES/cosem_interface_classes/modem_configuration/ver0.py +51 -65
  49. DLMS_SPODES/cosem_interface_classes/modem_configuration/ver1.py +27 -39
  50. DLMS_SPODES/cosem_interface_classes/ntp_setup/ver0.py +48 -67
  51. DLMS_SPODES/cosem_interface_classes/obis.py +28 -23
  52. DLMS_SPODES/cosem_interface_classes/overview.py +198 -197
  53. DLMS_SPODES/cosem_interface_classes/parameter.py +548 -547
  54. DLMS_SPODES/cosem_interface_classes/parameters.py +172 -172
  55. DLMS_SPODES/cosem_interface_classes/profile_generic/ver0.py +90 -133
  56. DLMS_SPODES/cosem_interface_classes/profile_generic/ver1.py +268 -277
  57. DLMS_SPODES/cosem_interface_classes/push_setup/ver0.py +13 -12
  58. DLMS_SPODES/cosem_interface_classes/push_setup/ver1.py +9 -10
  59. DLMS_SPODES/cosem_interface_classes/push_setup/ver2.py +124 -166
  60. DLMS_SPODES/cosem_interface_classes/register.py +18 -45
  61. DLMS_SPODES/cosem_interface_classes/register_activation/ver0.py +45 -80
  62. DLMS_SPODES/cosem_interface_classes/register_monitor.py +33 -46
  63. DLMS_SPODES/cosem_interface_classes/reports.py +72 -70
  64. DLMS_SPODES/cosem_interface_classes/schedule.py +88 -176
  65. DLMS_SPODES/cosem_interface_classes/script_table.py +54 -87
  66. DLMS_SPODES/cosem_interface_classes/security_setup/ver0.py +45 -68
  67. DLMS_SPODES/cosem_interface_classes/security_setup/ver1.py +122 -158
  68. DLMS_SPODES/cosem_interface_classes/single_action_schedule.py +34 -50
  69. DLMS_SPODES/cosem_interface_classes/special_days_table.py +54 -84
  70. DLMS_SPODES/cosem_interface_classes/tcp_udp_setup.py +20 -42
  71. DLMS_SPODES/cosem_pdu.py +93 -93
  72. DLMS_SPODES/enums.py +625 -625
  73. DLMS_SPODES/exceptions.py +106 -106
  74. DLMS_SPODES/firmwares.py +99 -99
  75. DLMS_SPODES/hdlc/frame.py +875 -875
  76. DLMS_SPODES/hdlc/sub_layer.py +54 -54
  77. DLMS_SPODES/literals.py +17 -17
  78. DLMS_SPODES/obis/__init__.py +1 -1
  79. DLMS_SPODES/obis/media_id.py +931 -931
  80. DLMS_SPODES/pardata.py +22 -22
  81. DLMS_SPODES/pdu_enums.py +98 -98
  82. DLMS_SPODES/relation_to_OBIS.py +463 -465
  83. DLMS_SPODES/settings.py +551 -551
  84. DLMS_SPODES/types/choices.py +140 -142
  85. DLMS_SPODES/types/common_data_types.py +2379 -2401
  86. DLMS_SPODES/types/cosem_service_types.py +109 -109
  87. DLMS_SPODES/types/implementations/arrays.py +25 -25
  88. DLMS_SPODES/types/implementations/bitstrings.py +97 -97
  89. DLMS_SPODES/types/implementations/double_long_usingneds.py +35 -35
  90. DLMS_SPODES/types/implementations/enums.py +57 -57
  91. DLMS_SPODES/types/implementations/integers.py +12 -11
  92. DLMS_SPODES/types/implementations/long_unsigneds.py +127 -127
  93. DLMS_SPODES/types/implementations/octet_string.py +11 -11
  94. DLMS_SPODES/types/implementations/structs.py +64 -64
  95. DLMS_SPODES/types/type_alias.py +74 -0
  96. DLMS_SPODES/types/useful_types.py +627 -677
  97. {dlms_spodes-0.87.17.dist-info → dlms_spodes-0.88.1.dist-info}/METADATA +30 -30
  98. dlms_spodes-0.88.1.dist-info/RECORD +118 -0
  99. {dlms_spodes-0.87.17.dist-info → dlms_spodes-0.88.1.dist-info}/WHEEL +1 -1
  100. DLMS_SPODES/cosem_interface_classes/a_parameter.py +0 -20
  101. DLMS_SPODES/cosem_interface_classes/attr_indexes.py +0 -12
  102. dlms_spodes-0.87.17.dist-info/RECORD +0 -117
  103. {dlms_spodes-0.87.17.dist-info → dlms_spodes-0.88.1.dist-info}/top_level.txt +0 -0
@@ -1,68 +1,45 @@
1
- from ..__class_init__ import *
2
- from ..overview import VERSION_0
3
-
4
-
5
- class SecurityPolicy(cdt.Enum, elements=tuple(range(16))):
6
- """ Enforces authentication and/or encrypting algorithm provided with security_suite """
7
-
8
-
9
- class SecuritySuite(cdt.Enum, elements=tuple(range(16))):
10
- """Specifies authentication, encryption and key transport algorithm"""
11
- AES_GCM_128_AUT_ENCR_AND_AES_128_KEY_WRAP = 0
12
-
13
-
14
- class KeyID(cdt.Enum, elements=(0, 1, 2)):
15
- """Use only in KeyData structure"""
16
-
17
-
18
- class KeyData(cdt.Structure):
19
- """ TODO: """
20
- key_id: KeyID
21
- key_wrapped: cdt.OctetString
22
-
23
-
24
- class GlobalKeyTransfer(cdt.Array):
25
- """ Array of key_data """
26
- TYPE = KeyData
27
-
28
-
29
- class SecuritySetup(ic.COSEMInterfaceClasses):
30
- """ Instances of the “Security setup” IC contain the necessary information on the security suite in use and the security policy applicable between the server and a client
31
- and/or third party indentify by their respective system titles. They also provide methods to increase the level of security and to manage symmetric keys, asymmetric key pairs
32
- and certificates """
33
- CLASS_ID = ClassID.SECURITY_SETUP
34
- VERSION = VERSION_0
35
- A_ELEMENTS = (ic.ICAElement("security_policy", SecurityPolicy, 0, 3, 0),
36
- ic.ICAElement("security_suite", SecuritySuite, 0, 0, 0),
37
- ic.ICAElement("client_system_title", cdt.OctetString, classifier=ic.Classifier.DYNAMIC),
38
- ic.ICAElement("server_system_title", cdt.OctetString))
39
-
40
- M_ELEMENTS = (ic.ICMElement("security_activate", SecurityPolicy),
41
- ic.ICMElement("global_key_transfer", GlobalKeyTransfer))
42
-
43
- def characteristics_init(self):
44
- """nothing do it"""
45
-
46
- @property
47
- def security_policy(self) -> SecurityPolicy:
48
- return self.get_attr(2)
49
-
50
- @property
51
- def security_suite(self) -> SecuritySuite:
52
- return self.get_attr(3)
53
-
54
- @property
55
- def client_system_title(self) -> cdt.OctetString:
56
- return self .get_attr(4)
57
-
58
- @property
59
- def server_system_title(self) -> cdt.OctetString:
60
- return self .get_attr(5)
61
-
62
- @property
63
- def security_activate(self) -> SecurityPolicy:
64
- return self .get_meth(1)
65
-
66
- @property
67
- def global_key_transfer(self) -> GlobalKeyTransfer:
68
- return self .get_meth(2)
1
+ from typing import Optional
2
+ from ...types import cdt
3
+ from ..cosem_interface_class import ICAElement, ICMElement, Classifier, ICAuto
4
+ from ..Overview import class_id
5
+
6
+
7
+ class SecurityPolicy(cdt.Enum, elements=tuple(range(16))):
8
+ """ Enforces authentication and/or encrypting algorithm provided with security_suite """
9
+
10
+
11
+ class SecuritySuite(cdt.Enum, elements=tuple(range(16))):
12
+ """Specifies authentication, encryption and key transport algorithm"""
13
+ AES_GCM_128_AUT_ENCR_AND_AES_128_KEY_WRAP = 0
14
+
15
+
16
+ class KeyID(cdt.Enum, elements=(0, 1, 2)):
17
+ """Use only in KeyData structure"""
18
+
19
+
20
+ class KeyData(cdt.Structure):
21
+ """ TODO: """
22
+ key_id: KeyID
23
+ key_wrapped: cdt.OctetString
24
+
25
+
26
+ class GlobalKeyTransfer(cdt.Array):
27
+ """ Array of key_data """
28
+ TYPE = KeyData
29
+
30
+
31
+ class SecuritySetup(ICAuto):
32
+ """4.4.7 Security setup"""
33
+ CLASS_ID = class_id.SECURITY_SETUP
34
+ VERSION = 0
35
+ A_ELEMENTS = (ICAElement(2, "security_policy", SecurityPolicy, 0, 3, 0),
36
+ ICAElement(3, "security_suite", SecuritySuite, 0, 0, 0),
37
+ ICAElement(4, "client_system_title", cdt.OctetString, classifier=Classifier.DYNAMIC),
38
+ ICAElement(5, "server_system_title", cdt.OctetString))
39
+
40
+ M_ELEMENTS = (ICMElement(1, "security_activate", SecurityPolicy),
41
+ ICMElement(2, "global_key_transfer", GlobalKeyTransfer))
42
+ security_policy: Optional[SecurityPolicy]
43
+ security_suite: Optional[SecuritySuite]
44
+ client_system_title: Optional[cdt.OctetString]
45
+ server_system_title: Optional[cdt.OctetString]
@@ -1,158 +1,122 @@
1
- from . import ver0
2
- from ..__class_init__ import *
3
- from ..overview import VERSION_1
4
- from ...types import choices
5
-
6
-
7
- class SecurityPolicyVer1(cdt.IntegerFlag, cdt.Enum):
8
- """ security_policy"""
9
-
10
-
11
- class CertificateEntity(cdt.Enum, elements=(0, 1, 2, 3)):
12
- """TODO:"""
13
-
14
-
15
- class CertificateType(cdt.Enum, elements=(0, 1, 2, 3)):
16
- """TODO:"""
17
-
18
-
19
- class SecuritySuite(ver0.SecuritySuite, elements=(0, 1, 2)):
20
- """Version 0 extension"""
21
- AES_GCM_128_AUT_ENCR_ECDSA_P_256_DIG_SIGN_ECDH_P_256_KEY_AGR_SHA_256_HASH_V44_COMPR_AND_AES_128_KEY_WRAP = 1
22
- AES_GCM_256_AUT_ENCR_ECDSA_P_384_DIG_SIGN_ECDH_P_384_KEY_AGR_SHA_384_HASH_V44_COMPR_AND_AES_256_KEY_WRAP = 2
23
-
24
-
25
- class CertificateInfo(cdt.Structure):
26
- """ TODO: """
27
- certificate_entity: CertificateEntity
28
- certificate_type: CertificateType
29
- serial_number: cdt.OctetString
30
- issuer: cdt.OctetString
31
- subject: cdt.OctetString
32
- subject_alt_name: cdt.OctetString
33
-
34
-
35
- class Certificates(cdt.Array):
36
- """Carries information on the X.509 v3 Certificates available and stored in the server"""
37
- TYPE = CertificateInfo
38
-
39
-
40
- class KeyID(cdt.Enum, elements=(0, 1, 2, 3)):
41
- """Version 0 extension"""
42
-
43
-
44
- class KeyTransferData(cdt.Structure):
45
- """ TODO: """
46
- key_id: KeyID
47
- key_wrapped: cdt.OctetString
48
-
49
-
50
- class KeyTransfer(cdt.Array):
51
- """ Array of key_transfer_data """
52
- TYPE = KeyTransferData
53
-
54
-
55
- class KeyAgreementData(cdt.Structure):
56
- """ TODO: """
57
- key_id: KeyID
58
- key_data: cdt.OctetString
59
-
60
-
61
- class KeyAgreement(cdt.Array):
62
- """ Array of key_agreement_data """
63
- TYPE = KeyAgreementData
64
-
65
-
66
- class KeyPair(cdt.Enum, elements=(0, 1, 2)):
67
- """TODO:"""
68
-
69
-
70
- class CertificateIdentificationByEntity(cdt.Structure):
71
- """ TODO: """
72
- certificate_entity: CertificateEntity
73
- certificate_type: CertificateType
74
- system_title: cdt.OctetString
75
-
76
-
77
- class CertificateIdentificationBySerial(cdt.Structure):
78
- """ TODO: """
79
- serial_number: cdt.OctetString
80
- issuer: cdt.OctetString
81
-
82
-
83
- class CertificateIdentificationType(cdt.Enum, elements=(0, 1)):
84
- """TODO:"""
85
-
86
-
87
- class CertificationIdentificationOption(ut.CHOICE):
88
- TYPE = cdt.Structure
89
- ELEMENTS = {0: ut.SequenceElement('by entity', CertificateIdentificationByEntity),
90
- 1: ut.SequenceElement('by serial', CertificateIdentificationBySerial)}
91
-
92
-
93
- certification_identification_option = CertificationIdentificationOption()
94
-
95
-
96
- class CertificateIdentification(choices.StructureMixin, cdt.Structure):
97
- """Override several methods of cdt.Structure. It limited Structure."""
98
- certificate_identification_type: CertificateIdentificationType
99
- certification_identification_options: certification_identification_option
100
-
101
-
102
- class SecuritySetup(ver0.SecuritySetup):
103
- VERSION = VERSION_1
104
- A_ELEMENTS = (ic.ICAElement("security_policy", SecurityPolicyVer1),
105
- ic.ICAElement("security_suite", SecuritySuite),
106
- ver0.SecuritySetup.getAElement(3).unwrap(),
107
- ver0.SecuritySetup.getAElement(4).unwrap(),
108
- ver0.SecuritySetup.getAElement(5).unwrap(),
109
- ic.ICAElement("certificates", Certificates, classifier=ic.Classifier.DYNAMIC))
110
-
111
- M_ELEMENTS = (ic.ICMElement("security_activate", SecurityPolicyVer1),
112
- ic.ICMElement("key_transfer", KeyTransfer),
113
- ic.ICMElement("key_agreement", KeyAgreement),
114
- ic.ICMElement("generate_key_pair", KeyPair),
115
- ic.ICMElement("generate_certificate_request", KeyPair),
116
- ic.ICMElement("import_certificate", cdt.OctetString),
117
- ic.ICMElement("export_certificate", CertificateIdentification),
118
- ic.ICMElement("remove_certificate", CertificateIdentification))
119
-
120
- def characteristics_init(self):
121
- self.set_attr(2, None)
122
- self.set_attr(3, None)
123
- self.set_attr(6, None)
124
-
125
- @property
126
- def security_policy(self) -> SecurityPolicyVer1:
127
- return self.get_attr(2)
128
-
129
- @property
130
- def security_suite(self) -> SecuritySuite:
131
- return self.get_attr(3)
132
-
133
- @property
134
- def certificates(self) -> Certificates:
135
- return self.get_attr(6)
136
-
137
- @property
138
- def security_activate(self) -> SecurityPolicyVer1:
139
- return self.get_meth(1)
140
-
141
- @property
142
- def key_transfer(self) -> KeyTransferData:
143
- return self .get_meth(2)
144
-
145
- def key_agreement(self) -> KeyAgreement:
146
- return self .get_meth(3)
147
-
148
- def generate_certificate_request(self) -> KeyPair:
149
- return self .get_meth(4)
150
-
151
- def import_certificate(self) -> cdt.OctetString:
152
- return self .get_meth(5)
153
-
154
- def export_certificate(self) -> CertificateIdentification:
155
- return self .get_meth(6)
156
-
157
- def remove_certificate(self) -> CertificateIdentification:
158
- return self .get_meth(7)
1
+ from . import ver0
2
+ from ...types import choices
3
+ from typing import Optional
4
+ from ...types import cdt, ut
5
+ from ..cosem_interface_class import ICAElement, ICMElement, Classifier
6
+
7
+
8
+ class SecurityPolicy(cdt.Enum, cdt.IntegerFlag):
9
+ """ security_policy"""
10
+
11
+
12
+ class CertificateEntity(cdt.Enum, elements=(0, 1, 2, 3)):
13
+ """TODO:"""
14
+
15
+
16
+ class CertificateType(cdt.Enum, elements=(0, 1, 2, 3)):
17
+ """TODO:"""
18
+
19
+
20
+ class SecuritySuite(ver0.SecuritySuite, elements=(0, 1, 2)):
21
+ """Version 0 extension"""
22
+ AES_GCM_128_AUT_ENCR_ECDSA_P_256_DIG_SIGN_ECDH_P_256_KEY_AGR_SHA_256_HASH_V44_COMPR_AND_AES_128_KEY_WRAP = 1
23
+ AES_GCM_256_AUT_ENCR_ECDSA_P_384_DIG_SIGN_ECDH_P_384_KEY_AGR_SHA_384_HASH_V44_COMPR_AND_AES_256_KEY_WRAP = 2
24
+
25
+
26
+ class CertificateInfo(cdt.Structure):
27
+ """ TODO: """
28
+ certificate_entity: CertificateEntity
29
+ certificate_type: CertificateType
30
+ serial_number: cdt.OctetString
31
+ issuer: cdt.OctetString
32
+ subject: cdt.OctetString
33
+ subject_alt_name: cdt.OctetString
34
+
35
+
36
+ class Certificates(cdt.Array):
37
+ """Carries information on the X.509 v3 Certificates available and stored in the server"""
38
+ TYPE = CertificateInfo
39
+
40
+
41
+ class KeyID(cdt.Enum, elements=(0, 1, 2, 3)):
42
+ """Version 0 extension"""
43
+
44
+
45
+ class KeyTransferData(cdt.Structure):
46
+ """ TODO: """
47
+ key_id: KeyID
48
+ key_wrapped: cdt.OctetString
49
+
50
+
51
+ class KeyTransfer(cdt.Array):
52
+ """ Array of key_transfer_data """
53
+ TYPE = KeyTransferData
54
+
55
+
56
+ class KeyAgreementData(cdt.Structure):
57
+ """ TODO: """
58
+ key_id: KeyID
59
+ key_data: cdt.OctetString
60
+
61
+
62
+ class KeyAgreement(cdt.Array):
63
+ """ Array of key_agreement_data """
64
+ TYPE = KeyAgreementData
65
+
66
+
67
+ class KeyPair(cdt.Enum, elements=(0, 1, 2)):
68
+ """TODO:"""
69
+
70
+
71
+ class CertificateIdentificationByEntity(cdt.Structure):
72
+ """ TODO: """
73
+ certificate_entity: CertificateEntity
74
+ certificate_type: CertificateType
75
+ system_title: cdt.OctetString
76
+
77
+
78
+ class CertificateIdentificationBySerial(cdt.Structure):
79
+ """ TODO: """
80
+ serial_number: cdt.OctetString
81
+ issuer: cdt.OctetString
82
+
83
+
84
+ class CertificateIdentificationType(cdt.Enum, elements=(0, 1)):
85
+ """TODO:"""
86
+
87
+
88
+ class CertificationIdentificationOption(ut.CHOICE):
89
+ TYPE = cdt.Structure
90
+ ELEMENTS = {0: ut.SequenceElement('by entity', CertificateIdentificationByEntity),
91
+ 1: ut.SequenceElement('by serial', CertificateIdentificationBySerial)}
92
+
93
+
94
+ certification_identification_option = CertificationIdentificationOption()
95
+
96
+
97
+ class CertificateIdentification(choices.StructureMixin, cdt.Structure):
98
+ """Override several methods of cdt.Structure. It limited Structure."""
99
+ certificate_identification_type: CertificateIdentificationType
100
+ certification_identification_options: certification_identification_option
101
+
102
+
103
+ class SecuritySetup(ver0.SecuritySetup):
104
+ VERSION = 1
105
+ A_ELEMENTS = (ICAElement(1, "security_policy", SecurityPolicy),
106
+ ICAElement(2, "security_suite", SecuritySuite),
107
+ ver0.SecuritySetup.getAElement(3).unwrap(),
108
+ ver0.SecuritySetup.getAElement(4).unwrap(),
109
+ ver0.SecuritySetup.getAElement(5).unwrap(),
110
+ ICAElement(6, "certificates", Certificates, classifier=Classifier.DYNAMIC))
111
+
112
+ M_ELEMENTS = (ICMElement(1, "security_activate", SecurityPolicy),
113
+ ICMElement(2, "key_transfer", KeyTransfer),
114
+ ICMElement(3, "key_agreement", KeyAgreement),
115
+ ICMElement(4, "generate_key_pair", KeyPair),
116
+ ICMElement(5, "generate_certificate_request", KeyPair),
117
+ ICMElement(6, "import_certificate", cdt.OctetString),
118
+ ICMElement(7, "export_certificate", CertificateIdentification),
119
+ ICMElement(8, "remove_certificate", CertificateIdentification))
120
+ security_policy: Optional[SecurityPolicy]
121
+ security_suite: Optional[SecuritySuite]
122
+ certificates: Optional[Certificates]
@@ -1,50 +1,34 @@
1
- from .__class_init__ import *
2
- from ..types.implementations import structs
3
- from .overview import VERSION_0
4
-
5
-
6
- class TYPE(cdt.Enum, elements=(1, 2, 3, 4, 5)):
7
- """"""
8
-
9
-
10
- class ExecutionTimeDate(cdt.Structure):
11
- """ Specifies the time and teh date when the script is executed. The two octet-string s contain time and date, in this order; time and date are
12
- formatted as specified in DLMS UA 1000-1 Ed.12.0 4.1.6.1. Hundredths of second shall be zero. """
13
- time: cst.OctetStringTime
14
- date: cst.OctetStringDate
15
-
16
-
17
- class ExecutionTime(cdt.Array):
18
- """ Specifies the list of execution time and date """
19
- TYPE = ExecutionTimeDate
20
-
21
-
22
- class SingleActionSchedule(ic.COSEMInterfaceClasses):
23
- """ This IC allows modelling the execution of periodic actions within a meter. Such actions are not necessarily linked to tariffication
24
- (see “Activity calendar” or “Schedule”). """
25
- CLASS_ID = ClassID.SINGLE_ACTION_SCHEDULE
26
- VERSION = VERSION_0
27
- A_ELEMENTS = (ic.ICAElement("executed_script", structs.ActionItem),
28
- ic.ICAElement("type", TYPE),
29
- ic.ICAElement("execution_time", ExecutionTime))
30
-
31
- def characteristics_init(self):
32
- """nothing do it"""
33
-
34
- @property
35
- def executed_script(self) -> structs.ActionItem:
36
- return self.get_attr(2)
37
-
38
- @property
39
- def type_(self) -> TYPE:
40
- return self.get_attr(3)
41
-
42
- @property
43
- def execution_time(self) -> ExecutionTime:
44
- return self.get_attr(4)
45
-
46
-
47
- if __name__ == '__main__':
48
- a = ExecutionTimeDate(b'\x02\x02\t\x04\x12\x007\x00\t\x05\x07\xe5\x05\x1f\x01')
49
- a = SingleActionSchedule('0.0.15.0.0.255')
50
- print(a)
1
+ from ..types.implementations import structs
2
+ from ..types import cdt, cst
3
+ from ..types.type_alias import Attr
4
+ from .cosem_interface_class import ICAuto, ICAElement
5
+ from .Overview import class_id
6
+
7
+
8
+ class TYPE(cdt.Enum, elements=(1, 2, 3, 4, 5)):
9
+ """"""
10
+
11
+
12
+ class ExecutionTimeDate(cdt.Structure):
13
+ """ Specifies the time and teh date when the script is executed. The two octet-string s contain time and date, in this order; time and date are
14
+ formatted as specified in DLMS UA 1000-1 Ed.12.0 4.1.6.1. Hundredths of second shall be zero. """
15
+ time: cst.OctetStringTime
16
+ date: cst.OctetStringDate
17
+
18
+
19
+ class ExecutionTime(cdt.Array):
20
+ """ Specifies the list of execution time and date """
21
+ TYPE = ExecutionTimeDate
22
+
23
+
24
+ class SingleActionSchedule(ICAuto):
25
+ """ This IC allows modelling the execution of periodic actions within a meter. Such actions are not necessarily linked to tariffication
26
+ (see “Activity calendar” or “Schedule”). """
27
+ CLASS_ID = class_id.SINGLE_ACTION_SCHEDULE
28
+ VERSION = 0
29
+ A_ELEMENTS = (ICAElement(2, "executed_script", structs.ActionItem),
30
+ ICAElement(3, "type", TYPE),
31
+ ICAElement(4, "execution_time", ExecutionTime))
32
+ executed_script: Attr
33
+ type_: Attr
34
+ execution_time: Attr
@@ -1,84 +1,54 @@
1
- import datetime
2
- from .__class_init__ import *
3
- from .overview import VERSION_0
4
-
5
-
6
- class SpecDayEntry(cdt.Structure):
7
- """ Specifies a special day identifier for a given date. The date may have wildcards for repeating special days like Christmas. """
8
- index: cdt.LongUnsigned
9
- specialday_date: cst.OctetStringDate
10
- day_id: cdt.Unsigned
11
-
12
-
13
- class Entries(cdt.Array):
14
- """ Specifies the list of spec_day_entry """
15
- TYPE = SpecDayEntry
16
- values: list[SpecDayEntry]
17
- __getitem__: SpecDayEntry
18
-
19
- def new_element(self) -> SpecDayEntry:
20
- indexes: list[int] = [int(el.index) for el in self.values]
21
- for i in range(0x1_00_00):
22
- if i not in indexes:
23
- return SpecDayEntry((i, None, None)) # TODO: insert first DayID from ActiveCalendar as 3 element
24
- raise ValueError(F'in {self} all indexes is busy')
25
-
26
- def __check_index(self, value):
27
- """validate day_id from DayProfile"""
28
- if cdt.LongUnsigned(value) in (entry.index for entry in self.values):
29
- raise ValueError(F'{cdt.LongUnsigned(value)} already exist in {self}')
30
- else:
31
- """validate OK"""
32
-
33
- def validate_exist_index(self, value):
34
- """pass if value in indexes"""
35
- if cdt.LongUnsigned(value) not in (entry.index for entry in self.values):
36
- raise ValueError(F'{cdt.LongUnsigned(value)} not exist in {self}')
37
- else:
38
- """validate OK"""
39
-
40
- def get_indexes(self) -> list[int]:
41
- """ getter for callback Index """
42
- return [int(entries_element.index) for entries_element in self.values]
43
-
44
-
45
- class SpecialDaysTable(ic.COSEMInterfaceClasses):
46
- """ The interface class allows defining dates, which will override normal switching behaviour for special days. The interface class works in
47
- conjunction with the class "Schedule" or "Activity calendar" and the linking data item is day_id """
48
- CLASS_ID = ClassID.SPECIAL_DAYS_TABLE
49
- VERSION = VERSION_0
50
- A_ELEMENTS = ic.ICAElement("entries", Entries),
51
- M_ELEMENTS = (ic.ICMElement("insert", SpecDayEntry),
52
- ic.ICMElement("delete", cdt.LongUnsigned)) # Todo: was Delete.with_cb(None, self.entries.get_indexes)
53
-
54
- def characteristics_init(self):
55
- self._cbs_attr_post_init.update({2: self.__set_delete})
56
- self.set_attr(2, None)
57
-
58
- @property
59
- def entries(self) -> Entries:
60
- return self.get_attr(2)
61
-
62
- @property
63
- def insert(self) -> SpecDayEntry:
64
- return self.get_meth(1)
65
-
66
- @property
67
- def delete(self) -> cdt.LongUnsigned:
68
- return self.get_meth(2)
69
-
70
- def __set_delete(self):
71
- try:
72
- self.delete.register_cb_preset(self.entries.validate_exist_index)
73
- self.insert.index.register_cb_preset(self.entries.validate_exist_index)
74
- except KeyError: # At init time
75
- print('set delete NO:')
76
-
77
- def __delete_entry(self):
78
- """remove one entry by according delete method index. Call after execute"""
79
- for entry in self.entries.values:
80
- if entry.index == self.delete:
81
- self.entries.values.remove(entry)
82
- return
83
- else:
84
- raise ValueError(F'not found entry with index {self.delete} for remove')
1
+ from ..types import cdt, cst
2
+ from ..types.type_alias import Attr
3
+ from .cosem_interface_class import ICAuto, ICAElement, ICMElement
4
+ from .Overview import class_id
5
+
6
+
7
+ class SpecDayEntry(cdt.Structure):
8
+ """ Specifies a special day identifier for a given date. The date may have wildcards for repeating special days like Christmas. """
9
+ index: cdt.LongUnsigned
10
+ specialday_date: cst.OctetStringDate
11
+ day_id: cdt.Unsigned
12
+
13
+
14
+ class Entries(cdt.Array):
15
+ """ Specifies the list of spec_day_entry """
16
+ TYPE = SpecDayEntry
17
+ values: list[SpecDayEntry]
18
+ __getitem__: SpecDayEntry
19
+
20
+ def new_element(self) -> SpecDayEntry:
21
+ indexes: list[int] = [int(el.index) for el in self.values]
22
+ for i in range(0x1_00_00):
23
+ if i not in indexes:
24
+ return SpecDayEntry((i, None, None)) # TODO: insert first DayID from ActiveCalendar as 3 element
25
+ raise ValueError(F'in {self} all indexes is busy')
26
+
27
+ def __check_index(self, value):
28
+ """validate day_id from DayProfile"""
29
+ if cdt.LongUnsigned(value) in (entry.index for entry in self.values):
30
+ raise ValueError(F'{cdt.LongUnsigned(value)} already exist in {self}')
31
+ else:
32
+ """validate OK"""
33
+
34
+ def validate_exist_index(self, value):
35
+ """pass if value in indexes"""
36
+ if cdt.LongUnsigned(value) not in (entry.index for entry in self.values):
37
+ raise ValueError(F'{cdt.LongUnsigned(value)} not exist in {self}')
38
+ else:
39
+ """validate OK"""
40
+
41
+ def get_indexes(self) -> list[int]:
42
+ """ getter for callback Index """
43
+ return [int(entries_element.index) for entries_element in self.values]
44
+
45
+
46
+ class SpecialDaysTable(ICAuto):
47
+ """ The interface class allows defining dates, which will override normal switching behaviour for special days. The interface class works in
48
+ conjunction with the class "Schedule" or "Activity calendar" and the linking data item is day_id """
49
+ CLASS_ID = class_id.SPECIAL_DAYS_TABLE
50
+ VERSION = 0
51
+ A_ELEMENTS = ICAElement(2, "entries", Entries),
52
+ M_ELEMENTS = (ICMElement(1, "insert", SpecDayEntry),
53
+ ICMElement(2, "delete", cdt.LongUnsigned)) # Todo: was Delete.with_cb(None, self.entries.get_indexes)
54
+ entries: Attr