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,21 +1,12 @@
1
- from __future__ import annotations
2
- from ..types import choices
3
- from . import cosem_interface_class as ic
4
- from .overview import ClassID
5
- from .overview import VERSION_0
6
-
7
-
8
- class Data(ic.COSEMInterfaceClasses):
9
- """ Object stores data related to internal meter object(s). The meaning of the value is identified by the logical_name.
10
- The data type of the value is CHOICE. “Data” is typically used to store configuration data and parameters """
11
- CLASS_ID = ClassID.DATA
12
- VERSION = VERSION_0
13
- A_ELEMENTS = ic.ICAElement("value", choices.common_dt, classifier=ic.Classifier.NOT_SPECIFIC),
14
-
15
- def characteristics_init(self):
16
- """nothing do it"""
17
-
18
- @property
19
- def value(self) -> cdt.CommonDataTypes:
20
- """Contains the data"""
21
- return self.get_attr(2)
1
+ from typing import Optional
2
+ from ..types import choices, cdt
3
+ from .cosem_interface_class import ICAuto, ICAElement, Classifier
4
+ from .Overview import class_id
5
+
6
+
7
+ class Data(ICAuto):
8
+ """4.3.1 Data"""
9
+ CLASS_ID = class_id.DATA
10
+ VERSION = 0
11
+ A_ELEMENTS = ICAElement(2, "value", choices.common_dt, classifier=Classifier.NOT_SPECIFIC),
12
+ value: Optional[cdt.CommonDataTypes]
@@ -1,59 +1,32 @@
1
- from ..__class_init__ import *
2
- from ...types import choices
3
- from ...types.implementations import integers
4
- from ..overview import VERSION_0
5
-
6
-
7
- class DemandRegister(ic.COSEMInterfaceClasses):
8
- """DLMS UA 1000-1 Ed 14 4.3.4.Demand register"""
9
- CLASS_ID = ClassID.DEMAND_REGISTER
10
- VERSION = VERSION_0
11
- A_ELEMENTS = (
12
- ic.ICAElement("current_average_value", choices.register, classifier=ic.Classifier.DYNAMIC),
13
- ic.ICAElement("last_average_value", choices.register, classifier=ic.Classifier.DYNAMIC),
14
- ic.ICAElement("scaler_unit", cdt.ScalUnitType),
15
- ic.ICAElement("status", choices.extended_register, classifier=ic.Classifier.DYNAMIC),
16
- ic.ICAElement("capture_time", cst.OctetStringDateTime, classifier=ic.Classifier.DYNAMIC),
17
- ic.ICAElement("start_time_current", cst.OctetStringDateTime, classifier=ic.Classifier.DYNAMIC),
18
- ic.ICAElement("period", cdt.DoubleLongUnsigned, min=1),
19
- ic.ICAElement("number_of_periods", cdt.LongUnsigned, min=1, default=1))
20
- M_ELEMENTS = (
21
- ic.ICMElement("reset", integers.Only0),
22
- ic.ICMElement("next_period", integers.Only0))
23
- scaler_unit_not_settable: bool
24
-
25
- @property
26
- def current_average_value(self) -> choices.RegisterValues:
27
- return self.get_attr(2)
28
-
29
- @property
30
- def last_average_value(self) -> choices.RegisterValues:
31
- return self.get_attr(3)
32
-
33
- @property
34
- def scaler_unit(self) -> cdt.ScalUnitType:
35
- return self.get_attr(4)
36
-
37
- @property
38
- def status(self) -> choices.ExtendedRegisterValues:
39
- return self.get_attr(5)
40
-
41
- @property
42
- def capture_time(self) -> cst.OctetStringDateTime:
43
- return self.get_attr(6)
44
-
45
- @property
46
- def start_time_current(self) -> cst.OctetStringDateTime:
47
- return self.get_attr(7)
48
-
49
- @property
50
- def period(self) -> cdt.DoubleLongUnsigned:
51
- return self.get_attr(8)
52
-
53
- @property
54
- def number_of_periods(self) -> cdt.LongUnsigned:
55
- return self.get_attr(9)
56
-
57
- def characteristics_init(self):
58
- self.scaler_unit_not_settable = False
59
- """ usability scaler unit flag. if True then it not used"""
1
+ from ...types import choices, cdt, cst
2
+ from ...types.implementations import integers
3
+ from ...types.type_alias import Attr
4
+ from ..cosem_interface_class import ICAuto, ICAElement, ICMElement, Classifier, Cardinality
5
+ from ..Overview import class_id
6
+
7
+
8
+ class DemandRegister(ICAuto):
9
+ """4.3.4.Demand register"""
10
+ CLASS_ID = class_id.DEMAND_REGISTER
11
+ VERSION = 0
12
+ CARDINALITY = Cardinality()
13
+ A_ELEMENTS = (
14
+ ICAElement(2, "current_average_value", choices.register, classifier=Classifier.DYNAMIC),
15
+ ICAElement(3, "last_average_value", choices.register, classifier=Classifier.DYNAMIC),
16
+ ICAElement(4, "scaler_unit", cdt.ScalUnitType),
17
+ ICAElement(5, "status", choices.extended_register, classifier=Classifier.DYNAMIC),
18
+ ICAElement(6, "capture_time", cst.OctetStringDateTime, classifier=Classifier.DYNAMIC),
19
+ ICAElement(7, "start_time_current", cst.OctetStringDateTime, classifier=Classifier.DYNAMIC),
20
+ ICAElement(8, "period", cdt.DoubleLongUnsigned, min=1),
21
+ ICAElement(9, "number_of_periods", cdt.LongUnsigned, min=1, default=1))
22
+ M_ELEMENTS = (
23
+ ICMElement(1, "reset", integers.Only0),
24
+ ICMElement(2, "next_period", integers.Only0))
25
+ current_average_value: Attr
26
+ last_average_value: Attr
27
+ scaler_unit: Attr
28
+ status: Attr
29
+ capture_time: Attr
30
+ start_time_current: Attr
31
+ period: Attr
32
+ number_of_periods: Attr
@@ -1,74 +1,56 @@
1
- from .__class_init__ import *
2
- from ..types.implementations import integers
3
- from itertools import chain
4
- from ..config_parser import get_message
5
- from .overview import VERSION_0
6
-
7
-
8
- class ControlState(cdt.Enum, elements=(0, 1, 2)):
9
- """ Shows the internal state of the disconnect control object. """
10
-
11
-
12
- class ControlMode(cdt.Enum, elements=tuple(chain(range(7), range(129, 135)))):
13
- """ Configures the behaviour of the disconnect control object for all triggers. Local disconnection is always possible.
14
- To suppress local disconnection, the corresponding trigger must be inhibited. """
15
-
16
- @staticmethod
17
- def get_letters(value: int) -> str:
18
- """return transition litters"""
19
- match value:
20
- case 0: return ""
21
- case 1: return "bcfgde"
22
- case 2: return "bcfgae"
23
- case 3: return "bcgde"
24
- case 4: return "bcgae"
25
- case 5: return "bcfgdeh"
26
- case 6: return "bcgdeh"
27
- case 129: return "bcfmde"
28
- case 130: return "bcfmae"
29
- case 131: return "bcmde"
30
- case 132: return "bcma"
31
- case 133: return "bcmak"
32
- case 134: return "bcmsdep"
33
- case _: raise ValueError(F"unknown {value=}")
34
-
35
-
36
- class OutputState(cdt.Boolean):
37
- """ Shows the actual physical state of the disconnect unit, i.e. if an electricity breaker or a gas valve is open or closed. TRUE = connected, FALSE = disconnected.
38
- In electricity metering, the supply is connected when the disconnector device is closed. In gas and water metering, the supply is connected when the valve is open """
39
- def __str__(self):
40
- return get_message("$disconnected$") if self.contents == b'\x00' else get_message("$connected$")
41
-
42
-
43
- class DisconnectControl(ic.COSEMInterfaceClasses):
44
- """DLMS UA 1000-1 Ed. 14 4.5.8 Disconnect control"""
45
- CLASS_ID = ClassID.DISCONNECT_CONTROL
46
- VERSION = VERSION_0
47
- A_ELEMENTS = (ic.ICAElement("output_state", OutputState, classifier=ic.Classifier.DYNAMIC),
48
- ic.ICAElement("control_state", ControlState, classifier=ic.Classifier.DYNAMIC),
49
- ic.ICAElement("control_mode", ControlMode))
50
- M_ELEMENTS = (ic.ICMElement("remote_disconnect", integers.Only0),
51
- ic.ICMElement("remote_reconnect", integers.Only0))
52
-
53
- def characteristics_init(self):
54
- """nothing do it"""
55
-
56
- @property
57
- def output_state(self) -> cdt.Boolean:
58
- return self.get_attr(2)
59
-
60
- @property
61
- def control_state(self) -> ControlState:
62
- return self.get_attr(3)
63
-
64
- @property
65
- def control_mode(self) -> ControlMode:
66
- return self.get_attr(4)
67
-
68
- @property
69
- def remote_disconnect(self) -> cdt.Integer:
70
- return self.get_meth(1)
71
-
72
- @property
73
- def remote_reconnect(self) -> cdt.Integer:
74
- return self.get_meth(2)
1
+ from itertools import chain
2
+ from ..config_parser import get_message
3
+ from ..types.implementations import integers
4
+ from typing import Optional
5
+ from ..types import cdt
6
+ from .cosem_interface_class import ICAElement, ICMElement, Classifier, ICAuto
7
+ from .Overview import class_id
8
+
9
+
10
+ class ControlState(cdt.Enum, elements=(0, 1, 2)):
11
+ """ Shows the internal state of the disconnect control object. """
12
+
13
+
14
+ class ControlMode(cdt.Enum, elements=tuple(chain(range(7), range(129, 135)))):
15
+ """ Configures the behaviour of the disconnect control object for all triggers. Local disconnection is always possible.
16
+ To suppress local disconnection, the corresponding trigger must be inhibited. """
17
+
18
+ @staticmethod
19
+ def get_letters(value: int) -> str:
20
+ """return transition litters"""
21
+ match value:
22
+ case 0: return ""
23
+ case 1: return "bcfgde"
24
+ case 2: return "bcfgae"
25
+ case 3: return "bcgde"
26
+ case 4: return "bcgae"
27
+ case 5: return "bcfgdeh"
28
+ case 6: return "bcgdeh"
29
+ case 129: return "bcfmde"
30
+ case 130: return "bcfmae"
31
+ case 131: return "bcmde"
32
+ case 132: return "bcma"
33
+ case 133: return "bcmak"
34
+ case 134: return "bcmsdep"
35
+ case _: raise ValueError(F"unknown {value=}")
36
+
37
+
38
+ class OutputState(cdt.Boolean):
39
+ """ Shows the actual physical state of the disconnect unit, i.e. if an electricity breaker or a gas valve is open or closed. TRUE = connected, FALSE = disconnected.
40
+ In electricity metering, the supply is connected when the disconnector device is closed. In gas and water metering, the supply is connected when the valve is open """
41
+ def __str__(self):
42
+ return get_message("$disconnected$") if self.contents == b'\x00' else get_message("$connected$")
43
+
44
+
45
+ class DisconnectControl(ICAuto):
46
+ """4.5.8 Disconnect control"""
47
+ CLASS_ID = class_id.DISCONNECT_CONTROL
48
+ VERSION = 0
49
+ A_ELEMENTS = (ICAElement(2, "output_state", OutputState, classifier=Classifier.DYNAMIC),
50
+ ICAElement(3, "control_state", ControlState, classifier=Classifier.DYNAMIC),
51
+ ICAElement(4, "control_mode", ControlMode))
52
+ M_ELEMENTS = (ICMElement(1, "remote_disconnect", integers.Only0),
53
+ ICMElement(2, "remote_reconnect", integers.Only0))
54
+ output_state: Optional[cdt.Boolean]
55
+ control_state: Optional[ControlState]
56
+ control_mode: Optional[ControlMode]
@@ -1,27 +1,18 @@
1
- from . import register
2
- from .__class_init__ import *
3
- from ..types import choices
4
- from .overview import VERSION_0
5
-
6
-
7
- class ExtendedRegister(register.Register, ic.COSEMInterfaceClasses):
8
- """ A “Register” object stores a process value or a status value with its associated unit. The register object knows
9
- the nature of the process value or of the status value. The nature of the value is described by the attribute
10
- “logical name” using the OBIS identification system. """
11
- CLASS_ID = ClassID.EXT_REGISTER
12
- VERSION = VERSION_0
13
- A_ELEMENTS = (register.Register.get_attr_element(2),
14
- register.Register.get_attr_element(3),
15
- ic.ICAElement("status", choices.extended_register, classifier=ic.Classifier.DYNAMIC),
16
- ic.ICAElement("capture_time", cst.OctetStringDateTime, classifier=ic.Classifier.DYNAMIC))
17
- M_ELEMENTS = register.Register.get_meth_element(1),
18
-
19
- @property
20
- def status(self) -> choices.ExtendedRegisterValues:
21
- return self.get_attr(4)
22
-
23
- @property
24
- def capture_time(self) -> cdt.DateTime:
25
- return self.get_attr(5)
26
-
27
-
1
+ from . import register
2
+ from typing import Optional
3
+ from ..types import choices, cdt, cst
4
+ from .cosem_interface_class import ICAElement, Classifier
5
+ from .Overview import class_id
6
+
7
+
8
+ class ExtendedRegister(register.Register):
9
+ """4.3.3 Extended register"""
10
+ CLASS_ID = class_id.EXT_REGISTER
11
+ VERSION = 0
12
+ A_ELEMENTS = (register.Register.getAElement(2).unwrap(),
13
+ register.Register.getAElement(3).unwrap(),
14
+ ICAElement(4, "status", choices.extended_register, classifier=Classifier.DYNAMIC),
15
+ ICAElement(5, "capture_time", cst.OctetStringDateTime, classifier=Classifier.DYNAMIC))
16
+ M_ELEMENTS = register.Register.getMElement(1).unwrap(),
17
+ status: Optional[choices.ExtendedRegisterValues]
18
+ capture_time: Optional[cdt.DateTime]
@@ -1,43 +1,33 @@
1
- from . __class_init__ import *
2
- from .overview import VERSION_0
3
-
4
-
5
- class QoSElement(cdt.Structure):
6
- """ Params of element """
7
- precedence: cdt.Unsigned
8
- delay: cdt.Unsigned
9
- reliability: cdt.Unsigned
10
- peak_throughput: cdt.Unsigned
11
- mean_throughput: cdt.Unsigned
12
-
13
-
14
- class QualityOfService(cdt.Structure):
15
- """ Specifies the quality of service parameters. It is a structure of 2 elements:
16
- 1: defines the default or minimum characteristics of the network concerned. These parameters have to be set to best effort value;
17
- 2: defines the requested parameters. """
18
- default: QoSElement
19
- requested: QoSElement
20
-
21
-
22
- class GPRSModemSetup(ic.COSEMInterfaceClasses):
23
- """ This IC allow setting up GPRS modems, by handling all data necessary data for modem management. """
24
- CLASS_ID = ClassID.GPRS_MODEM_SETUP
25
- VERSION = VERSION_0
26
- A_ELEMENTS = (ic.ICAElement("APN", cdt.OctetString),
27
- ic.ICAElement("PIN_code", cdt.LongUnsigned),
28
- ic.ICAElement("quality_of_service", QualityOfService))
29
-
30
- def characteristics_init(self):
31
- """nothing do it"""
32
-
33
- @property
34
- def APN(self) -> cdt.OctetString:
35
- return self.get_attr(2)
36
-
37
- @property
38
- def PIN_code(self) -> cdt.LongUnsigned:
39
- return self.get_attr(3)
40
-
41
- @property
42
- def quality_of_service(self) -> QualityOfService:
43
- return self.get_attr(4)
1
+ from typing import Optional
2
+ from ..types import cdt
3
+ from .cosem_interface_class import ICAElement, ICAuto
4
+ from .Overview import class_id
5
+
6
+
7
+ class QoSElement(cdt.Structure):
8
+ """ Params of element """
9
+ precedence: cdt.Unsigned
10
+ delay: cdt.Unsigned
11
+ reliability: cdt.Unsigned
12
+ peak_throughput: cdt.Unsigned
13
+ mean_throughput: cdt.Unsigned
14
+
15
+
16
+ class QualityOfService(cdt.Structure):
17
+ """ Specifies the quality of service parameters. It is a structure of 2 elements:
18
+ 1: defines the default or minimum characteristics of the network concerned. These parameters have to be set to best effort value;
19
+ 2: defines the requested parameters. """
20
+ default: QoSElement
21
+ requested: QoSElement
22
+
23
+
24
+ class GPRSModemSetup(ICAuto):
25
+ """ This IC allow setting up GPRS modems, by handling all data necessary data for modem management. """
26
+ CLASS_ID = class_id.GPRS_MODEM_SETUP
27
+ VERSION = 0
28
+ A_ELEMENTS = (ICAElement(2, "APN", cdt.OctetString),
29
+ ICAElement(3, "PIN_code", cdt.LongUnsigned),
30
+ ICAElement(4, "quality_of_service", QualityOfService))
31
+ APN: Optional[cdt.OctetString]
32
+ PIN_code: Optional[cdt.LongUnsigned]
33
+ quality_of_service: Optional[QualityOfService]
@@ -1,103 +1,78 @@
1
- import logging
2
-
3
- from ..__class_init__ import *
4
- from ...config_parser import get_message
5
- from ..overview import VERSION_0
6
-
7
-
8
- class Status(cdt.Enum, elements=tuple(range(6))):
9
- """ Indicates the registration status of the modem. """
10
-
11
-
12
- class CSAttachment(cdt.Enum, elements=(0, 1, 2)):
13
- """ Indicates the current circuit switched status."""
14
-
15
-
16
- class PSStatus(cdt.Enum, elements=tuple(range(5))):
17
- """ Indicates the packet switched status of the modem. """
18
-
19
-
20
- class SignalQuality(cdt.IntegerEnum, cdt.Unsigned):
21
- """for string report"""
22
- def __init_subclass__(cls, **kwargs):
23
- """not need"""
24
-
25
- def get_report(self) -> cdt.Report:
26
- val = int(self)
27
- if val == 0:
28
- return cdt.Report(get_message(F"({val}) –113 dBm $or$ $less$(0)"))
29
- elif val == 1:
30
- return cdt.Report(F"({val}) –111 dBm")
31
- elif val < 31:
32
- return cdt.Report(get_message(F"({val}) {-109+(val-2)*2} dBm"))
33
- elif val == 31:
34
- return cdt.Report(get_message(F"({val}) –51 dBm $or$ $greater$"))
35
- elif val == 99:
36
- return cdt.Report(get_message(F"({val}) $not_known_or_not_detectable$"))
37
- else:
38
- return cdt.Report(
39
- msg=F"({val})",
40
- log=cdt.Log(logging.WARN, "unknown value"))
41
-
42
-
43
- class CellInfoType(cdt.Structure):
44
- """ Params of element """
45
- cell_ID: cdt.LongUnsigned
46
- location_ID: cdt.LongUnsigned
47
- signal_quality: SignalQuality
48
- ber: cdt.Unsigned
49
-
50
-
51
- class AdjacentCellInfo(cdt.Structure):
52
- cell_ID: cdt.LongUnsigned
53
- signal_quality: SignalQuality
54
-
55
-
56
- class AdjacentCells(cdt.Array):
57
- TYPE = AdjacentCellInfo
58
-
59
-
60
- class GSMDiagnostic(ic.COSEMInterfaceClasses):
61
- """ The GSM/GPRS network is undergoing constant changes in terms of registration status, signal quality etc. It is necessary to monitor and log the relevant parameters in order
62
- to obtain diagnostic information that allows identifying communication problems in the network. An instance of the 'GSM diagnostic' class stores parameters of the GSM/GPRS
63
- network necessary for analysing the operation of the network."""
64
- CLASS_ID = ClassID.GSM_DIAGNOSTIC
65
- VERSION = VERSION_0
66
- A_ELEMENTS = (ic.ICAElement("operator", cdt.VisibleString, classifier=ic.Classifier.DYNAMIC),
67
- ic.ICAElement("status", Status, 0, 255, 0, classifier=ic.Classifier.DYNAMIC),
68
- ic.ICAElement("cs_attachment", CSAttachment, 0, 255, 0, classifier=ic.Classifier.DYNAMIC),
69
- ic.ICAElement("ps_status", PSStatus, 0, 255, 0, classifier=ic.Classifier.DYNAMIC),
70
- ic.ICAElement("cell_info", CellInfoType, classifier=ic.Classifier.DYNAMIC),
71
- ic.ICAElement("adjacent_cell", AdjacentCells, classifier=ic.Classifier.DYNAMIC),
72
- ic.ICAElement("capture_time", cdt.DateTime, classifier=ic.Classifier.DYNAMIC))
73
-
74
- def characteristics_init(self):
75
- """nothing do it"""
76
-
77
- @property
78
- def operator(self) -> cdt.VisibleString:
79
- return self.get_attr(2)
80
-
81
- @property
82
- def status(self) -> Status:
83
- return self.get_attr(3)
84
-
85
- @property
86
- def cs_attachment(self) -> CSAttachment:
87
- return self.get_attr(4)
88
-
89
- @property
90
- def ps_status(self) -> PSStatus:
91
- return self.get_attr(5)
92
-
93
- @property
94
- def cell_info(self) -> CellInfoType:
95
- return self.get_attr(6)
96
-
97
- @property
98
- def adjacent_cell(self) -> AdjacentCells:
99
- return self.get_attr(7)
100
-
101
- @property
102
- def capture_time(self) -> cdt.DateTime:
103
- return self.get_attr(8)
1
+ import logging
2
+ from ...config_parser import get_message
3
+ from typing import Optional
4
+ from ...types import cdt
5
+ from ..cosem_interface_class import ICAuto, ICAElement, Classifier
6
+ from ..Overview import class_id
7
+
8
+
9
+ class Status(cdt.Enum, elements=tuple(range(6))):
10
+ """ Indicates the registration status of the modem. """
11
+
12
+
13
+ class CSAttachment(cdt.Enum, elements=(0, 1, 2)):
14
+ """ Indicates the current circuit switched status."""
15
+
16
+
17
+ class PSStatus(cdt.Enum, elements=tuple(range(5))):
18
+ """ Indicates the packet switched status of the modem. """
19
+
20
+
21
+ class SignalQuality(cdt.IntegerEnum, cdt.Unsigned):
22
+ """for string report"""
23
+ def __init_subclass__(cls, **kwargs):
24
+ """not need"""
25
+
26
+ def get_report(self) -> cdt.Report:
27
+ val = int(self)
28
+ if val == 0:
29
+ return cdt.Report(get_message(F"({val}) –113 dBm $or$ $less$(0)"))
30
+ elif val == 1:
31
+ return cdt.Report(F"({val}) –111 dBm")
32
+ elif val < 31:
33
+ return cdt.Report(get_message(F"({val}) {-109+(val-2)*2} dBm"))
34
+ elif val == 31:
35
+ return cdt.Report(get_message(F"({val}) –51 dBm $or$ $greater$"))
36
+ elif val == 99:
37
+ return cdt.Report(get_message(F"({val}) $not_known_or_not_detectable$"))
38
+ else:
39
+ return cdt.Report(
40
+ msg=F"({val})",
41
+ log=cdt.Log(logging.WARN, "unknown value"))
42
+
43
+
44
+ class CellInfoType(cdt.Structure):
45
+ """ Params of element """
46
+ cell_ID: cdt.LongUnsigned
47
+ location_ID: cdt.LongUnsigned
48
+ signal_quality: SignalQuality
49
+ ber: cdt.Unsigned
50
+
51
+
52
+ class AdjacentCellInfo(cdt.Structure):
53
+ cell_ID: cdt.LongUnsigned
54
+ signal_quality: SignalQuality
55
+
56
+
57
+ class AdjacentCells(cdt.Array):
58
+ TYPE = AdjacentCellInfo
59
+
60
+
61
+ class GSMDiagnostic(ICAuto):
62
+ """4.7.8 GSM diagnostic"""
63
+ CLASS_ID = class_id.GSM_DIAGNOSTIC
64
+ VERSION = 0
65
+ A_ELEMENTS = (ICAElement(2, "operator", cdt.VisibleString, classifier=Classifier.DYNAMIC),
66
+ ICAElement(3, "status", Status, 0, 255, 0, classifier=Classifier.DYNAMIC),
67
+ ICAElement(4, "cs_attachment", CSAttachment, 0, 255, 0, classifier=Classifier.DYNAMIC),
68
+ ICAElement(5, "ps_status", PSStatus, 0, 255, 0, classifier=Classifier.DYNAMIC),
69
+ ICAElement(6, "cell_info", CellInfoType, classifier=Classifier.DYNAMIC),
70
+ ICAElement(7, "adjacent_cell", AdjacentCells, classifier=Classifier.DYNAMIC),
71
+ ICAElement(8, "capture_time", cdt.DateTime, classifier=Classifier.DYNAMIC))
72
+ operator: Optional[cdt.VisibleString]
73
+ status: Optional[Status]
74
+ cs_attachment: Optional[CSAttachment]
75
+ ps_status: Optional[PSStatus]
76
+ cell_info: Optional[CellInfoType]
77
+ adjacent_cell: Optional[AdjacentCells]
78
+ capture_time: Optional[cdt.DateTime]