DLMS-SPODES 0.87.12__py3-none-any.whl → 0.87.15__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 (100) 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/__class_init__.py +3 -3
  11. DLMS_SPODES/cosem_interface_classes/__init__.py +1 -1
  12. DLMS_SPODES/cosem_interface_classes/a_parameter.py +20 -20
  13. DLMS_SPODES/cosem_interface_classes/activity_calendar.py +254 -254
  14. DLMS_SPODES/cosem_interface_classes/arbitrator.py +105 -105
  15. DLMS_SPODES/cosem_interface_classes/association_ln/abstract.py +34 -34
  16. DLMS_SPODES/cosem_interface_classes/association_ln/authentication_mechanism_name.py +25 -25
  17. DLMS_SPODES/cosem_interface_classes/association_ln/mechanism_id.py +25 -25
  18. DLMS_SPODES/cosem_interface_classes/association_ln/method.py +5 -5
  19. DLMS_SPODES/cosem_interface_classes/association_ln/ver0.py +485 -485
  20. DLMS_SPODES/cosem_interface_classes/association_ln/ver1.py +133 -133
  21. DLMS_SPODES/cosem_interface_classes/association_ln/ver2.py +36 -36
  22. DLMS_SPODES/cosem_interface_classes/association_ln/ver3.py +4 -4
  23. DLMS_SPODES/cosem_interface_classes/association_sn/ver0.py +12 -12
  24. DLMS_SPODES/cosem_interface_classes/attr_indexes.py +12 -12
  25. DLMS_SPODES/cosem_interface_classes/clock.py +131 -131
  26. DLMS_SPODES/cosem_interface_classes/collection.py +2122 -2122
  27. DLMS_SPODES/cosem_interface_classes/cosem_interface_class.py +583 -583
  28. DLMS_SPODES/cosem_interface_classes/data.py +21 -21
  29. DLMS_SPODES/cosem_interface_classes/demand_register/ver0.py +59 -59
  30. DLMS_SPODES/cosem_interface_classes/disconnect_control.py +74 -74
  31. DLMS_SPODES/cosem_interface_classes/extended_register.py +27 -27
  32. DLMS_SPODES/cosem_interface_classes/gprs_modem_setup.py +43 -43
  33. DLMS_SPODES/cosem_interface_classes/gsm_diagnostic/ver0.py +103 -103
  34. DLMS_SPODES/cosem_interface_classes/gsm_diagnostic/ver1.py +40 -40
  35. DLMS_SPODES/cosem_interface_classes/gsm_diagnostic/ver2.py +9 -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 +53 -53
  38. DLMS_SPODES/cosem_interface_classes/iec_local_port_setup.py +11 -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 +126 -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 +487 -487
  44. DLMS_SPODES/cosem_interface_classes/implementations/profile_generic.py +83 -83
  45. DLMS_SPODES/cosem_interface_classes/ipv4_setup.py +72 -72
  46. DLMS_SPODES/cosem_interface_classes/limiter.py +111 -111
  47. DLMS_SPODES/cosem_interface_classes/ln_pattern.py +333 -333
  48. DLMS_SPODES/cosem_interface_classes/modem_configuration/ver0.py +65 -65
  49. DLMS_SPODES/cosem_interface_classes/modem_configuration/ver1.py +39 -39
  50. DLMS_SPODES/cosem_interface_classes/ntp_setup/ver0.py +67 -67
  51. DLMS_SPODES/cosem_interface_classes/obis.py +23 -23
  52. DLMS_SPODES/cosem_interface_classes/overview.py +197 -197
  53. DLMS_SPODES/cosem_interface_classes/parameter.py +547 -547
  54. DLMS_SPODES/cosem_interface_classes/parameters.py +172 -172
  55. DLMS_SPODES/cosem_interface_classes/profile_generic/ver0.py +122 -122
  56. DLMS_SPODES/cosem_interface_classes/profile_generic/ver1.py +277 -277
  57. DLMS_SPODES/cosem_interface_classes/push_setup/ver0.py +12 -12
  58. DLMS_SPODES/cosem_interface_classes/push_setup/ver1.py +10 -10
  59. DLMS_SPODES/cosem_interface_classes/push_setup/ver2.py +166 -166
  60. DLMS_SPODES/cosem_interface_classes/register.py +45 -45
  61. DLMS_SPODES/cosem_interface_classes/register_activation/ver0.py +80 -80
  62. DLMS_SPODES/cosem_interface_classes/register_monitor.py +46 -46
  63. DLMS_SPODES/cosem_interface_classes/reports.py +70 -70
  64. DLMS_SPODES/cosem_interface_classes/schedule.py +176 -176
  65. DLMS_SPODES/cosem_interface_classes/script_table.py +87 -87
  66. DLMS_SPODES/cosem_interface_classes/security_setup/ver0.py +68 -68
  67. DLMS_SPODES/cosem_interface_classes/security_setup/ver1.py +158 -158
  68. DLMS_SPODES/cosem_interface_classes/single_action_schedule.py +50 -50
  69. DLMS_SPODES/cosem_interface_classes/special_days_table.py +84 -84
  70. DLMS_SPODES/cosem_interface_classes/tcp_udp_setup.py +42 -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 +465 -463
  83. DLMS_SPODES/settings.py +551 -551
  84. DLMS_SPODES/types/choices.py +142 -142
  85. DLMS_SPODES/types/common_data_types.py +2401 -2399
  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 +11 -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/useful_types.py +677 -677
  96. {dlms_spodes-0.87.12.dist-info → dlms_spodes-0.87.15.dist-info}/METADATA +30 -30
  97. dlms_spodes-0.87.15.dist-info/RECORD +117 -0
  98. {dlms_spodes-0.87.12.dist-info → dlms_spodes-0.87.15.dist-info}/WHEEL +1 -1
  99. dlms_spodes-0.87.12.dist-info/RECORD +0 -117
  100. {dlms_spodes-0.87.12.dist-info → dlms_spodes-0.87.15.dist-info}/top_level.txt +0 -0
