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.
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 -122
  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.16.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.16.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.16.dist-info/RECORD +0 -117
  103. {dlms_spodes-0.87.16.dist-info → dlms_spodes-0.88.1.dist-info}/top_level.txt +0 -0
@@ -1,65 +1,51 @@
1
- from ..__class_init__ import *
2
- from ...types.implementations.enums import CommSpeed
3
- from ..overview import VERSION_0
4
-
5
-
6
- class InitializationStringElement(cdt.Structure):
7
- """ Request - Response strings"""
8
- request: cdt.OctetString
9
- response: cdt.OctetString
10
-
11
-
12
- class InitializationString(cdt.Array):
13
- """ This data contains all the necessary initialization commands to be sent to the modem in order to configure it properly. This may include the configuration of special
14
- modem features.
15
- If the array contains more than one initialization string element, they are subsequently sent to the modem after receiving an answer matching the defined response.
16
- It is assumed that the modem is pre-configured so that it accepts the initialization_string . If no initialization is needed, the initialization string is empty."""
17
- TYPE=InitializationStringElement
18
-
19
-
20
- class ModemProfileElement(cdt.OctetString):
21
- """ TODO: can be OK, CONNECT, RING, NO CARRIER, ERROR, CONNECT 1 200, NO DIAL TONE, BUSY, NO ANSWER, CONNECT 600, CONNECT 2 400, CONNECT 4 800, CONNECT 9 600, CONNECT 14 400,
22
- CONNECT 28 800, CONNECT 36 600, CONNECT 56 000"""
23
-
24
- def __init__(self, value: bytes = b'OK'.hex()):
25
- super(ModemProfileElement, self).__init__(value)
26
- if bytes(self) not in self.get_validate_values(): # todo: make ReportMixin
27
- raise ValueError(F'Got modem profile element {bytes(self)}, expected {b", ".join(self.get_validate_values())}')
28
- else:
29
- pass
30
-
31
- @staticmethod
32
- def get_validate_values() -> tuple[bytes, ...]:
33
- return b'OK', b'CONNECT', b'RING', b'NO CARRIER', b'ERROR', b'CONNECT 1 200', b'NO DIAL TONE', b'BUSY', b'NO ANSWER', b'CONNECT 600', b'CONNECT 2 400', b'CONNECT 4 800', \
34
- b'CONNECT 9 600', b'CONNECT 14 400', b'CONNECT 28 800', b'CONNECT 36 600', b'CONNECT 56 000'
35
-
36
-
37
- class ModemProfile(cdt.Array):
38
- """ This data defines the mapping from Hayes standard commands/responses to modem specific strings. Shall contain the corresponding stings for the modem used in following
39
- order"""
40
- TYPE = ModemProfileElement
41
-
42
-
43
- class PSTNModemConfiguration(ic.COSEMInterfaceClasses):
44
- """ An instance of the 'PSTN modem configuration' IC stores data related to the initialization of modems, which are used for data transfer from/to a device. Several modems
45
- can be configured."""
46
- CLASS_ID = ClassID.MODEM_CONFIGURATION
47
- VERSION = VERSION_0
48
- A_ELEMENTS = (ic.ICAElement("comm_speed", CommSpeed, 0, 9, 5),
49
- ic.ICAElement("initialization_string", InitializationString),
50
- ic.ICAElement("modem_profile", ModemProfile))
51
-
52
- def characteristics_init(self):
53
- """nothing do it"""
54
-
55
- @property
56
- def comm_speed(self) -> CommSpeed:
57
- return self.get_attr(2)
58
-
59
- @property
60
- def initialization_string(self) -> InitializationString:
61
- return self.get_attr(3)
62
-
63
- @property
64
- def modem_profile(self) -> ModemProfile:
65
- return self.get_attr(4)
1
+ from ...types.implementations.enums import CommSpeed
2
+ from typing import Optional
3
+ from ...types import cdt
4
+ from ..cosem_interface_class import ICAElement, ICAuto
5
+ from ..Overview import class_id
6
+
7
+
8
+ class InitializationStringElement(cdt.Structure):
9
+ """ initialization_string_element"""
10
+ request: cdt.OctetString
11
+ response: cdt.OctetString
12
+
13
+
14
+ class InitializationString(cdt.Array):
15
+ """initialization_string attribute"""
16
+ TYPE = InitializationStringElement
17
+
18
+
19
+ class ModemProfileElement(cdt.OctetString):
20
+ """modem_profile_element"""
21
+
22
+ def __init__(self, value: bytes = b'OK'.hex()):
23
+ super(ModemProfileElement, self).__init__(value)
24
+ if bytes(self) not in self.get_validate_values(): # todo: make ReportMixin
25
+ raise ValueError(F'Got modem profile element {bytes(self)}, expected {b", ".join(self.get_validate_values())}')
26
+ else:
27
+ pass
28
+
29
+ @staticmethod
30
+ def get_validate_values() -> tuple[bytes, ...]:
31
+ return b'OK', b'CONNECT', b'RING', b'NO CARRIER', b'ERROR', b'CONNECT 1 200', b'NO DIAL TONE', b'BUSY', b'NO ANSWER', b'CONNECT 600', b'CONNECT 2 400', b'CONNECT 4 800', \
32
+ b'CONNECT 9 600', b'CONNECT 14 400', b'CONNECT 28 800', b'CONNECT 36 600', b'CONNECT 56 000'
33
+
34
+
35
+ class ModemProfile(cdt.Array):
36
+ """modem_profile attribute"""
37
+ TYPE = ModemProfileElement
38
+
39
+
40
+ class PSTNModemConfiguration(ICAuto):
41
+ """5.7.4 PSTN modem configuration"""
42
+ CLASS_ID = class_id.MODEM_CONFIGURATION
43
+ VERSION = 0
44
+ A_ELEMENTS = (
45
+ ICAElement(2, "comm_speed", CommSpeed, 0, 9, 5),
46
+ ICAElement(3, "initialization_string", InitializationString),
47
+ ICAElement(4, "modem_profile", ModemProfile)
48
+ )
49
+ comm_speed: Optional[CommSpeed]
50
+ initialization_string: Optional[InitializationString]
51
+ modem_profile: Optional[ModemProfile]
@@ -1,39 +1,27 @@
1
- from ..__class_init__ import *
2
- from . import ver0
3
- from ..overview import VERSION_1
4
-
5
-
6
- class InitializationStringElement(cdt.Structure):
7
- """ Request - Response strings"""
8
- request: cdt.OctetString
9
- response: cdt.OctetString
10
- delay_after_response: cdt.LongUnsigned
11
-
12
-
13
- class InitializationString(cdt.Array):
14
- """ Contains all the necessary initialization commands to be sent to the modem in order to configure it properly. This may include the configuration of special modem
15
- features. If the array contains more than one initialization_string_element, the requests are set in a sequence.The next request is sent after the expected response matching
16
- the previous request and waiting a delay-after-response time [ms], to allow the modem toe execute teh request.
17
- It is assumed that the modem is per-configured so that it accepts the initialization-string. If no initialization is needed, the initialization string is empty. """
18
- TYPE = InitializationStringElement
19
-
20
-
21
- class ModemConfigurationVer1(ic.COSEMInterfaceClasses):
22
- """ This IC allow modelling the configuration and initialisation of modems used for data transfer from/to a device. Several modems can be configured."""
23
- ClassID = ut.CosemClassId(27)
24
- VERSION = VERSION_1
25
- A_ELEMENTS = (ver0.PSTNModemConfiguration.get_attr_element(2),
26
- ic.ICAElement("initialization_string", InitializationString),
27
- ver0.PSTNModemConfiguration.get_attr_element(4))
28
-
29
- def characteristics_init(self):
30
- """nothing do it"""
31
-
32
- @property
33
- def initialization_string(self) -> InitializationString:
34
- return self.get_attr(3)
35
-
36
-
37
- if __name__ == '__main__':
38
- a = ModemConfigurationVer1('0.0.2.0.0.255')
39
- print(a)
1
+ from . import ver0
2
+ from typing import Optional
3
+ from ...types import cdt
4
+ from ..cosem_interface_class import ICAElement
5
+ from ..Overview import class_id
6
+
7
+
8
+ class InitializationStringElement(cdt.Structure):
9
+ """initialization_string_element"""
10
+ request: cdt.OctetString
11
+ response: cdt.OctetString
12
+ delay_after_response: cdt.LongUnsigned
13
+
14
+
15
+ class InitializationString(cdt.Array):
16
+ """initialization_string attribute"""
17
+ TYPE = InitializationStringElement
18
+
19
+
20
+ class ModemConfigurationVer1(ver0.PSTNModemConfiguration):
21
+ """4.7.4 Modem configuration"""
22
+ ClassID = class_id.MODEM_CONFIGURATION
23
+ VERSION = 1
24
+ A_ELEMENTS = (ver0.PSTNModemConfiguration.getAElement(2).unwrap(),
25
+ ICAElement(3, "initialization_string", InitializationString),
26
+ ver0.PSTNModemConfiguration.getAElement(4).unwrap())
27
+ initialization_string: Optional[InitializationString]
@@ -1,67 +1,48 @@
1
- from ..__class_init__ import *
2
- from ...types.implementations import integers
3
- from ..overview import VERSION_0
4
-
5
-
6
- class ServerAddress(cdt.OctetString):
7
- """"""
8
-
9
-
10
- class AuthenticationMethod(cdt.Enum, elements=(0, 1, 2)):
11
- """Defines the authentication mode used for NTP protocol"""
12
-
13
-
14
- class AuthenticationKey(cdt.Structure):
15
- """"""
16
- key_id: cdt.DoubleLongUnsigned
17
- key: cdt.OctetString
18
-
19
-
20
- class AuthenticationKeys(cdt.Array):
21
- """Contains the necessary symmetric keys if shared secrets mode of authentication is used"""
22
- TYPE = AuthenticationKey
23
-
24
-
25
- class NTPSetup(ic.COSEMInterfaceClasses):
26
- """DLMS UA 1000-1 Ed 14, 4.9.7 NTP setup"""
27
- CLASS_ID = ClassID.NTP_SETUP
28
- VERSION = VERSION_0
29
- A_ELEMENTS = (
30
- ic.ICAElement("activated", cdt.Boolean, default=False),
31
- ic.ICAElement("server_address", ServerAddress),
32
- ic.ICAElement("server_port", cdt.LongUnsigned, default=123),
33
- ic.ICAElement("authentication_method", AuthenticationMethod),
34
- ic.ICAElement("authentication_keys", AuthenticationKeys),
35
- ic.ICAElement("client_key", cdt.OctetString))
36
- M_ELEMENTS = (
37
- ic.ICMElement("synchronize", integers.Only0),
38
- ic.ICMElement("add_authentication_key", AuthenticationKey),
39
- ic.ICMElement("delete_authentication_key", cdt.DoubleLongUnsigned),
40
- )
41
-
42
- def characteristics_init(self):
43
- """nothing do it"""
44
-
45
- @property
46
- def activated(self) -> cdt.Boolean:
47
- return self.get_attr(2)
48
-
49
- @property
50
- def server_address(self) -> ServerAddress:
51
- return self.get_attr(3)
52
-
53
- @property
54
- def server_port(self) -> cdt.LongUnsigned:
55
- return self.get_attr(4)
56
-
57
- @property
58
- def authentication_method(self) -> AuthenticationMethod:
59
- return self.get_attr(5)
60
-
61
- @property
62
- def authentication_keys(self) -> AuthenticationKeys:
63
- return self.get_attr(6)
64
-
65
- @property
66
- def client_key(self) -> cdt.OctetString:
67
- return self.get_attr(7)
1
+ from ...types.implementations import integers
2
+ from typing import Optional
3
+ from ...types import cdt
4
+ from ..cosem_interface_class import ICAElement, ICAuto, ICMElement
5
+ from ..Overview import class_id
6
+
7
+
8
+ class ServerAddress(cdt.OctetString):
9
+ """server_address attribute"""
10
+
11
+
12
+ class AuthenticationMethod(cdt.Enum, elements=(0, 1, 2)):
13
+ """authentication_method attribute"""
14
+
15
+
16
+ class AuthenticationKey(cdt.Structure):
17
+ """authentication_key"""
18
+ key_id: cdt.DoubleLongUnsigned
19
+ key: cdt.OctetString
20
+
21
+
22
+ class AuthenticationKeys(cdt.Array):
23
+ """authentication_keys"""
24
+ TYPE = AuthenticationKey
25
+
26
+
27
+ class NTPSetup(ICAuto):
28
+ """4.9.7 NTP setup"""
29
+ CLASS_ID = class_id.NTP_SETUP
30
+ VERSION = 0
31
+ A_ELEMENTS = (
32
+ ICAElement(2, "activated", cdt.Boolean, default=False),
33
+ ICAElement(3, "server_address", ServerAddress),
34
+ ICAElement(4, "server_port", cdt.LongUnsigned, default=123),
35
+ ICAElement(5, "authentication_method", AuthenticationMethod),
36
+ ICAElement(6, "authentication_keys", AuthenticationKeys),
37
+ ICAElement(7, "client_key", cdt.OctetString))
38
+ M_ELEMENTS = (
39
+ ICMElement(1, "synchronize", integers.Only0),
40
+ ICMElement(2, "add_authentication_key", AuthenticationKey),
41
+ ICMElement(3, "delete_authentication_key", cdt.DoubleLongUnsigned),
42
+ )
43
+ activated: Optional[cdt.Boolean]
44
+ server_address: Optional[ServerAddress]
45
+ server_port: Optional[cdt.LongUnsigned]
46
+ authentication_method: Optional[AuthenticationMethod]
47
+ authentication_keys: Optional[AuthenticationKeys]
48
+ client_key: Optional[cdt.OctetString]
@@ -1,23 +1,28 @@
1
- class OBIS(bytes):
2
- """bytes[6]"""
3
-
4
- def validate(self):
5
- if (length := len(self)) != 6:
6
- return ValueError(f"got {length=}, expected 6")
7
-
8
- def __str__(self):
9
- return F"{".".join(map(str, self[:6]))}"
10
-
11
-
12
- class AssociationLN(OBIS):
13
- def __new__(cls, e: int):
14
- return super().__new__(cls, (0, 0, 40, 0, e, 255))
15
-
16
-
17
- CURRENT_ASSOCIATION = OBIS((0, 0, 40, 0, 0, 255))
18
- PUBLIC_ASSOCIATION = OBIS((0, 0, 40, 0, 1, 255))
19
- LDN = OBIS((0, 0, 42, 0, 0, 255))
20
-
21
-
22
- # SPODES_3
23
- SPODES3_DISPLAY_MODE = OBIS((0, 0, 96, 4, 1, 255))
1
+ from typing_extensions import deprecated
2
+
3
+
4
+ @deprecated("use <bytes>")
5
+ class OBIS(bytes):
6
+ """bytes[6]"""
7
+ __slots__ = ()
8
+
9
+ def validate(self):
10
+ if (length := len(self)) != 6:
11
+ return ValueError(f"got {length=}, expected 6")
12
+
13
+ def __str__(self):
14
+ return F"{".".join(map(str, self[:6]))}"
15
+
16
+
17
+ class AssociationLN(OBIS):
18
+ def __new__(cls, e: int):
19
+ return super().__new__(cls, (0, 0, 40, 0, e, 255))
20
+
21
+
22
+ CURRENT_ASSOCIATION = OBIS((0, 0, 40, 0, 0, 255))
23
+ PUBLIC_ASSOCIATION = OBIS((0, 0, 40, 0, 1, 255))
24
+ LDN = OBIS((0, 0, 42, 0, 0, 255))
25
+
26
+
27
+ # SPODES_3
28
+ SPODES3_DISPLAY_MODE = OBIS((0, 0, 96, 4, 1, 255))