MCPcopy Create free account
hub / github.com/FreeOpcUa/python-opcua / add_encoding_field

Function add_encoding_field

schemas/generate_model.py:191–226  ·  view source on GitHub ↗
(model)

Source from the content-addressed store, hash-verified

189
190
191def add_encoding_field(model):
192 for struct in model.structs:
193 newfields = []
194 container = None
195 idx = 0
196 for field in struct.fields:
197 if field.uatype in ('UInt6', 'NodeIdType'):
198 container = field.name
199 b = Bit()
200 b.name = field.name
201 b.idx = 0
202 b.container = container
203 b.length = 6
204 idx = b.length
205 struct.bits[b.name] = b
206
207 if field.uatype == 'Bit':
208 if not container or idx > 7:
209 container = 'Encoding'
210 idx = 0
211 f = Field()
212 f.sourcetype = field.sourcetype
213 f.name = 'Encoding'
214 f.uatype = 'Byte'
215 newfields.append(f)
216
217 b = Bit()
218 b.name = field.name
219 b.idx = idx
220 b.container = container
221 b.length = field.bitlength
222 idx += field.bitlength
223 struct.bits[b.name] = b
224 else:
225 newfields.append(field)
226 struct.fields = newfields
227
228
229def remove_vector_length(model):

Callers

nothing calls this directly

Calls 2

BitClass · 0.85
FieldClass · 0.70

Tested by

no test coverage detected