DLMS-SPODES 0.87.9__py3-none-any.whl → 0.87.11__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.
@@ -2114,7 +2114,7 @@ class Template:
2114
2114
  for i in indexes:
2115
2115
  if (attr := obj.get_attr(i)) is not None:
2116
2116
  try:
2117
- obj_col.parse_attr(i, attr.to_transcript())
2117
+ attr.validate()
2118
2118
  except ValueError as e:
2119
2119
  ret.append(ValueError(F"can't decode value {attr} for {ln}:{i}"))
2120
2120
  else:
@@ -57,37 +57,58 @@ class RangeDescriptorValueChoice(CommonDataTypeChoiceBase, types=(
57
57
  """Types of range_descriptor.from_value/to_value"""
58
58
 
59
59
 
60
- class RangeDescriptor(cdt.Structure):
61
- restricting_object: structs.CaptureObjectDefinition
62
- from_value: RangeDescriptorValueChoice
63
- to_value: RangeDescriptorValueChoice
64
- selected_values: CaptureObjects
65
-
66
-
67
- class Data(ut.Data):
68
- restricting_object: structs.CaptureObjectDefinition
69
- from_value: cdt.SimpleDataType
70
- to_value: cdt.SimpleDataType
71
- selected_values: CaptureObjects
72
- from_entry: FromEntry
73
- to_entry: cdt.DoubleLongUnsigned
74
- from_selected_value: cdt.LongUnsigned
75
- to_selected_value: cdt.LongUnsigned
76
- ELEMENTS = {1: ut.SequenceElement('range_descriptor', RangeDescriptor),
77
- 2: ut.SequenceElement('entry_descriptor', EntryDescriptor)}
78
-
79
-
80
- class SelectiveAccessDescriptor(ut.SelectiveAccessDescriptor):
81
- access_selector: AccessSelector
82
- access_parameters: Data
83
- ELEMENTS = (ut.SequenceElement('access_selector', AccessSelector),
84
- ut.SequenceElement('access_parameters', Data))
85
-
86
-
87
- class CosemAttributeDescriptorWithSelection(ut.CosemAttributeDescriptorWithSelection):
88
- access_selection: SelectiveAccessDescriptor
89
- ELEMENTS = (ut.SequenceElement('cosem_attribute_descriptor', ut.CosemAttributeDescriptor),
90
- ut.SequenceElement('access_selection', SelectiveAccessDescriptor))
60
+ # class RangeDescriptor(cdt.Structure):
61
+ # restricting_object: structs.CaptureObjectDefinition
62
+ # from_value: RangeDescriptorValueChoice
63
+ # to_value: RangeDescriptorValueChoice
64
+ # selected_values: CaptureObjects
65
+ #
66
+ # def __setattr__(self, key, value):
67
+ # """Allow setting from_value and to_value with a CommonDataType of allowed types.
68
+ # Other attributes remain immutable as per base Structure behavior."""
69
+ # if key in ("from_value", "to_value"):
70
+ # index = 1 if key == "from_value" else 2
71
+ # # Accept only CommonDataType instances of allowed types
72
+ # if isinstance(value, cdt.CommonDataType):
73
+ # # Build allowed types tuple from Choice definition
74
+ # allowed_types = tuple(el.TYPE if isinstance(el, ut.SequenceElement) else None for el in RangeDescriptorValueChoice.ELEMENTS.values())
75
+ # allowed_types = tuple(t for t in allowed_types if t is not None)
76
+ # if isinstance(value, allowed_types):
77
+ # self.values[index] = value
78
+ # return
79
+ # else:
80
+ # raise ValueError(F"Type got {value.__class__.__name__}, expected one of: "
81
+ # + ", ".join(t.__name__ for t in allowed_types))
82
+ # else:
83
+ # raise TypeError(F"Unsupported value type for {key}: {value.__class__.__name__}. Provide a CommonDataType instance.")
84
+ # else:
85
+ # super().__setattr__(key, value)
86
+ #
87
+ #
88
+ # class Data(ut.Data):
89
+ # restricting_object: structs.CaptureObjectDefinition
90
+ # from_value: cdt.SimpleDataType
91
+ # to_value: cdt.SimpleDataType
92
+ # selected_values: CaptureObjects
93
+ # from_entry: FromEntry
94
+ # to_entry: cdt.DoubleLongUnsigned
95
+ # from_selected_value: cdt.LongUnsigned
96
+ # to_selected_value: cdt.LongUnsigned
97
+ # ELEMENTS = {1: ut.SequenceElement('range_descriptor', RangeDescriptor),
98
+ # 2: ut.SequenceElement('entry_descriptor', EntryDescriptor)}
99
+ #
100
+ #
101
+ # class SelectiveAccessDescriptor(ut.SelectiveAccessDescriptor):
102
+ # access_selector: AccessSelector
103
+ # access_parameters: Data
104
+ # ELEMENTS = (ut.SequenceElement('access_selector', AccessSelector),
105
+ # ut.SequenceElement('access_parameters', Data))
106
+ #
107
+ #
108
+ # class CosemAttributeDescriptorWithSelection(ut.CosemAttributeDescriptorWithSelection):
109
+ # access_selection: SelectiveAccessDescriptor
110
+ # ELEMENTS = (ut.SequenceElement('cosem_attribute_descriptor', ut.CosemAttributeDescriptor),
111
+ # ut.SequenceElement('access_selection', SelectiveAccessDescriptor))
91
112
 
92
113
 
93
114
  class ProfileGeneric(ver0.ProfileGeneric):
@@ -186,6 +207,45 @@ class ProfileGeneric(ver0.ProfileGeneric):
186
207
  """ Available after got sort object. TODO: need rewrite. maybe replace to collection level. Wrong used sort_obj, it can be any element from capture_objects"""
187
208
  if self.sort_object is None:
188
209
  raise exc.EmptyObj(F"<sort object> is empty")
210
+ sort_obj: ic.COSEMInterfaceClasses = self.collection.get_object(self.sort_object.logical_name)
211
+ if sort_obj.CLASS_ID.contents == self.sort_object.class_id.contents:
212
+ value_type: Type[cdt.CommonDataType] = sort_obj.get_attr_data_type(int(self.sort_object.attribute_index))
213
+ else:
214
+ exc.NoObject(F"got {self.sort_object.class_id=}, expected {sort_obj.CLASS_ID=} from collection")
215
+
216
+ class RangeDescriptor(cdt.Structure):
217
+ # cb_preset = TODO: make check 'selected_values' from self.capture_objects or
218
+ # cb_post_set = TODO: make check 'selected_values' from self.capture_objects
219
+ DEFAULT = b'\x02\x04\x02\x04\x12\x00\x01\x09\x06\x00\x00\x01\x00\x00\xff\x0f\x02\x12\x00\x00\x09\x0c\x07\xe4\x01\x01\xff\xff\xff\xff\xff\x80\x00\xff' \
220
+ b'\x09\x0c\x07\xe4\x01\x02\xff\xff\xff\xff\xff\x80\x00\xff\x01\x00'
221
+ restricting_object: structs.CaptureObjectDefinition
222
+ from_value: value_type
223
+ to_value: value_type
224
+ selected_values: CaptureObjects
225
+
226
+ class Data(ut.Data):
227
+ restricting_object: structs.CaptureObjectDefinition
228
+ from_value: cdt.SimpleDataType
229
+ to_value: cdt.SimpleDataType
230
+ selected_values: CaptureObjects
231
+ from_entry: FromEntry
232
+ to_entry: cdt.DoubleLongUnsigned
233
+ from_selected_value: cdt.LongUnsigned
234
+ to_selected_value: cdt.LongUnsigned
235
+ ELEMENTS = {1: ut.SequenceElement('range_descriptor', RangeDescriptor),
236
+ 2: ut.SequenceElement('entry_descriptor', EntryDescriptor)}
237
+
238
+ class SelectiveAccessDescriptor(ut.SelectiveAccessDescriptor):
239
+ access_selector: AccessSelector
240
+ access_parameters: Data
241
+ ELEMENTS = (ut.SequenceElement('access_selector', AccessSelector),
242
+ ut.SequenceElement('access_parameters', Data))
243
+
244
+ class CosemAttributeDescriptorWithSelection(ut.CosemAttributeDescriptorWithSelection):
245
+ access_selection: SelectiveAccessDescriptor
246
+ ELEMENTS = (ut.SequenceElement('cosem_attribute_descriptor', ut.CosemAttributeDescriptor),
247
+ ut.SequenceElement('access_selection', SelectiveAccessDescriptor))
248
+
189
249
  self.attr_descriptor_with_selection = CosemAttributeDescriptorWithSelection
190
250
  self.buffer.selective_access = SelectiveAccessDescriptor()
191
251
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DLMS_SPODES
3
- Version: 0.87.9
3
+ Version: 0.87.11
4
4
  Summary: dlms-spodes
5
5
  Author-email: Serj Kotilevski <youserj@outlook.com>
6
6
  Project-URL: Source, https://github.com/youserj/DlmsSPODES-project
@@ -25,7 +25,7 @@ DLMS_SPODES/cosem_interface_classes/activity_calendar.py,sha256=VWSiKn2LNBA1VLAA
25
25
  DLMS_SPODES/cosem_interface_classes/arbitrator.py,sha256=S9TguoMG6O5DpMBp6mpcJpw6PHanvh4SEAN3M_v6qts,3240
26
26
  DLMS_SPODES/cosem_interface_classes/attr_indexes.py,sha256=aUSnT-dKoBsDbwLhlgtLIHGRl7PZrT-ld2ThCEUjUeA,328
27
27
  DLMS_SPODES/cosem_interface_classes/clock.py,sha256=vgRt9NcPAAlRZfDrlR11Q8o-wHz6uA0PnBUP2318WsY,4503
28
- DLMS_SPODES/cosem_interface_classes/collection.py,sha256=oDw9lL_3bX6E1YNzdZUaNyniBwj1DPegdwjt98fKw2A,98554
28
+ DLMS_SPODES/cosem_interface_classes/collection.py,sha256=79Xz_mfovgiyenUki3-97u8GwAV81IXf6zXgjwt0uDA,98526
29
29
  DLMS_SPODES/cosem_interface_classes/cosem_interface_class.py,sha256=tPHsO-AlCflQzWO3gARSHoBkn6-SW_Y_O2TTCzB1sK8,23184
30
30
  DLMS_SPODES/cosem_interface_classes/data.py,sha256=YSjA3Y0M5NMcfYzWPEuZw6ojIqr2UghgW_ck8dXySMU,809
31
31
  DLMS_SPODES/cosem_interface_classes/disconnect_control.py,sha256=CIx7I4QRpPxAC5iYxpbhCIuv6U2P3s6ELam8eD-kD5w,2926
@@ -81,7 +81,7 @@ DLMS_SPODES/cosem_interface_classes/ntp_setup/__init__.py,sha256=47DEQpj8HBSa-_T
81
81
  DLMS_SPODES/cosem_interface_classes/ntp_setup/ver0.py,sha256=1Eaf9dnqK8kFbn38Op-PxbHg1b63QwAQEY41f3ZXF2E,2044
82
82
  DLMS_SPODES/cosem_interface_classes/profile_generic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
83
83
  DLMS_SPODES/cosem_interface_classes/profile_generic/ver0.py,sha256=AhOPl9gCwWNCZ-Hvn-pG5SRg2yP1kPljnG_Uelr_BXg,4220
84
- DLMS_SPODES/cosem_interface_classes/profile_generic/ver1.py,sha256=-B8CWiWXif2bhjhepMz5iVwJFrwoT2kRBKJct1CzXws,10293
84
+ DLMS_SPODES/cosem_interface_classes/profile_generic/ver1.py,sha256=kHnPGpATAiSXxrvpFU_RpY87gYo_gbEuZk7fe8_aup4,14005
85
85
  DLMS_SPODES/cosem_interface_classes/push_setup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
86
86
  DLMS_SPODES/cosem_interface_classes/push_setup/ver0.py,sha256=JDbN0uyXM9iAWQe7JOgkz5DxibdcUQQrxPfTCII7CJ8,385
87
87
  DLMS_SPODES/cosem_interface_classes/push_setup/ver1.py,sha256=D25GXpg2uLl2nQ6eQMScFyId4ZhKdUwcU7jWUP3egG4,348
@@ -111,7 +111,7 @@ DLMS_SPODES/types/implementations/integers.py,sha256=Asy4X260t1Fzw_V5iw0uiDOxtfB
111
111
  DLMS_SPODES/types/implementations/long_unsigneds.py,sha256=SxmFvD2moQ03p-KZSBYK1Rv7bQSaywlHVXBfkTZG1OQ,8761
112
112
  DLMS_SPODES/types/implementations/octet_string.py,sha256=Jo_sfWcsfstiP4O6mXfBOOQlksx1c2qJMI-vbAOV-yM,294
113
113
  DLMS_SPODES/types/implementations/structs.py,sha256=GMOo6Jy8jA9d6KTLs0D-j5t0oSRvxUIwtBr_4UePwbA,2059
114
- dlms_spodes-0.87.9.dist-info/METADATA,sha256=1F__2P29wh7Ce_HI009tee9TQu-jcOHsFTNtF0oETqk,1108
115
- dlms_spodes-0.87.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
116
- dlms_spodes-0.87.9.dist-info/top_level.txt,sha256=k26SRuRdwBZrSM3NgNZECAUNIDZREbJuLCnPbWtTNak,12
117
- dlms_spodes-0.87.9.dist-info/RECORD,,
114
+ dlms_spodes-0.87.11.dist-info/METADATA,sha256=ZWPsltJw-8TfW6d9Kec7DSN-3Q15DEd8ehiepBv9mEk,1109
115
+ dlms_spodes-0.87.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
116
+ dlms_spodes-0.87.11.dist-info/top_level.txt,sha256=k26SRuRdwBZrSM3NgNZECAUNIDZREbJuLCnPbWtTNak,12
117
+ dlms_spodes-0.87.11.dist-info/RECORD,,