DLMS-SPODES 0.86.23__py3-none-any.whl → 0.87.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.
- DLMS_SPODES/config_parser.py +2 -7
- DLMS_SPODES/cosem_interface_classes/collection.py +6 -9
- DLMS_SPODES/cosem_interface_classes/parameter.py +59 -44
- DLMS_SPODES/cosem_interface_classes/parameters.py +95 -15
- DLMS_SPODES/hdlc/frame.py +5 -9
- DLMS_SPODES/types/implementations/integers.py +5 -0
- {dlms_spodes-0.86.23.dist-info → dlms_spodes-0.87.1.dist-info}/METADATA +1 -1
- {dlms_spodes-0.86.23.dist-info → dlms_spodes-0.87.1.dist-info}/RECORD +10 -10
- {dlms_spodes-0.86.23.dist-info → dlms_spodes-0.87.1.dist-info}/WHEEL +0 -0
- {dlms_spodes-0.86.23.dist-info → dlms_spodes-0.87.1.dist-info}/top_level.txt +0 -0
DLMS_SPODES/config_parser.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import logging
|
|
2
1
|
import os
|
|
3
2
|
import tomllib
|
|
4
3
|
from typing_extensions import deprecated
|
|
@@ -6,9 +5,6 @@ from typing_extensions import deprecated
|
|
|
6
5
|
|
|
7
6
|
print("Path: ", os.getcwd())
|
|
8
7
|
|
|
9
|
-
logger = logging.getLogger(__name__)
|
|
10
|
-
logger.level = logging.INFO
|
|
11
|
-
|
|
12
8
|
|
|
13
9
|
@deprecated("use settings.settings")
|
|
14
10
|
def get_values(*args: str) -> dict | None:
|
|
@@ -20,7 +16,7 @@ def get_values(*args: str) -> dict | None:
|
|
|
20
16
|
par = par[key]
|
|
21
17
|
continue
|
|
22
18
|
except KeyError as e:
|
|
23
|
-
|
|
19
|
+
print(f"error: {e.args[0]}")
|
|
24
20
|
return None
|
|
25
21
|
return par
|
|
26
22
|
|
|
@@ -28,10 +24,9 @@ def get_values(*args: str) -> dict | None:
|
|
|
28
24
|
if not os.path.isfile(path := ".//config.toml"):
|
|
29
25
|
path = F"{os.path.dirname(__file__)}{path}"
|
|
30
26
|
elif not os.path.isfile(path):
|
|
31
|
-
|
|
27
|
+
print("NOT FIND CONFIGURATION: <config.toml>")
|
|
32
28
|
with open(path, "rb") as f:
|
|
33
29
|
config = tomllib.load(f)
|
|
34
|
-
logger.info(F"Find configuration <config.toml> with path: {f}")
|
|
35
30
|
print(F"Find configuration <config.toml> with path: {f}")
|
|
36
31
|
|
|
37
32
|
_messages = get_values("DLMS", "messages")
|
|
@@ -8,7 +8,6 @@ from dataclasses import dataclass
|
|
|
8
8
|
from itertools import count, chain
|
|
9
9
|
from functools import reduce, cached_property, lru_cache
|
|
10
10
|
from typing import TypeAlias, Iterator, Type, Self, Callable, Literal, Iterable, Optional, Hashable
|
|
11
|
-
import logging
|
|
12
11
|
from semver import Version as SemVer
|
|
13
12
|
from StructResult import result
|
|
14
13
|
from ..types import common_data_types as cdt, cosem_service_types as cst, useful_types as ut
|
|
@@ -275,8 +274,6 @@ _UNDER_OVER_LIMIT_MAGNITUDES = (34, 38)
|
|
|
275
274
|
_NOT_PROCESSING_OF_MEASUREMENT_VALUES = tuple(set(range(256)).difference((0, 93, 94, 96, 97, 98, 99))) # BlueBook DLMS UA 1000-1 Ed.14 7.5.2.1 Table 66
|
|
276
275
|
_RU_CHANGE_LIMIT_LEVEL = 134
|
|
277
276
|
|
|
278
|
-
logger = logging.getLogger(__name__)
|
|
279
|
-
logger.level = logging.INFO
|
|
280
277
|
|
|
281
278
|
|
|
282
279
|
@dataclass(frozen=True)
|
|
@@ -683,7 +680,7 @@ class Collection:
|
|
|
683
680
|
""" all DLMS objects container with obis key """
|
|
684
681
|
|
|
685
682
|
@property
|
|
686
|
-
def id(self) -> ID
|
|
683
|
+
def id(self) -> ID:
|
|
687
684
|
return self.__id
|
|
688
685
|
|
|
689
686
|
def set_id(self, value: ID):
|
|
@@ -740,7 +737,7 @@ class Collection:
|
|
|
740
737
|
value=value.encoding,
|
|
741
738
|
data_type=source.get_attr(i).__class__)
|
|
742
739
|
except exc.EmptyObj as e:
|
|
743
|
-
|
|
740
|
+
print(F"can't copy {target} attr={i}, skipped. {e}")
|
|
744
741
|
|
|
745
742
|
def copy(self) -> result.Simple["Collection"]:
|
|
746
743
|
"""copy collection with value by Association"""
|
|
@@ -898,7 +895,7 @@ class Collection:
|
|
|
898
895
|
func_map=func_maps[self.spec_map])(logical_name)
|
|
899
896
|
new_object.collection = self
|
|
900
897
|
self.__objs[o.OBIS(logical_name.contents)] = new_object
|
|
901
|
-
|
|
898
|
+
print(F'Create {new_object}')
|
|
902
899
|
return new_object
|
|
903
900
|
except ValueError as e:
|
|
904
901
|
raise ValueError(F"error getting DLMS object instance with {class_id=} {version=} {logical_name=}: {e}")
|
|
@@ -1186,7 +1183,7 @@ class Collection:
|
|
|
1186
1183
|
obj=self.get_object(obj_def.logical_name),
|
|
1187
1184
|
par=bytes([int(obj_def.attribute_index)]))
|
|
1188
1185
|
except ic.EmptyAttribute as e:
|
|
1189
|
-
|
|
1186
|
+
print(F"Can't fill Scaler and Unit for {get_name(obj_def.logical_name)}: {e}")
|
|
1190
1187
|
finally:
|
|
1191
1188
|
res.append(s_u)
|
|
1192
1189
|
return res
|
|
@@ -1495,7 +1492,7 @@ class Collection:
|
|
|
1495
1492
|
continue
|
|
1496
1493
|
indexes.append(-i)
|
|
1497
1494
|
except exc.ITEApplication as e:
|
|
1498
|
-
|
|
1495
|
+
print(F"skip {i}... methods for {obj}: {e}")
|
|
1499
1496
|
break
|
|
1500
1497
|
if len(indexes) != 0:
|
|
1501
1498
|
objects[obj] = indexes
|
|
@@ -2090,7 +2087,7 @@ class Template:
|
|
|
2090
2087
|
obj_col = col.get_object(ln)
|
|
2091
2088
|
except exc.NoObject as e:
|
|
2092
2089
|
ret.append(e)
|
|
2093
|
-
|
|
2090
|
+
print(F"<add_collection> skip obj{self}: {e}")
|
|
2094
2091
|
continue
|
|
2095
2092
|
for i in indexes:
|
|
2096
2093
|
if (attr := obj.get_attr(i)) is not None:
|
|
@@ -2,8 +2,9 @@ from typing_extensions import deprecated
|
|
|
2
2
|
from dataclasses import dataclass
|
|
3
3
|
import numpy as np
|
|
4
4
|
from struct import Struct, pack, unpack_from
|
|
5
|
-
from typing import Optional, cast, Iterator
|
|
5
|
+
from typing import Optional, cast, Iterator, Self
|
|
6
6
|
import re
|
|
7
|
+
from functools import cached_property
|
|
7
8
|
from .. import exceptions as exc
|
|
8
9
|
from .obis import OBIS
|
|
9
10
|
|
|
@@ -37,13 +38,13 @@ class Parameter:
|
|
|
37
38
|
piece OPTIONAL
|
|
38
39
|
}
|
|
39
40
|
"""
|
|
40
|
-
|
|
41
|
+
_value: bytes
|
|
41
42
|
|
|
42
43
|
def __bytes__(self) -> bytes:
|
|
43
|
-
return self.
|
|
44
|
+
return self._value
|
|
44
45
|
|
|
45
46
|
@classmethod
|
|
46
|
-
def parse(cls, value: str) ->
|
|
47
|
+
def parse(cls, value: str) -> Self:
|
|
47
48
|
"""create from string. Only LN, attr/meth type ddd.ddd.ddd.ddd.ddd.ddd:aaa, ex.: 0.0.1.0.0.255 """
|
|
48
49
|
if (res := _pattern.fullmatch(value)) is None:
|
|
49
50
|
raise ValueError(F"in {cls.__name__}.parse got wrong :{value:}")
|
|
@@ -59,25 +60,29 @@ class Parameter:
|
|
|
59
60
|
ret += (g1 + int(a)).to_bytes(2)
|
|
60
61
|
return cls(ret)
|
|
61
62
|
|
|
63
|
+
@cached_property
|
|
64
|
+
def logical_name(self) -> "Parameter":
|
|
65
|
+
return self.get_attr(2)
|
|
66
|
+
|
|
62
67
|
def __eq__(self, other) -> bool:
|
|
63
68
|
if isinstance(other, Parameter):
|
|
64
|
-
return cast("bool", self.
|
|
69
|
+
return cast("bool", self._value==other._value)
|
|
65
70
|
return NotImplemented
|
|
66
71
|
|
|
67
72
|
def __lt__(self, other: "Parameter") -> bool:
|
|
68
73
|
"""comparing for sort method"""
|
|
69
|
-
if len(self.
|
|
74
|
+
if len(self._value) > len(other._value):
|
|
70
75
|
return True
|
|
71
76
|
else:
|
|
72
77
|
return False
|
|
73
78
|
|
|
74
79
|
def __str__(self) -> str:
|
|
75
|
-
if (l := len(self.
|
|
80
|
+
if (l := len(self._value)) < 6:
|
|
76
81
|
return "No valid"
|
|
77
82
|
elif l == 7:
|
|
78
83
|
return "No valid Index"
|
|
79
84
|
else:
|
|
80
|
-
res = F"{".".join(map(str, self.
|
|
85
|
+
res = F"{".".join(map(str, self._value[:6]))}"
|
|
81
86
|
if l > 6:
|
|
82
87
|
res += F":{"m" if self.is_method() else ""}{self.i}"
|
|
83
88
|
if l > 8:
|
|
@@ -87,41 +92,51 @@ class Parameter:
|
|
|
87
92
|
return res
|
|
88
93
|
|
|
89
94
|
def validate(self) -> None:
|
|
90
|
-
if (length := len(self.
|
|
95
|
+
if (length := len(self._value)) < 6:
|
|
91
96
|
raise exc.DLMSException(F"Parameter got {length=}, expected at least 6")
|
|
92
97
|
if length == 7:
|
|
93
98
|
raise exc.DLMSException(F"Parameter got wrong index")
|
|
94
99
|
|
|
95
100
|
@property
|
|
96
101
|
def has_index(self) -> bool:
|
|
97
|
-
return len(self.
|
|
102
|
+
return len(self._value) > 6
|
|
98
103
|
|
|
99
104
|
@property
|
|
100
105
|
@deprecated("use obis")
|
|
101
106
|
def ln(self) -> bytes:
|
|
102
107
|
"""Logical Name"""
|
|
103
|
-
return self.
|
|
108
|
+
return self._value[:6]
|
|
104
109
|
|
|
105
110
|
def is_method(self) -> bool:
|
|
106
|
-
return self.
|
|
111
|
+
return self._value[6] == 1
|
|
107
112
|
|
|
108
113
|
@property
|
|
109
114
|
def i(self) -> int:
|
|
110
115
|
"""attribute or method index"""
|
|
111
|
-
return self.
|
|
116
|
+
return self._value[7]
|
|
117
|
+
|
|
118
|
+
def get_attr(self, i: int) -> "Parameter":
|
|
119
|
+
"""get attribute"""
|
|
120
|
+
val = Index.pack(0, i)
|
|
121
|
+
return self.__class__(self._value[:6] + val)
|
|
122
|
+
|
|
123
|
+
def get_meth(self, i: int) -> "Parameter":
|
|
124
|
+
"""get method"""
|
|
125
|
+
val = Index.pack(1, i)
|
|
126
|
+
return self.__class__(self._value[:6] + val)
|
|
112
127
|
|
|
113
128
|
def set_i(self, index: int, is_method: bool = False) -> "Parameter":
|
|
114
129
|
val = Index.pack(is_method, index)
|
|
115
|
-
if len(self.
|
|
116
|
-
tmp = self.
|
|
130
|
+
if len(self._value) == 6:
|
|
131
|
+
tmp = self._value + val
|
|
117
132
|
else:
|
|
118
|
-
tmp = bytearray(self.
|
|
133
|
+
tmp = bytearray(self._value)
|
|
119
134
|
tmp[6:8] = val
|
|
120
135
|
tmp = bytes(tmp)
|
|
121
136
|
return self.__class__(tmp)
|
|
122
137
|
|
|
123
138
|
def append_validate(self) -> None:
|
|
124
|
-
if (l := len(self.
|
|
139
|
+
if (l := len(self._value)) < 7:
|
|
125
140
|
raise exc.DLMSException(F"Parameter must has index before")
|
|
126
141
|
elif l % 2 != 0:
|
|
127
142
|
raise exc.DLMSException(F"Can't append to Parameter with piece")
|
|
@@ -129,11 +144,11 @@ class Parameter:
|
|
|
129
144
|
def append(self, index: int) -> "Parameter":
|
|
130
145
|
"""add new sequence(array or struct) index element"""
|
|
131
146
|
self.append_validate()
|
|
132
|
-
return self.__class__(self.
|
|
147
|
+
return self.__class__(self._value + pack(">H", index))
|
|
133
148
|
|
|
134
149
|
def extend(self, *indexes: int) -> "Parameter":
|
|
135
150
|
self.append_validate()
|
|
136
|
-
return self.__class__(self.
|
|
151
|
+
return self.__class__(self._value + pack(F">{len(indexes)}H", *indexes))
|
|
137
152
|
|
|
138
153
|
def pop(self) -> tuple[Optional[int], int, "Parameter"]:
|
|
139
154
|
"""
|
|
@@ -141,20 +156,20 @@ class Parameter:
|
|
|
141
156
|
ex.: Parameter("0.0.0.0.0.0:2 1/1/1 p3") => (1, Parameter("0.0.0.0.0.0:2 1/1"))
|
|
142
157
|
"""
|
|
143
158
|
if self.has_piece():
|
|
144
|
-
return self.
|
|
159
|
+
return self._value[-1], int.from_bytes(self._value[-3:-1]), self.__class__(self._value[:-3])
|
|
145
160
|
else:
|
|
146
|
-
return None, int.from_bytes(self.
|
|
161
|
+
return None, int.from_bytes(self._value[-2:]), self.__class__(self._value[:-2])
|
|
147
162
|
|
|
148
163
|
def set_piece(self, index: int) -> "Parameter":
|
|
149
164
|
"""add new sequence(array or struct) index element"""
|
|
150
|
-
if len(self.
|
|
151
|
-
return self.__class__(self.
|
|
165
|
+
if len(self._value) >= 7:
|
|
166
|
+
return self.__class__(self._value + pack("B", index))
|
|
152
167
|
else:
|
|
153
168
|
raise exc.DLMSException(F"Parameter must has index before")
|
|
154
169
|
|
|
155
170
|
def has_piece(self) -> bool:
|
|
156
171
|
if (
|
|
157
|
-
(l := len(self.
|
|
172
|
+
(l := len(self._value)) >= 9
|
|
158
173
|
and l % 2 != 0
|
|
159
174
|
):
|
|
160
175
|
return True
|
|
@@ -164,22 +179,22 @@ class Parameter:
|
|
|
164
179
|
@property
|
|
165
180
|
def piece(self) -> Optional[int]:
|
|
166
181
|
if self.has_piece():
|
|
167
|
-
return self.
|
|
182
|
+
return self._value[-1]
|
|
168
183
|
|
|
169
184
|
def clear_piece(self) -> "Parameter":
|
|
170
185
|
if self.has_piece():
|
|
171
|
-
return self.__class__(self.
|
|
186
|
+
return self.__class__(self._value[:-1])
|
|
172
187
|
|
|
173
188
|
def elements(self, start: int = 0) -> Iterator[int]:
|
|
174
189
|
"""return: index elements nested in attribute, started with"""
|
|
175
190
|
for i in range(8 + start, 8 + 2 * self.n_elements, 2):
|
|
176
|
-
res = int.from_bytes(self.
|
|
191
|
+
res = int.from_bytes(self._value[i:i + 2], "big")
|
|
177
192
|
yield res
|
|
178
193
|
|
|
179
194
|
def __iter__(self) -> Iterator[int]:
|
|
180
|
-
for it in self.
|
|
195
|
+
for it in self._value[:6]:
|
|
181
196
|
yield it
|
|
182
|
-
if self.
|
|
197
|
+
if self._value[6] == 1:
|
|
183
198
|
yield -self.i
|
|
184
199
|
else:
|
|
185
200
|
yield self.i
|
|
@@ -190,15 +205,15 @@ class Parameter:
|
|
|
190
205
|
if self.n_elements == 0:
|
|
191
206
|
raise ValueError("Parameter hasn't elements")
|
|
192
207
|
if self.has_piece():
|
|
193
|
-
val = self.
|
|
208
|
+
val = self._value[-3: -1]
|
|
194
209
|
else:
|
|
195
|
-
val = self.
|
|
210
|
+
val = self._value[-2:]
|
|
196
211
|
return int.from_bytes(val, "big")
|
|
197
212
|
|
|
198
213
|
@property
|
|
199
214
|
def n_elements(self) -> int:
|
|
200
215
|
"""return: amount of elements nested in attribute"""
|
|
201
|
-
return max(0, (len(self.
|
|
216
|
+
return max(0, (len(self._value) - 8) // 2)
|
|
202
217
|
|
|
203
218
|
def set(self,
|
|
204
219
|
a: int = None,
|
|
@@ -208,7 +223,7 @@ class Parameter:
|
|
|
208
223
|
e: int = None,
|
|
209
224
|
f: int = None
|
|
210
225
|
) -> "Parameter":
|
|
211
|
-
val = bytearray(self.
|
|
226
|
+
val = bytearray(self._value)
|
|
212
227
|
if a is not None:
|
|
213
228
|
val[0] = a
|
|
214
229
|
if b is not None:
|
|
@@ -224,52 +239,52 @@ class Parameter:
|
|
|
224
239
|
return self.__class__(bytes(val))
|
|
225
240
|
|
|
226
241
|
def __contains__(self, item: "Parameter"):
|
|
227
|
-
return item.
|
|
242
|
+
return item._value in self._value
|
|
228
243
|
|
|
229
244
|
def __getitem__(self, item) -> Optional[int]:
|
|
230
245
|
if self.n_elements > 0:
|
|
231
|
-
return unpack_from(">H", self.
|
|
246
|
+
return unpack_from(">H", self._value, item * 2 + 8)[0]
|
|
232
247
|
else:
|
|
233
248
|
return None
|
|
234
249
|
|
|
235
250
|
@property
|
|
236
251
|
def a(self) -> int:
|
|
237
|
-
return self.
|
|
252
|
+
return self._value[0]
|
|
238
253
|
|
|
239
254
|
@property
|
|
240
255
|
def b(self) -> int:
|
|
241
|
-
return self.
|
|
256
|
+
return self._value[1]
|
|
242
257
|
|
|
243
258
|
@property
|
|
244
259
|
def c(self) -> int:
|
|
245
|
-
return self.
|
|
260
|
+
return self._value[2]
|
|
246
261
|
|
|
247
262
|
@property
|
|
248
263
|
def d(self) -> int:
|
|
249
|
-
return self.
|
|
264
|
+
return self._value[3]
|
|
250
265
|
|
|
251
266
|
@property
|
|
252
267
|
def e(self) -> int:
|
|
253
|
-
return self.
|
|
268
|
+
return self._value[4]
|
|
254
269
|
|
|
255
270
|
@property
|
|
256
271
|
def f(self) -> int:
|
|
257
|
-
return self.
|
|
272
|
+
return self._value[5]
|
|
258
273
|
|
|
259
274
|
@property
|
|
260
275
|
def attr(self) -> "Parameter":
|
|
261
276
|
if self.has_index:
|
|
262
|
-
return Parameter(self.
|
|
277
|
+
return Parameter(self._value[:8])
|
|
263
278
|
else:
|
|
264
279
|
raise exc.DLMSException(F"Parameter must has index before")
|
|
265
280
|
|
|
266
281
|
@property
|
|
267
282
|
def obj(self) -> "Parameter":
|
|
268
|
-
return Parameter(self.
|
|
283
|
+
return Parameter(self._value[:6])
|
|
269
284
|
|
|
270
285
|
@property
|
|
271
286
|
def obis(self) -> OBIS:
|
|
272
|
-
return OBIS(self.
|
|
287
|
+
return OBIS(self._value[:6])
|
|
273
288
|
|
|
274
289
|
|
|
275
290
|
RANGE64 = bytes(range(65)) # Предвычисленный диапазон 0-64
|
|
@@ -1,26 +1,106 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from functools import cached_property
|
|
3
|
+
from typing import Self
|
|
3
4
|
from .parameter import Parameter
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
@dataclass
|
|
7
|
-
class
|
|
8
|
-
|
|
7
|
+
@dataclass(frozen=True)
|
|
8
|
+
class Data(Parameter):
|
|
9
|
+
@property
|
|
10
|
+
def value(self) -> Parameter:
|
|
11
|
+
return self.get_attr(2)
|
|
9
12
|
|
|
10
|
-
@cached_property
|
|
11
|
-
def LN(self) -> Parameter:
|
|
12
|
-
return self.OBIS.set_i(1)
|
|
13
13
|
|
|
14
|
+
class ActiveFirmwareIdentifier(Data):
|
|
15
|
+
def from_b(self, b: int) -> "ActiveFirmwareIdentifier":
|
|
16
|
+
return cls.parse(f"0.{b}.0.2.0.255")
|
|
14
17
|
|
|
15
|
-
@dataclass
|
|
16
|
-
class Data(Base):
|
|
17
|
-
@cached_property
|
|
18
|
-
def VALUE(self) -> Parameter:
|
|
19
|
-
return self.OBIS.set_i(2)
|
|
20
18
|
|
|
19
|
+
ACTIVE_FIRMWARE_IDENTIFIER_0 = ActiveFirmwareIdentifier.from_b(0)
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
|
|
22
|
+
@dataclass(frozen=True)
|
|
23
23
|
class Register(Data):
|
|
24
|
-
@
|
|
25
|
-
def
|
|
26
|
-
return self.
|
|
24
|
+
@property
|
|
25
|
+
def scaler_unit(self) -> Parameter:
|
|
26
|
+
return self.get_attr(3)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@dataclass(frozen=True)
|
|
30
|
+
class DisconnectControl(Parameter):
|
|
31
|
+
|
|
32
|
+
@classmethod
|
|
33
|
+
def from_b(cls, b: int) -> "DisconnectControl":
|
|
34
|
+
return cls.parse(f"0.{b}.96.3.10.255")
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def output_state(self) -> "DisconnectControl":
|
|
38
|
+
return self.get_attr(2)
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def control_state(self) -> "DisconnectControl":
|
|
42
|
+
return self.get_attr(3)
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def control_mode(self) -> "DisconnectControl":
|
|
46
|
+
return self.get_attr(4)
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def remote_disconnect(self) -> "DisconnectControl":
|
|
50
|
+
return self.get_meth(1)
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def remote_reconnect(self) -> "DisconnectControl":
|
|
54
|
+
return self.get_meth(2)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
DISCONNECT_CONTROL_0 = DisconnectControl.from_b(0)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclass(frozen=True)
|
|
61
|
+
class ImageTransfer(Parameter):
|
|
62
|
+
@classmethod
|
|
63
|
+
def from_e(cls, e: int = 0) -> "ImageTransfer":
|
|
64
|
+
return cls.parse(f"0.0.44.0.{e}.255")
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def image_block_size(self) -> "ImageTransfer":
|
|
68
|
+
return self.get_attr(2)
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def image_transferred_blocks_status(self) -> "ImageTransfer":
|
|
72
|
+
return self.get_attr(3)
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def image_first_not_transferred_block_number(self) -> "ImageTransfer":
|
|
76
|
+
return self.get_attr(4)
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def image_transfer_enabled(self) -> "ImageTransfer":
|
|
80
|
+
return self.get_attr(5)
|
|
81
|
+
|
|
82
|
+
@property
|
|
83
|
+
def image_transfer_status(self) -> "ImageTransfer":
|
|
84
|
+
return self.get_attr(6)
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def image_to_activate_info(self) -> "ImageTransfer":
|
|
88
|
+
return self.get_attr(7)
|
|
89
|
+
|
|
90
|
+
@property
|
|
91
|
+
def image_transfer_initiate(self) -> "ImageTransfer":
|
|
92
|
+
return self.get_meth(1)
|
|
93
|
+
|
|
94
|
+
@property
|
|
95
|
+
def image_block_transfer(self) -> "ImageTransfer":
|
|
96
|
+
return self.get_meth(2)
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
def image_verify(self) -> "ImageTransfer":
|
|
100
|
+
return self.get_meth(3)
|
|
101
|
+
|
|
102
|
+
@property
|
|
103
|
+
def image_activate(self) -> "ImageTransfer":
|
|
104
|
+
return self.get_meth(4)
|
|
105
|
+
|
|
106
|
+
|
DLMS_SPODES/hdlc/frame.py
CHANGED
|
@@ -4,10 +4,6 @@ from struct import unpack, pack
|
|
|
4
4
|
from functools import cached_property
|
|
5
5
|
from typing import Deque
|
|
6
6
|
from enum import IntFlag
|
|
7
|
-
import logging
|
|
8
|
-
|
|
9
|
-
logger = logging.getLogger(__name__)
|
|
10
|
-
logger.level = logging.INFO
|
|
11
7
|
|
|
12
8
|
_FLAG: int = 0x7e
|
|
13
9
|
|
|
@@ -750,13 +746,13 @@ class Frame:
|
|
|
750
746
|
try:
|
|
751
747
|
return cls(value)
|
|
752
748
|
except ValueError as e:
|
|
753
|
-
|
|
749
|
+
print(F'Wrong Frame: {e.args[0]}')
|
|
754
750
|
return None
|
|
755
751
|
except NotEnoughDataError as e:
|
|
756
|
-
|
|
752
|
+
print(F'Frame Error: {e.args[0]}')
|
|
757
753
|
return None
|
|
758
754
|
except FormatDataError as e:
|
|
759
|
-
|
|
755
|
+
print(F'Frame Error: {e.args[0]}')
|
|
760
756
|
value.pop(0)
|
|
761
757
|
return None
|
|
762
758
|
|
|
@@ -819,7 +815,7 @@ class Frame:
|
|
|
819
815
|
info: bytearray = bytearray(frame.info)
|
|
820
816
|
break
|
|
821
817
|
else:
|
|
822
|
-
|
|
818
|
+
print(F'Frame {frame} not handled and deleted')
|
|
823
819
|
else:
|
|
824
820
|
raise ValueError('Not found information Frame')
|
|
825
821
|
while frame.is_segmentation:
|
|
@@ -831,7 +827,7 @@ class Frame:
|
|
|
831
827
|
info.extend(next_frame.info)
|
|
832
828
|
frame = next_frame
|
|
833
829
|
else:
|
|
834
|
-
|
|
830
|
+
print(F'Frame {frame} not handled and deleted')
|
|
835
831
|
return info
|
|
836
832
|
|
|
837
833
|
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"""all realisation cdt.Integer subclasses"""
|
|
2
2
|
from ...types import common_data_types as cdt
|
|
3
|
+
from typing_extensions import deprecated
|
|
3
4
|
|
|
4
5
|
|
|
6
|
+
@deprecated("use INTEGER_0")
|
|
5
7
|
class Only0(cdt.Integer, value=0):
|
|
6
8
|
""" Limited Integer only 0 """
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
INTEGER_0 = cdt.Integer(0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
DLMS_SPODES/__init__.py,sha256=ljG8hmg21VAlVu9pwe0KZb7nf7XSEdxsGQoVdKEKs8o,183
|
|
2
2
|
DLMS_SPODES/configEN.ini,sha256=HaXwMoIjiUjl-7jZWTjK2M-YuKLpOkEbRJhQyqyBafo,4001
|
|
3
|
-
DLMS_SPODES/config_parser.py,sha256=
|
|
3
|
+
DLMS_SPODES/config_parser.py,sha256=DaRv2qia2pMjDanqecyTSf1lDz4U83FX0KYegXQCndw,1537
|
|
4
4
|
DLMS_SPODES/cosem_pdu.py,sha256=2Lor-jKDSZG7Xzphi2QB174Ng7HKz8AAQTklPyCqWew,2408
|
|
5
5
|
DLMS_SPODES/enums.py,sha256=13BE0owOyJBNlOI4NY1d-kpqVoHF7JPR9brkPKHLERE,17789
|
|
6
6
|
DLMS_SPODES/exceptions.py,sha256=UBZRQlQIRi1CzRxWTeqX5PVNuFS770f77BAizQ99IDU,3006
|
|
@@ -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=9OJwRGrbFPws_VZPayHv-hzFJegIcjgoJoenIqofd5w,4525
|
|
28
|
-
DLMS_SPODES/cosem_interface_classes/collection.py,sha256=
|
|
28
|
+
DLMS_SPODES/cosem_interface_classes/collection.py,sha256=3ivTtIv2dCanGsXqBbvcuoNqRm211S523DeZvN9dwuU,96317
|
|
29
29
|
DLMS_SPODES/cosem_interface_classes/cosem_interface_class.py,sha256=SIME0IC1XyX9RSsfxt0cbghN7rCyWzjqCbesQEpTCM8,23347
|
|
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
|
|
@@ -37,8 +37,8 @@ DLMS_SPODES/cosem_interface_classes/limiter.py,sha256=LDVoix4L2yq4yPxbfSv6zoyA5p
|
|
|
37
37
|
DLMS_SPODES/cosem_interface_classes/ln_pattern.py,sha256=IPluhyGWJQLBEUjOjdfEMct8JP_4orUwF92c3sQfSNM,13921
|
|
38
38
|
DLMS_SPODES/cosem_interface_classes/obis.py,sha256=yEwYm5CshJx8X8uSy3QH8XIbdVPg8Tt6zPUjFgkAB0M,575
|
|
39
39
|
DLMS_SPODES/cosem_interface_classes/overview.py,sha256=0eko1CW0eH397J5kM20G7RSQUzCGV6lGCMPbLsKPEqQ,7146
|
|
40
|
-
DLMS_SPODES/cosem_interface_classes/parameter.py,sha256=
|
|
41
|
-
DLMS_SPODES/cosem_interface_classes/parameters.py,sha256=
|
|
40
|
+
DLMS_SPODES/cosem_interface_classes/parameter.py,sha256=Z2JyG8C4Wr7u8SV1zmE4BVaxt_pnR84k3C39CzjRWsc,18768
|
|
41
|
+
DLMS_SPODES/cosem_interface_classes/parameters.py,sha256=6SHILIH-GvVA4p3TziyPbF59w771C8ru4vNh0TgC7WY,2659
|
|
42
42
|
DLMS_SPODES/cosem_interface_classes/register.py,sha256=Cfikftpo1Nzg_B2drOmJDwoGkbS2wXlqQpxVgXL1w2U,1886
|
|
43
43
|
DLMS_SPODES/cosem_interface_classes/register_monitor.py,sha256=fNM-JrjHxQB8b5DgUOtDcnkO_hxu5bFICiuKEoZa37g,1792
|
|
44
44
|
DLMS_SPODES/cosem_interface_classes/reports.py,sha256=9kOt9Ztyp5D59j3k3x5URy7WD1qlFNMa8xFlMu7nUmA,3320
|
|
@@ -93,7 +93,7 @@ DLMS_SPODES/cosem_interface_classes/security_setup/ver0.py,sha256=INRPYsWdVKOngm
|
|
|
93
93
|
DLMS_SPODES/cosem_interface_classes/security_setup/ver1.py,sha256=Xs8aSme9Qu4ekT9E4FQrapdxP7yS2B6pE8SKDQaFDtk,4956
|
|
94
94
|
DLMS_SPODES/cosem_interface_classes/security_setup/__pycache__/__init__.cpython-311.pyc,sha256=1ZbhthOjr77pX0c1vW5wX8q9pGvIcz_kAKr6ZemvpSA,210
|
|
95
95
|
DLMS_SPODES/hdlc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
96
|
-
DLMS_SPODES/hdlc/frame.py,sha256=
|
|
96
|
+
DLMS_SPODES/hdlc/frame.py,sha256=ar5DvkPK5tUGSZcQYCpeku1Ansx7QecugvmcV-xekqI,34784
|
|
97
97
|
DLMS_SPODES/hdlc/sub_layer.py,sha256=zTxe5ddTt8tliFSY145HhluLwIh57gvOG19Mc8-vnEM,2147
|
|
98
98
|
DLMS_SPODES/obis/__init__.py,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
99
99
|
DLMS_SPODES/obis/abstract_objects.py,sha256=0ZoJKRQ_7FoChC2rNSgNV573hso8JYZQKdLF3Wgaoqw,443
|
|
@@ -108,11 +108,11 @@ DLMS_SPODES/types/implementations/arrays.py,sha256=xdx_o3TZw6JN2BABlhuzIByhxbI1-
|
|
|
108
108
|
DLMS_SPODES/types/implementations/bitstrings.py,sha256=cOCD3ftajdAwK_m7m-ELdY0hvMPNADKhgJLFFKCoxvk,3651
|
|
109
109
|
DLMS_SPODES/types/implementations/double_long_usingneds.py,sha256=zwemISdpQUzov9TxH9t4wYFBTo0SnPd2sdDksJ0wb-I,1232
|
|
110
110
|
DLMS_SPODES/types/implementations/enums.py,sha256=58HcMxuwXY-MKjiBpY4lAOpdEHD3LLWBye8vidNz6JQ,2022
|
|
111
|
-
DLMS_SPODES/types/implementations/integers.py,sha256=
|
|
111
|
+
DLMS_SPODES/types/implementations/integers.py,sha256=Asy4X260t1Fzw_V5iw0uiDOxtfBKFzZQu0xmyJvvKj4,273
|
|
112
112
|
DLMS_SPODES/types/implementations/long_unsigneds.py,sha256=SxmFvD2moQ03p-KZSBYK1Rv7bQSaywlHVXBfkTZG1OQ,8761
|
|
113
113
|
DLMS_SPODES/types/implementations/octet_string.py,sha256=Jo_sfWcsfstiP4O6mXfBOOQlksx1c2qJMI-vbAOV-yM,294
|
|
114
114
|
DLMS_SPODES/types/implementations/structs.py,sha256=GMOo6Jy8jA9d6KTLs0D-j5t0oSRvxUIwtBr_4UePwbA,2059
|
|
115
|
-
dlms_spodes-0.
|
|
116
|
-
dlms_spodes-0.
|
|
117
|
-
dlms_spodes-0.
|
|
118
|
-
dlms_spodes-0.
|
|
115
|
+
dlms_spodes-0.87.1.dist-info/METADATA,sha256=UVqbolSEwW-zj22r13K3sbP6rlpol-IOietflFPZhII,1027
|
|
116
|
+
dlms_spodes-0.87.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
117
|
+
dlms_spodes-0.87.1.dist-info/top_level.txt,sha256=k26SRuRdwBZrSM3NgNZECAUNIDZREbJuLCnPbWtTNak,12
|
|
118
|
+
dlms_spodes-0.87.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|