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,105 +1,78 @@
1
- from .__class_init__ import *
2
- from ..types.implementations import structs, integers
3
- from .overview import VERSION_0
4
-
5
-
6
- class Actions(cdt.Array):
7
- """ Array of key_data """
8
- TYPE = structs.ActionItem
9
-
10
-
11
- class ActorPermissions(cdt.BitString):
12
- """TODO: """
13
-
14
-
15
- class PermissionsTable(cdt.Array):
16
- TYPE = ActorPermissions
17
- __iter__: ActorPermissions
18
- __get_item__: ActorPermissions
19
-
20
-
21
- class ActorActionWeight(cdt.LongUnsigned):
22
- """TODO: make any thing"""
23
-
24
-
25
- class ActorWeightingList(cdt.Array):
26
- TYPE = ActorActionWeight
27
-
28
-
29
- class WeightingsTable(cdt.Array):
30
- TYPE = ActorWeightingList
31
-
32
-
33
- class MostRecentRequest(cdt.BitString):
34
- """TODO: """
35
-
36
-
37
- class MostRecentRequestTable(cdt.Array):
38
- TYPE = MostRecentRequest
39
-
40
-
41
- class RequestAction(cdt.Structure):
42
- """Defines the actions that are requested by an actorDefines the actions that are requested by an actor"""
43
- request_actor: cdt.Unsigned
44
- request_action_list: cdt.BitString
45
-
46
-
47
- class Arbitrator(ic.COSEMInterfaceClasses):
48
- """DLMS UA 1000-1 Ed. 14 4.5.12 Arbitrator"""
49
- CLASS_ID = ClassID.ARBITRATOR
50
- VERSION = VERSION_0
51
- A_ELEMENTS = (ic.ICAElement("actions", Actions),
52
- ic.ICAElement("permission_table", PermissionsTable),
53
- ic.ICAElement("weightings_table", WeightingsTable),
54
- ic.ICAElement("most_recent_requests_table", MostRecentRequestTable, classifier=ic.Classifier.DYNAMIC),
55
- ic.ICAElement("last_outcome", cdt.Unsigned, min=0, default=0, classifier=ic.Classifier.DYNAMIC)) # TODO: max = n what it?
56
- M_ELEMENTS = (ic.ICMElement("request_action", RequestAction),
57
- ic.ICMElement("reset", integers.Only0))
58
- actors: tuple[str] = tuple()
59
- """name actors container"""
60
-
61
- def characteristics_init(self):
62
- self.set_attr(2, None)
63
- self.actions.register_cb_post_set(self.__check_permission_table)
64
- self.set_attr(3, None)
65
- self.set_attr(4, None)
66
- self.set_attr(5, None)
67
-
68
- @property
69
- def actions(self) -> Actions:
70
- return self.get_attr(2)
71
-
72
- @property
73
- def permissions_table(self) -> PermissionsTable:
74
- return self.get_attr(3)
75
-
76
- @property
77
- def weightings_table(self) -> WeightingsTable:
78
- return self.get_attr(4)
79
-
80
- @property
81
- def most_recent_request_table(self) -> MostRecentRequestTable:
82
- return self.get_attr(5)
83
-
84
- @property
85
- def last_outcome(self) -> cdt.Unsigned:
86
- return self.get_attr(6)
87
-
88
- @property
89
- def request_action(self) -> RequestAction:
90
- return self .get_meth(1)
91
-
92
- @property
93
- def reset(self) -> integers.Only0:
94
- return self .get_meth(2)
95
-
96
- def __check_permission_table(self):
97
- """set length actor_permission be same as action array size if it not valid"""
98
- if len(self.permissions_table) > 0:
99
- for actor in self.permissions_table:
100
- if len(actor) != len(self.actions):
101
- actor.set(ActorPermissions('0'*len(self.actions)))
102
- else:
103
- """lenght is correct, change is not required """
104
- else:
105
- """not was loaded"""
1
+ from ..types.implementations import structs
2
+ from ..types.implementations import integers
3
+ from typing import Optional
4
+ from ..types import cdt
5
+ from .cosem_interface_class import ICAElement, ICMElement, Classifier, ICAuto
6
+ from .Overview import class_id
7
+
8
+
9
+ class Actions(cdt.Array):
10
+ """ Array of key_data """
11
+ TYPE = structs.ActionItem
12
+
13
+
14
+ class ActorPermissions(cdt.BitString):
15
+ """TODO: """
16
+
17
+
18
+ class PermissionsTable(cdt.Array):
19
+ TYPE = ActorPermissions
20
+ __iter__: ActorPermissions
21
+ __get_item__: ActorPermissions
22
+
23
+
24
+ class ActorActionWeight(cdt.LongUnsigned):
25
+ """TODO: make any thing"""
26
+
27
+
28
+ class ActorWeightingList(cdt.Array):
29
+ TYPE = ActorActionWeight
30
+
31
+
32
+ class WeightingsTable(cdt.Array):
33
+ TYPE = ActorWeightingList
34
+
35
+
36
+ class MostRecentRequest(cdt.BitString):
37
+ """TODO: """
38
+
39
+
40
+ class MostRecentRequestTable(cdt.Array):
41
+ TYPE = MostRecentRequest
42
+
43
+
44
+ class RequestAction(cdt.Structure):
45
+ """Defines the actions that are requested by an actorDefines the actions that are requested by an actor"""
46
+ request_actor: cdt.Unsigned
47
+ request_action_list: cdt.BitString
48
+
49
+
50
+ class Arbitrator(ICAuto):
51
+ """4.5.12 Arbitrator"""
52
+ CLASS_ID = class_id.ARBITRATOR
53
+ VERSION = 0
54
+ A_ELEMENTS = (ICAElement(2, "actions", Actions),
55
+ ICAElement(3, "permission_table", PermissionsTable),
56
+ ICAElement(4, "weightings_table", WeightingsTable),
57
+ ICAElement(5, "most_recent_requests_table", MostRecentRequestTable, classifier=Classifier.DYNAMIC),
58
+ ICAElement(6, "last_outcome", cdt.Unsigned, min=0, default=0, classifier=Classifier.DYNAMIC)) # TODO: max = n what it?
59
+ M_ELEMENTS = (ICMElement(1, "request_action", RequestAction),
60
+ ICMElement(2, "reset", integers.INTEGER_0))
61
+ actors: tuple[str] = tuple()
62
+ """name actors container"""
63
+ actions: Optional[Actions]
64
+ permissions_table: Optional[PermissionsTable]
65
+ weightings_table: Optional[WeightingsTable]
66
+ most_recent_request_table: Optional[MostRecentRequestTable]
67
+ last_outcome: Optional[cdt.Unsigned]
68
+
69
+ def __check_permission_table(self):
70
+ """set length actor_permission be same as action array size if it not valid"""
71
+ if len(self.permissions_table) > 0:
72
+ for actor in self.permissions_table:
73
+ if len(actor) != len(self.actions):
74
+ actor.set(ActorPermissions('0'*len(self.actions)))
75
+ else:
76
+ """lenght is correct, change is not required """
77
+ else:
78
+ """not was loaded"""
@@ -1,34 +1,50 @@
1
- from abc import ABC, abstractmethod
2
- from ...types import cdt
3
-
4
-
5
- class AccessMode(cdt.Enum, ABC):
6
- """ TODO: """
7
- @abstractmethod
8
- def is_writable(self) -> bool:
9
- ...
10
-
11
- @abstractmethod
12
- def is_readable(self) -> bool:
13
- ...
14
-
15
-
16
- class AttributeAccessItem(cdt.Structure, ABC):
17
- """ Implemented attribute and it access . Use in Association LN """
18
- attribute_id: cdt.Integer
19
- access_mode: AccessMode
20
- access_selectors: cdt.NullData # override in version
21
-
22
- @abstractmethod
23
- def abstract_marker(self):
24
- """dummy abstract marker"""
25
-
26
-
27
- class AttributeAccessDescriptor(cdt.Array, ABC):
28
- """ Array of attribute_access_item """
29
- TYPE = AttributeAccessItem
30
- """override this"""
31
-
32
- @abstractmethod
33
- def set_read_access(self, attribute_id: cdt.Integer):
34
- """by attribute_id"""
1
+ from abc import ABC, abstractmethod
2
+ from typing import Protocol, runtime_checkable
3
+ from ...types import cdt, cst, ut
4
+ from ... import pdu_enums as pdu
5
+ from ...types.type_alias import Obis
6
+
7
+
8
+ class AccessMode(cdt.Enum, ABC):
9
+ """ TODO: """
10
+ @abstractmethod
11
+ def is_writable(self) -> bool:
12
+ ...
13
+
14
+ @abstractmethod
15
+ def is_readable(self) -> bool:
16
+ ...
17
+
18
+
19
+ class AttributeAccessItem(cdt.Structure, ABC):
20
+ """ Implemented attribute and it access . Use in Association LN """
21
+ attribute_id: cdt.Integer
22
+ access_mode: AccessMode
23
+ access_selectors: cdt.NullData # override in version
24
+
25
+ @abstractmethod
26
+ def abstract_marker(self):
27
+ """dummy abstract marker"""
28
+
29
+
30
+ class AttributeAccessDescriptor(cdt.Array, ABC):
31
+ """ Array of attribute_access_item """
32
+ TYPE = AttributeAccessItem
33
+ """override this"""
34
+
35
+ @abstractmethod
36
+ def set_read_access(self, attribute_id: cdt.Integer):
37
+ """by attribute_id"""
38
+
39
+
40
+ @runtime_checkable
41
+ class ObjectListType(cdt._Array, Protocol):
42
+ """ Array of object_list_element. The range for the client_SAP is 0…0x7F. The range for the server_SAP is 0x000…0x3FFF."""
43
+
44
+ def is_writable(self, obis: Obis, indexes: set[int]) -> bool:
45
+ """ index - DLMS object attribute index.
46
+ True: AccessRight is WriteOnly or ReadAndWrite """
47
+
48
+ def get_attr_access(self, obis: Obis, index: int) -> pdu.AttributeAccess: ...
49
+
50
+ def get_meth_access(self, obis: Obis, index: int) -> pdu.MethodAccess: ...
@@ -1,25 +1,25 @@
1
- from functools import lru_cache
2
- from ...types import common_data_types as cdt
3
- from . import mechanism_id
4
-
5
-
6
- class AuthenticationMechanismName(cdt.Structure):
7
- """ Contains the name of the authentication mechanism for the association (see IEC 62056-53). The authentication mechanism name is specified as an
8
- OBJECT IDENTIFIER in 7.3.7.2 of IEC 62056-53. The authentication_mechanism_name attribute includes the arc labels of the OBJECT IDENTIFIER. """
9
- DEFAULT = (2, 16, 756, 5, 8, 2, 0)
10
- joint_iso_ctt_element: cdt.Unsigned
11
- country_element: cdt.Unsigned
12
- country_name_element: cdt.LongUnsigned
13
- identified_organization_element: cdt.Unsigned
14
- DLMS_UA_element: cdt.Unsigned
15
- authentication_mechanism_name_element: cdt.Unsigned
16
- mechanism_id_element: mechanism_id.MechanismIdElement
17
-
18
- @classmethod
19
- @lru_cache(maxsize=32)
20
- def get_AARQ_mechanism_name(cls, cryptographic: int, algorithm_id: int) -> bytes:
21
- """according to DLMS UA 1000-2 Ed. 10 9.4.2.2.4 Cryptographic algorithm ID-s"""
22
- default = list(AuthenticationMechanismName.DEFAULT)
23
- default[5] = cryptographic
24
- default[6] = algorithm_id
25
- return AuthenticationMechanismName(tuple(default)).get_a_xdr()
1
+ from functools import lru_cache
2
+ from ...types import common_data_types as cdt
3
+ from . import mechanism_id
4
+
5
+
6
+ class AuthenticationMechanismName(cdt.Structure):
7
+ """ Contains the name of the authentication mechanism for the association (see IEC 62056-53). The authentication mechanism name is specified as an
8
+ OBJECT IDENTIFIER in 7.3.7.2 of IEC 62056-53. The authentication_mechanism_name attribute includes the arc labels of the OBJECT IDENTIFIER. """
9
+ DEFAULT = (2, 16, 756, 5, 8, 2, 0)
10
+ joint_iso_ctt_element: cdt.Unsigned
11
+ country_element: cdt.Unsigned
12
+ country_name_element: cdt.LongUnsigned
13
+ identified_organization_element: cdt.Unsigned
14
+ DLMS_UA_element: cdt.Unsigned
15
+ authentication_mechanism_name_element: cdt.Unsigned
16
+ mechanism_id_element: mechanism_id.MechanismIdElement
17
+
18
+ @classmethod
19
+ @lru_cache(maxsize=32)
20
+ def get_AARQ_mechanism_name(cls, cryptographic: int, algorithm_id: int) -> bytes:
21
+ """according to DLMS UA 1000-2 Ed. 10 9.4.2.2.4 Cryptographic algorithm ID-s"""
22
+ default = list(AuthenticationMechanismName.DEFAULT)
23
+ default[5] = cryptographic
24
+ default[6] = algorithm_id
25
+ return AuthenticationMechanismName(tuple(default)).get_a_xdr()
@@ -1,25 +1,25 @@
1
- from ...types import cdt
2
-
3
-
4
- class MechanismIdElement(cdt.Enum, elements=tuple(range(8))):
5
- TAG = b'\x11'
6
-
7
-
8
- class ConstantMixin:
9
- """override raise for set"""
10
- def set(self, *args, **kwargs):
11
- raise AttributeError(F"not support <set> for {self.__class__.__name__} constant")
12
-
13
-
14
- class MechanismIdElementConst(ConstantMixin, MechanismIdElement):
15
- """"""
16
-
17
-
18
- NONE = MechanismIdElementConst(0)
19
- LOW = MechanismIdElementConst(1)
20
- HIGH = MechanismIdElementConst(2)
21
- HIGH_MD5 = MechanismIdElementConst(3)
22
- HIGH_SHA1 = MechanismIdElementConst(4)
23
- HIGH_GMAC = MechanismIdElementConst(5)
24
- HIGH_SHA256 = MechanismIdElementConst(6)
25
- HIGH_ECDSA = MechanismIdElementConst(7)
1
+ from ...types import cdt
2
+
3
+
4
+ class MechanismIdElement(cdt.Enum, elements=tuple(range(8))):
5
+ TAG = b'\x11'
6
+
7
+
8
+ class ConstantMixin:
9
+ """override raise for set"""
10
+ def set(self, *args, **kwargs):
11
+ raise AttributeError(F"not support <set> for {self.__class__.__name__} constant")
12
+
13
+
14
+ class MechanismIdElementConst(ConstantMixin, MechanismIdElement):
15
+ """"""
16
+
17
+
18
+ NONE = MechanismIdElementConst(0)
19
+ LOW = MechanismIdElementConst(1)
20
+ HIGH = MechanismIdElementConst(2)
21
+ HIGH_MD5 = MechanismIdElementConst(3)
22
+ HIGH_SHA1 = MechanismIdElementConst(4)
23
+ HIGH_GMAC = MechanismIdElementConst(5)
24
+ HIGH_SHA256 = MechanismIdElementConst(6)
25
+ HIGH_ECDSA = MechanismIdElementConst(7)
@@ -1,5 +1,5 @@
1
- from ...types import cdt
2
-
3
-
4
- class ReplyToHLSAuthentication(cdt.OctetString):
5
- """""" # todo: make validate by contents
1
+ from ...types import cdt
2
+
3
+
4
+ class ReplyToHLSAuthentication(cdt.OctetString):
5
+ """""" # todo: make validate by contents