@@ -1,40 +1,40 @@
1
- from ..__class_init__ import *
2
- from . import ver0
3
-
4
-
5
- class PSStatus(cdt.Enum, elements=tuple(range(7))):
6
- """ Indicates the packet switched status of the modem. """
7
-
8
-
9
- class CellInfoType(cdt.Structure):
10
- """ Params of element """
11
- cell_ID: cdt.DoubleLongUnsigned
12
- location_ID: cdt.LongUnsigned
13
- signal_quality: ver0.SignalQuality
14
- ber: cdt.Unsigned
15
- mcc: cdt.LongUnsigned
16
- mnc: cdt.LongUnsigned
17
- channel_number: cdt.DoubleLongUnsigned
18
-
19
-
20
- class AdjacentCellInfo(cdt.Structure):
21
- cell_ID: cdt.DoubleLongUnsigned
22
- signal_quality: ver0.SignalQuality
23
-
24
-
25
- class AdjacentCells(cdt.Array):
26
- TYPE = AdjacentCellInfo
27
-
28
-
29
- class GSMDiagnostic(ver0.GSMDiagnostic):
30
- A_ELEMENTS = (ver0.GSMDiagnostic.get_attr_element(2),
31
- ver0.GSMDiagnostic.get_attr_element(3),
32
- ver0.GSMDiagnostic.get_attr_element(4),
33
- ic.ICAElement("ps_status", PSStatus, 0, 255, 0, classifier=ic.Classifier.DYNAMIC),
34
- ic.ICAElement("cell_info", CellInfoType, classifier=ic.Classifier.DYNAMIC),
35
- ic.ICAElement("adjacent_cell", AdjacentCells, classifier=ic.Classifier.DYNAMIC),
36
- ver0.GSMDiagnostic.get_attr_element(8))
37
-
38
- # def __new__(cls, *args, **kwargs):
39
- # raise ValueError(F"version: {__name__[-1]} of {cls.__class__.__name__} not support framework")
40
-
1
+ from ..__class_init__ import *
2
+ from . import ver0
3
+
4
+
5
+ class PSStatus(cdt.Enum, elements=tuple(range(7))):
6
+ """ Indicates the packet switched status of the modem. """
7
+
8
+
9
+ class CellInfoType(cdt.Structure):
10
+ """ Params of element """
11
+ cell_ID: cdt.DoubleLongUnsigned
12
+ location_ID: cdt.LongUnsigned
13
+ signal_quality: ver0.SignalQuality
14
+ ber: cdt.Unsigned
15
+ mcc: cdt.LongUnsigned
16
+ mnc: cdt.LongUnsigned
17
+ channel_number: cdt.DoubleLongUnsigned
18
+
19
+
20
+ class AdjacentCellInfo(cdt.Structure):
21
+ cell_ID: cdt.DoubleLongUnsigned
22
+ signal_quality: ver0.SignalQuality
23
+
24
+
25
+ class AdjacentCells(cdt.Array):
26
+ TYPE = AdjacentCellInfo
27
+
28
+
29
+ class GSMDiagnostic(ver0.GSMDiagnostic):
30
+ A_ELEMENTS = (ver0.GSMDiagnostic.get_attr_element(2),
31
+ ver0.GSMDiagnostic.get_attr_element(3),
32
+ ver0.GSMDiagnostic.get_attr_element(4),
33
+ ic.ICAElement("ps_status", PSStatus, 0, 255, 0, classifier=ic.Classifier.DYNAMIC),
34
+ ic.ICAElement("cell_info", CellInfoType, classifier=ic.Classifier.DYNAMIC),
35
+ ic.ICAElement("adjacent_cell", AdjacentCells, classifier=ic.Classifier.DYNAMIC),
36
+ ver0.GSMDiagnostic.get_attr_element(8))
37
+
38
+ # def __new__(cls, *args, **kwargs):
39
+ # raise ValueError(F"version: {__name__[-1]} of {cls.__class__.__name__} not support framework")
40
+
@@ -1,9 +1,9 @@
1
- from ..__class_init__ import *
2
-
3
-
4
- class GSMDiagnostic(ic.COSEMInterfaceClasses):
5
- def __new__(cls, *args, **kwargs):
6
- raise ValueError(F"version: {__name__[-1]} of {cls.__class__.__name__} not support framework")
7
-
8
- def characteristics_init(self):
9
- """ initiate all attributes and methods of class """
1
+ from ..__class_init__ import *
2
+
3
+
4
+ class GSMDiagnostic(ic.COSEMInterfaceClasses):
5
+ def __new__(cls, *args, **kwargs):
6
+ raise ValueError(F"version: {__name__[-1]} of {cls.__class__.__name__} not support framework")
7
+
8
+ def characteristics_init(self):
9
+ """ initiate all attributes and methods of class """
@@ -1,11 +1,11 @@
1
- from ..__class_init__ import *
2
-
3
-
4
- class IECHDLCSetup(ic.COSEMInterfaceClasses):
5
- CLASS_ID = ClassID.IEC_HDLC_SETUP
6
-
7
- def __new__(cls, *args, **kwargs):
8
- raise ValueError(F"version: {__name__[-1]} of {cls.__class__.__name__} not support framework")
9
-
10
- def characteristics_init(self):
11
- """ initiate all attributes and methods of class """
1
+ from ..__class_init__ import *
2
+
3
+
4
+ class IECHDLCSetup(ic.COSEMInterfaceClasses):
5
+ CLASS_ID = ClassID.IEC_HDLC_SETUP
6
+
7
+ def __new__(cls, *args, **kwargs):
8
+ raise ValueError(F"version: {__name__[-1]} of {cls.__class__.__name__} not support framework")
9
+
10
+ def characteristics_init(self):
11
+ """ initiate all attributes and methods of class """
@@ -1,53 +1,53 @@
1
- from collections import deque
2
- from ..__class_init__ import *
3
- from ...types.implementations.enums import CommSpeed
4
- from ..overview import VERSION_0
5
-
6
-
7
- class IECHDLCSetup(ic.COSEMInterfaceClasses):
8
- """ This IC allows modelling and configuring communication channels according to Clause 8 of DLMS UA 1000-2 Ed. 8.0:2014. Several communication cnannels can be configured. """
9
- CLASS_ID = ClassID.IEC_HDLC_SETUP
10
- VERSION = VERSION_0
11
- A_ELEMENTS = (ic.ICAElement("comm_speed", CommSpeed, 0, 9, 5),
12
- ic.ICAElement("windows_size_transmit", cdt.Unsigned, 1, 7, 1),
13
- ic.ICAElement("windows_size_receive", cdt.Unsigned, 1, 7, 1),
14
- ic.ICAElement("max_info_field_length_transmit", cdt.LongUnsigned, 128, 32, 2030),
15
- ic.ICAElement("max_info_field_length_receive", cdt.LongUnsigned, 128, 32, 2030),
16
- ic.ICAElement("inter_octet_time_out", cdt.LongUnsigned, 20, 6000, 25),
17
- ic.ICAElement("inactivity_time_out", cdt.LongUnsigned, 0, default=120),
18
- ic.ICAElement("device_address", cdt.LongUnsigned, 0x0001, 0x3ffd, default=0x10)) # TODO: not according by BlueBook: need default, minimum is other
19
-
20
- def characteristics_init(self):
21
- """nothing do it"""
22
-
23
- @property
24
- def comm_speed(self) -> CommSpeed:
25
- return self.get_attr(2)
26
-
27
- @property
28
- def windows_size_transmit(self) -> cdt.Unsigned:
29
- return self.get_attr(3)
30
-
31
- @property
32
- def windows_size_receive(self) -> cdt.Unsigned:
33
- return self.get_attr(4)
34
-
35
- @property
36
- def max_info_field_length_transmit(self) -> cdt.LongUnsigned:
37
- return self.get_attr(5)
38
-
39
- @property
40
- def max_info_field_length_receive(self) -> cdt.LongUnsigned:
41
- return self.get_attr(6)
42
-
43
- @property
44
- def inter_octet_time_out(self) -> cdt.LongUnsigned:
45
- return self.get_attr(7)
46
-
47
- @property
48
- def inactivity_time_out(self) -> cdt.LongUnsigned:
49
- return self.get_attr(8)
50
-
51
- @property
52
- def device_address(self) -> cdt.LongUnsigned:
53
- return self.get_attr(9)
1
+ from collections import deque
2
+ from ..__class_init__ import *
3
+ from ...types.implementations.enums import CommSpeed
4
+ from ..overview import VERSION_0
5
+
6
+
7
+ class IECHDLCSetup(ic.COSEMInterfaceClasses):
8
+ """ This IC allows modelling and configuring communication channels according to Clause 8 of DLMS UA 1000-2 Ed. 8.0:2014. Several communication cnannels can be configured. """
9
+ CLASS_ID = ClassID.IEC_HDLC_SETUP
10
+ VERSION = VERSION_0
11
+ A_ELEMENTS = (ic.ICAElement("comm_speed", CommSpeed, 0, 9, 5),
12
+ ic.ICAElement("windows_size_transmit", cdt.Unsigned, 1, 7, 1),
13
+ ic.ICAElement("windows_size_receive", cdt.Unsigned, 1, 7, 1),
14
+ ic.ICAElement("max_info_field_length_transmit", cdt.LongUnsigned, 128, 32, 2030),
15
+ ic.ICAElement("max_info_field_length_receive", cdt.LongUnsigned, 128, 32, 2030),
16
+ ic.ICAElement("inter_octet_time_out", cdt.LongUnsigned, 20, 6000, 25),
17
+ ic.ICAElement("inactivity_time_out", cdt.LongUnsigned, 0, default=120),
18
+ ic.ICAElement("device_address", cdt.LongUnsigned, 0x0001, 0x3ffd, default=0x10)) # TODO: not according by BlueBook: need default, minimum is other
19
+
20
+ def characteristics_init(self):
21
+ """nothing do it"""
22
+
23
+ @property
24
+ def comm_speed(self) -> CommSpeed:
25
+ return self.get_attr(2)
26
+
27
+ @property
28
+ def windows_size_transmit(self) -> cdt.Unsigned:
29
+ return self.get_attr(3)
30
+
31
+ @property
32
+ def windows_size_receive(self) -> cdt.Unsigned:
33
+ return self.get_attr(4)
34
+
35
+ @property
36
+ def max_info_field_length_transmit(self) -> cdt.LongUnsigned:
37
+ return self.get_attr(5)
38
+
39
+ @property
40
+ def max_info_field_length_receive(self) -> cdt.LongUnsigned:
41
+ return self.get_attr(6)
42
+
43
+ @property
44
+ def inter_octet_time_out(self) -> cdt.LongUnsigned:
45
+ return self.get_attr(7)
46
+
47
+ @property
48
+ def inactivity_time_out(self) -> cdt.LongUnsigned:
49
+ return self.get_attr(8)
50
+
51
+ @property
52
+ def device_address(self) -> cdt.LongUnsigned:
53
+ return self.get_attr(9)
@@ -1,11 +1,11 @@
1
- from ..cosem_interface_classes import cosem_interface_class as ic
2
- from .overview import ClassID, VERSION_1
3
-
4
-
5
- class IECLocalPortSetup(ic.COSEMInterfaceClasses):
6
- """ This IC allows modelling the configuration of communication ports using the protocols specified in IEC 62056-21:2002. Several ports can be configured. """
7
- CLASS_ID = ClassID.IEC_LOCAL_PORT_SETUP
8
- VERSION = VERSION_1
9
-
10
- def characteristics_init(self) -> None:
11
- """# TODO: not released ... """
1
+ from ..cosem_interface_classes import cosem_interface_class as ic
2
+ from .overview import ClassID, VERSION_1
3
+
4
+
5
+ class IECLocalPortSetup(ic.COSEMInterfaceClasses):
6
+ """ This IC allows modelling the configuration of communication ports using the protocols specified in IEC 62056-21:2002. Several ports can be configured. """
7
+ CLASS_ID = ClassID.IEC_LOCAL_PORT_SETUP
8
+ VERSION = VERSION_1
9
+
10
+ def characteristics_init(self) -> None:
11
+ """# TODO: not released ... """
@@ -1,15 +1,15 @@
1
- from ...types import cdt
2
-
3
-
4
- class ImageTransferStatus(cdt.Enum, elements=tuple(range(8))):
5
- """ Holds the status of the Image transfer process. """
6
-
7
-
8
- TRANSFER_NOT_INITIATED = ImageTransferStatus(0)
9
- TRANSFER_INITIATED = ImageTransferStatus(1)
10
- VERIFICATION_INITIATED = ImageTransferStatus(2)
11
- VERIFICATION_SUCCESSFUL = ImageTransferStatus(3)
12
- VERIFICATION_FAILED = ImageTransferStatus(4)
13
- ACTIVATION_INITIATED = ImageTransferStatus(5)
14
- ACTIVATION_SUCCESSFUL = ImageTransferStatus(6)
15
- ACTIVATION_FAILED = ImageTransferStatus(7)
1
+ from ...types import cdt
2
+
3
+
4
+ class ImageTransferStatus(cdt.Enum, elements=tuple(range(8))):
5
+ """ Holds the status of the Image transfer process. """
6
+
7
+
8
+ TRANSFER_NOT_INITIATED = ImageTransferStatus(0)
9
+ TRANSFER_INITIATED = ImageTransferStatus(1)
10
+ VERIFICATION_INITIATED = ImageTransferStatus(2)
11
+ VERIFICATION_SUCCESSFUL = ImageTransferStatus(3)
12
+ VERIFICATION_FAILED = ImageTransferStatus(4)
13
+ ACTIVATION_INITIATED = ImageTransferStatus(5)
14
+ ACTIVATION_SUCCESSFUL = ImageTransferStatus(6)
15
+ ACTIVATION_FAILED = ImageTransferStatus(7)
@@ -1,126 +1,126 @@
1
- from ..__class_init__ import *
2
- from ...types.implementations import integers
3
- from . image_transfer_status import ImageTransferStatus
4
- from ..overview import VERSION_0
5
-
6
-
7
- class ImageToActivateInfoElement(cdt.Structure):
8
- image_to_activate_size: cdt.DoubleLongUnsigned
9
- image_to_activate_identification: cdt.OctetString
10
- image_to_activate_signature: cdt.OctetString
11
-
12
-
13
- class ImageToActivateInfo(cdt.Array):
14
- """ Provides information on the Image(s) ready for activation. It is generated as the result of the Image verification process. Thi client may check this information before
15
- activating the Images. """
16
- TYPE = ImageToActivateInfoElement
17
- __getitem__: ImageToActivateInfoElement
18
-
19
-
20
- class ImageTransferInitiate(cdt.Structure):
21
- """ Initializes the Image transfer process. After a successful invocation of the method the image_transfer_status attribute is set to (1) and the
22
- image_first_not_transferred_block_number is set to 0. Any subsequent invocation of the method resets the whole Image transfer process and all ImageBlocks need to be
23
- transferred again. """
24
- DEFAULT = (bytearray(b'default'), 0)
25
- image_identifier: cdt.OctetString
26
- image_size: cdt.DoubleLongUnsigned
27
-
28
-
29
- class ImageBlockTransfer(cdt.Structure):
30
- """ Transfers one block of the Image to the server. After a successful invocation of the method the corresponding bit in the image_transferred_block_status attribute
31
- is set to 1 and the image_first_bit_transferred_block_number attribute is updated """
32
- image_block_number: cdt.DoubleLongUnsigned
33
- image_block_value: cdt.OctetString
34
-
35
-
36
- class ImageTransfer(ic.COSEMInterfaceClasses):
37
- """ Instance of the Image transfer IC model the process of transferring binary files, called Images to COSEM servers. """
38
- CLASS_ID = ClassID.IMAGE_TRANSFER
39
- VERSION = VERSION_0
40
- __blocks_for_update: list[bytearray]
41
- A_ELEMENTS = (ic.ICAElement("image_block_size", cdt.DoubleLongUnsigned),
42
- ic.ICAElement("image_transferred_blocks_status", cdt.BitString, classifier=ic.Classifier.DYNAMIC),
43
- ic.ICAElement("image_first_not_transferred_block_number", cdt.DoubleLongUnsigned, classifier=ic.Classifier.DYNAMIC),
44
- ic.ICAElement("image_transfer_enabled", cdt.Boolean),
45
- ic.ICAElement("image_transfer_status", ImageTransferStatus, classifier=ic.Classifier.DYNAMIC),
46
- ic.ICAElement("image_to_activate_info", ImageToActivateInfo, classifier=ic.Classifier.DYNAMIC))
47
- M_ELEMENTS = (ic.ICMElement("image_transfer_initiate", ImageTransferInitiate),
48
- ic.ICMElement("image_block_transfer", ImageBlockTransfer),
49
- ic.ICMElement("image_verify", integers.Only0),
50
- ic.ICMElement("image_activate", integers.Only0))
51
-
52
- def characteristics_init(self):
53
- # TODO: compare image_block_size with ServerMaxReceive
54
- self.__blocks_for_update = list()
55
- """ container of blocks for transfer """
56
-
57
- @property
58
- def image_block_size(self) -> cdt.DoubleLongUnsigned:
59
- return self.get_attr(2)
60
-
61
- @property
62
- def image_transferred_blocks_status(self) -> cdt.BitString:
63
- return self.get_attr(3)
64
-
65
- @property
66
- def image_first_not_transferred_block_number(self) -> cdt.DoubleLongUnsigned:
67
- return self.get_attr(4)
68
-
69
- @property
70
- def image_transfer_enabled(self) -> cdt.Boolean:
71
- return self.get_attr(5)
72
-
73
- @property
74
- def image_transfer_status(self) -> ImageTransferStatus:
75
- return self.get_attr(6)
76
-
77
- @property
78
- def image_to_activate_info(self) -> ImageToActivateInfo:
79
- return self.get_attr(7)
80
-
81
- @property
82
- def image_transfer_initiate(self) -> ImageTransferInitiate:
83
- return self.get_meth(1)
84
-
85
- @property
86
- def image_block_transfer(self) -> ImageBlockTransfer:
87
- return self.get_meth(2)
88
-
89
- @property
90
- def image_verify(self) -> integers.Only0:
91
- return self.get_meth(3)
92
-
93
- @property
94
- def image_activate(self) -> integers.Only0:
95
- return self.get_meth(4)
96
-
97
- @property
98
- def current_block_transfer(self) -> int:
99
- return int(self.image_block_transfer.image_block_number)
100
-
101
- def get_n_blocks(self) -> int:
102
- """get sum of blocks"""
103
- return len(self.__blocks_for_update)
104
-
105
- def set_next_block(self):
106
- """ set next block transfer """
107
- try:
108
- # TODO: USE bitstring of BlockStatus if it exist(length order by image) for pretty next block
109
- self.set_block_for_transfer(self.current_block_transfer+1)
110
- except IndexError:
111
- raise StopIteration
112
-
113
- def set_block_for_transfer(self, index: int):
114
- """ set block transfer number. IndexError if index more when blocks size """
115
- if index > (len(self.__blocks_for_update) - 1):
116
- raise IndexError(F"got block {index=}, expected 0..{len(self.__blocks_for_update)-1}")
117
- self.image_block_transfer.set((index, self.__blocks_for_update[index]))
118
-
119
- @property
120
- def is_image_exist(self) -> bool:
121
- """ show is existing image in container """
122
- return bool(len(self.__blocks_for_update))
123
-
124
- def clear_image(self):
125
- """ clear image container """
126
- self.__blocks_for_update.clear()
1
+ from ..__class_init__ import *
2
+ from ...types.implementations import integers
3
+ from . image_transfer_status import ImageTransferStatus
4
+ from ..overview import VERSION_0
5
+
6
+
7
+ class ImageToActivateInfoElement(cdt.Structure):
8
+ image_to_activate_size: cdt.DoubleLongUnsigned
9
+ image_to_activate_identification: cdt.OctetString
10
+ image_to_activate_signature: cdt.OctetString
11
+
12
+
13
+ class ImageToActivateInfo(cdt.Array):
14
+ """ Provides information on the Image(s) ready for activation. It is generated as the result of the Image verification process. Thi client may check this information before
15
+ activating the Images. """
16
+ TYPE = ImageToActivateInfoElement
17
+ __getitem__: ImageToActivateInfoElement
18
+
19
+
20
+ class ImageTransferInitiate(cdt.Structure):
21
+ """ Initializes the Image transfer process. After a successful invocation of the method the image_transfer_status attribute is set to (1) and the
22
+ image_first_not_transferred_block_number is set to 0. Any subsequent invocation of the method resets the whole Image transfer process and all ImageBlocks need to be
23
+ transferred again. """
24
+ DEFAULT = (bytearray(b'default'), 0)
25
+ image_identifier: cdt.OctetString
26
+ image_size: cdt.DoubleLongUnsigned
27
+
28
+
29
+ class ImageBlockTransfer(cdt.Structure):
30
+ """ Transfers one block of the Image to the server. After a successful invocation of the method the corresponding bit in the image_transferred_block_status attribute
31
+ is set to 1 and the image_first_bit_transferred_block_number attribute is updated """
32
+ image_block_number: cdt.DoubleLongUnsigned
33
+ image_block_value: cdt.OctetString
34
+
35
+
36
+ class ImageTransfer(ic.COSEMInterfaceClasses):
37
+ """ Instance of the Image transfer IC model the process of transferring binary files, called Images to COSEM servers. """
38
+ CLASS_ID = ClassID.IMAGE_TRANSFER
39
+ VERSION = VERSION_0
40
+ __blocks_for_update: list[bytearray]
41
+ A_ELEMENTS = (ic.ICAElement("image_block_size", cdt.DoubleLongUnsigned),
42
+ ic.ICAElement("image_transferred_blocks_status", cdt.BitString, classifier=ic.Classifier.DYNAMIC),
43
+ ic.ICAElement("image_first_not_transferred_block_number", cdt.DoubleLongUnsigned, classifier=ic.Classifier.DYNAMIC),
44
+ ic.ICAElement("image_transfer_enabled", cdt.Boolean),
45
+ ic.ICAElement("image_transfer_status", ImageTransferStatus, classifier=ic.Classifier.DYNAMIC),
46
+ ic.ICAElement("image_to_activate_info", ImageToActivateInfo, classifier=ic.Classifier.DYNAMIC))
47
+ M_ELEMENTS = (ic.ICMElement("image_transfer_initiate", ImageTransferInitiate),
48
+ ic.ICMElement("image_block_transfer", ImageBlockTransfer),
49
+ ic.ICMElement("image_verify", integers.Only0),
50
+ ic.ICMElement("image_activate", integers.Only0))
51
+
52
+ def characteristics_init(self):
53
+ # TODO: compare image_block_size with ServerMaxReceive
54
+ self.__blocks_for_update = list()
55
+ """ container of blocks for transfer """
56
+
57
+ @property
58
+ def image_block_size(self) -> cdt.DoubleLongUnsigned:
59
+ return self.get_attr(2)
60
+
61
+ @property
62
+ def image_transferred_blocks_status(self) -> cdt.BitString:
63
+ return self.get_attr(3)
64
+
65
+ @property
66
+ def image_first_not_transferred_block_number(self) -> cdt.DoubleLongUnsigned:
67
+ return self.get_attr(4)
68
+
69
+ @property
70
+ def image_transfer_enabled(self) -> cdt.Boolean:
71
+ return self.get_attr(5)
72
+
73
+ @property
74
+ def image_transfer_status(self) -> ImageTransferStatus:
75
+ return self.get_attr(6)
76
+
77
+ @property
78
+ def image_to_activate_info(self) -> ImageToActivateInfo:
79
+ return self.get_attr(7)
80
+
81
+ @property
82
+ def image_transfer_initiate(self) -> ImageTransferInitiate:
83
+ return self.get_meth(1)
84
+
85
+ @property
86
+ def image_block_transfer(self) -> ImageBlockTransfer:
87
+ return self.get_meth(2)
88
+
89
+ @property
90
+ def image_verify(self) -> integers.Only0:
91
+ return self.get_meth(3)
92
+
93
+ @property
94
+ def image_activate(self) -> integers.Only0:
95
+ return self.get_meth(4)
96
+
97
+ @property
98
+ def current_block_transfer(self) -> int:
99
+ return int(self.image_block_transfer.image_block_number)
100
+
101
+ def get_n_blocks(self) -> int:
102
+ """get sum of blocks"""
103
+ return len(self.__blocks_for_update)
104
+
105
+ def set_next_block(self):
106
+ """ set next block transfer """
107
+ try:
108
+ # TODO: USE bitstring of BlockStatus if it exist(length order by image) for pretty next block
109
+ self.set_block_for_transfer(self.current_block_transfer+1)
110
+ except IndexError:
111
+ raise StopIteration
112
+
113
+ def set_block_for_transfer(self, index: int):
114
+ """ set block transfer number. IndexError if index more when blocks size """
115
+ if index > (len(self.__blocks_for_update) - 1):
116
+ raise IndexError(F"got block {index=}, expected 0..{len(self.__blocks_for_update)-1}")
117
+ self.image_block_transfer.set((index, self.__blocks_for_update[index]))
118
+
119
+ @property
120
+ def is_image_exist(self) -> bool:
121
+ """ show is existing image in container """
122
+ return bool(len(self.__blocks_for_update))
123
+
124
+ def clear_image(self):
125
+ """ clear image container """
126
+ self.__blocks_for_update.clear()
@@ -1,3 +1,3 @@
1
- from . import data
2
- from . import arbitrator
3
- from . import profile_generic
1
+ from . import data
2
+ from . import arbitrator
3
+ from . import profile_generic
@@ -1,19 +1,19 @@
1
- from ..arbitrator import Arbitrator
2
- from ... import settings
3
-
4
-
5
- match settings.get_current_language():
6
- case settings.Language.ENGLISH: from ...Values.EN import actors
7
- case settings.Language.RUSSIAN: from ...Values.RU import actors
8
-
9
-
10
- class SPODES3Arbitrator(Arbitrator):
11
- """Cosem3 7.3.18"""
12
- actors = (actors.MANUAL,
13
- actors.LOCAL_1,
14
- actors.LOCAL_2,
15
- actors.LOCAL_3,
16
- actors.LOCAL_4,
17
- actors.LOCAL_5,
18
- actors.LOCAL_6,
19
- actors.LOCAL_7)
1
+ from ..arbitrator import Arbitrator
2
+ from ... import settings
3
+
4
+
5
+ match settings.get_current_language():
6
+ case settings.Language.ENGLISH: from ...Values.EN import actors
7
+ case settings.Language.RUSSIAN: from ...Values.RU import actors
8
+
9
+
10
+ class SPODES3Arbitrator(Arbitrator):
11
+ """Cosem3 7.3.18"""
12
+ actors = (actors.MANUAL,
13
+ actors.LOCAL_1,
14
+ actors.LOCAL_2,
15
+ actors.LOCAL_3,
16
+ actors.LOCAL_4,
17
+ actors.LOCAL_5,
18
+ actors.LOCAL_6,
19
+ actors.LOCAL_7)