ChimeraTK-ControlSystemAdapter-OPCUAAdapter  04.00.01
ua_builtin_types.py
Go to the documentation of this file.
1 #!/usr/bin/env/python
2 # -*- coding: utf-8 -*-
3 
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 
8 
9 
23 
24 import sys
25 import xml.dom.minidom as dom
26 from ua_constants import *
27 import logging
28 from time import strftime, strptime
29 from open62541_MacroHelper import open62541_MacroHelper
30 
31 logger = logging.getLogger(__name__)
32 
33 def getNextElementNode(xmlvalue):
34  if xmlvalue == None:
35  return None
36  xmlvalue = xmlvalue.nextSibling
37  while not xmlvalue == None and not xmlvalue.nodeType == xmlvalue.ELEMENT_NODE:
38  xmlvalue = xmlvalue.nextSibling
39  return xmlvalue
40 
41 if sys.version_info[0] >= 3:
42  # strings are already parsed to unicode
43  def unicode(s):
44  return s
45 
46 class opcua_value_t():
47  value = None
48  name = None
49  __alias__ = None
50  __binTypeId__ = 0
51  stringRepresentation = ""
52  knownTypes = []
53  parent = None
54 
55  def __init__(self, parent):
56  self.value = None
57  self.parent = parent
60  self.__binTypeId__ = 0
62  self.__alias__ = None
63  self.knownTypes = ['boolean', 'int32', 'uint32', 'int16', 'uint16', \
64  'int64', 'uint64', 'byte', 'sbyte', 'float', 'double', \
65  'string', 'bytestring', 'localizedtext', 'statuscode', \
66  'diagnosticinfo', 'nodeid', 'guid', 'datetime', \
67  'qualifiedname', 'expandednodeid', 'xmlelement']
68  self.dataType = None
69  self.encodingRule = []
70 
71  def getValueFieldByAlias(self, fieldname):
72  if not isinstance(self.value, list):
73  return None
74  if not isinstance(self.value[0], opcua_value_t):
75  return None
76  for val in self.value:
77  if val.alias() == fieldname:
78  return val.value
79  return None
80 
81  def setEncodingRule(self, encoding):
82  self.encodingRule = encoding
83 
84  def getEncodingRule(self):
85  return self.encodingRule
86 
87  def alias(self, data=None):
88  if not data == None:
89  self.__alias__ = data
90  return self.__alias__
91 
92  def isBuiltinByString(self, string):
93  if str(string).lower() in self.knownTypes:
94  return True
95  return False
96 
97  def value(self, data=None):
98  if not data==None:
99  self.__value__ = data
100  return self.__value__
101 
102  def getTypeByString(self, stringName, encodingRule):
103  stringName = str(stringName.lower())
104  if stringName == 'boolean':
106  t.setEncodingRule(encodingRule)
107  elif stringName == 'int32':
109  t.setEncodingRule(encodingRule)
110  elif stringName == 'uint32':
112  t.setEncodingRule(encodingRule)
113  elif stringName == 'int16':
115  t.setEncodingRule(encodingRule)
116  elif stringName == 'uint16':
118  t.setEncodingRule(encodingRule)
119  elif stringName == 'int64':
121  t.setEncodingRule(encodingRule)
122  elif stringName == 'uint64':
124  t.setEncodingRule(encodingRule)
125  elif stringName == 'byte':
127  t.setEncodingRule(encodingRule)
128  elif stringName == 'sbyte':
130  t.setEncodingRule(encodingRule)
131  elif stringName == 'float':
133  t.setEncodingRule(encodingRule)
134  elif stringName == 'double':
136  t.setEncodingRule(encodingRule)
137  elif stringName == 'string':
139  t.setEncodingRule(encodingRule)
140  elif stringName == 'bytestring':
142  t.setEncodingRule(encodingRule)
143  elif stringName == 'localizedtext':
145  t.setEncodingRule(encodingRule)
146  elif stringName == 'statuscode':
148  t.setEncodingRule(encodingRule)
149  elif stringName == 'diagnosticinfo':
151  t.setEncodingRule(encodingRule)
152  elif stringName == 'nodeid':
154  t.setEncodingRule(encodingRule)
155  elif stringName == 'guid':
157  t.setEncodingRule(encodingRule)
158  elif stringName == 'datetime':
160  t.setEncodingRule(encodingRule)
161  elif stringName == 'qualifiedname':
163  t.setEncodingRule(encodingRule)
164  elif stringName == 'expandednodeid':
166  t.setEncodingRule(encodingRule)
167  elif stringName == 'xmlelement':
169  t.setEncodingRule(encodingRule)
170  else:
171  logger.debug("No class representing stringName " + stringName + " was found. Cannot create builtinType.")
172  return None
173  return t
174 
175  def parseXML(self, xmlvalue):
176  logger.debug("parsing xmlvalue for " + self.parent.browseName() + " (" + str(self.parent.id()) + ") according to " + str(self.parent.dataType().target().getEncoding()))
177 
178  if not "value" in xmlvalue.tagName.lower():
179  logger.error("Expected <Value> , but found " + xmlvalue.tagName + " instead. Value will not be parsed.")
180  return
181 
182  if len(xmlvalue.childNodes) == 0:
183  logger.error("Expected childnodes for value, but none where found... Value will not be parsed.")
184  return
185 
186  for n in xmlvalue.childNodes:
187  if n.nodeType == n.ELEMENT_NODE:
188  xmlvalue = n
189  break
190 
191  if "ListOf" in xmlvalue.tagName:
192  self.value = []
193  for el in xmlvalue.childNodes:
194  if not el.nodeType == el.ELEMENT_NODE:
195  continue
196  self.value.append(self.__parseXMLSingleValue(el))
197  else:
198  self.value = [self.__parseXMLSingleValue(xmlvalue)]
199 
200  logger.debug( "Parsed Value: " + str(self.value))
201 
202  def __parseXMLSingleValue(self, xmlvalue, alias=None, encodingPart=None):
203  # Parse an encoding list such as enc = [[Int32], ['Duration', ['DateTime']]],
204  # returning a possibly aliased variable or list of variables.
205  # Keep track of aliases, as ['Duration', ['Hawaii', ['UtcTime', ['DateTime']]]]
206  # will be of type DateTime, but tagged as <Duration>2013-04-10 12:00 UTC</Duration>,
207  # and not as <Duration><Hawaii><UtcTime><String>2013-04-10 12:00 UTC</String>...
208 
209  # Encoding may be partially handed down (iterative call). Only resort to
210  # type definition if we are not given a specific encoding to match
211  if encodingPart == None:
212  enc = self.parent.dataType().target().getEncoding()
213  else:
214  enc = encodingPart
215 
216  # Check the structure of the encoding list to determine if a type is to be
217  # returned or we need to descend further checking aliases or multipart types
218  # such as extension Objects.
219  if len(enc) == 1:
220  # 0: ['BuiltinType'] either builtin type
221  # 1: [ [ 'Alias', [...], n] ] or single alias for possible multipart
222  if isinstance(enc[0], str):
223  # 0: 'BuiltinType'
224  if alias != None:
225  if not xmlvalue.tagName == alias:
226  logger.error("Expected XML element with tag " + alias + " but found " + xmlvalue.tagName + " instead")
227  return None
228  else:
229  t = self.getTypeByString(enc[0], enc)
230  t.alias(alias)
231  t.parseXML(xmlvalue)
232  return t
233  else:
234  if not self.isBuiltinByString(xmlvalue.tagName):
235  logger.error("Expected XML describing builtin type " + enc[0] + " but found " + xmlvalue.tagName + " instead")
236  else:
237  t = self.getTypeByString(enc[0], enc)
238  t.parseXML(xmlvalue)
239  return t
240  else:
241  # 1: ['Alias', [...], n]
242  # Let the next elif handle this
243  return self.__parseXMLSingleValue(xmlvalue, alias=alias, encodingPart=enc[0])
244  elif len(enc) == 3 and isinstance(enc[0], str):
245  # [ 'Alias', [...], 0 ] aliased multipart
246  if alias == None:
247  alias = enc[0]
248  # if we have an alias and the next field is multipart, keep the alias
249  elif alias != None and len(enc[1]) > 1:
250  alias = enc[0]
251  # otherwise drop the alias
252  return self.__parseXMLSingleValue(xmlvalue, alias=alias, encodingPart=enc[1])
253  else:
254  # [ [...], [...], [...]] multifield of unknowns (analyse separately)
255  # create an extension object to hold multipart type
256 
257  # FIXME: This implementation expects an extensionobject to be manditory for
258  # multipart variables. Variants/Structures are not included in the
259  # OPCUA Namespace 0 nodeset.
260  # Consider moving this ExtensionObject specific parsing into the
261  # builtin type and only determining the multipart type at this stage.
262  if not xmlvalue.tagName == "ExtensionObject":
263  logger.error("Expected XML tag <ExtensionObject> for multipart type, but found " + xmlvalue.tagName + " instead.")
264  return None
265 
267  extobj.setEncodingRule(enc)
268  etype = xmlvalue.getElementsByTagName("TypeId")
269  if len(etype) == 0:
270  logger.error("Did not find <TypeId> for ExtensionObject")
271  return None
272  etype = etype[0].getElementsByTagName("Identifier")
273  if len(etype) == 0:
274  logger.error("Did not find <Identifier> for ExtensionObject")
275  return None
276  etype = self.parent.getNamespace().getNodeByIDString(etype[0].firstChild.data)
277  if etype == None:
278  logger.error("Identifier Node not found in namespace" )
279  return None
280 
281  extobj.typeId(etype)
282 
283  ebody = xmlvalue.getElementsByTagName("Body")
284  if len(ebody) == 0:
285  logger.error("Did not find <Body> for ExtensionObject")
286  return None
287  ebody = ebody[0]
288 
289  # Body must contain an Object of type 'DataType' as defined in Variable
290  ebodypart = ebody.firstChild
291  if not ebodypart.nodeType == ebodypart.ELEMENT_NODE:
292  ebodypart = getNextElementNode(ebodypart)
293  if ebodypart == None:
294  logger.error("Expected ExtensionObject to hold a variable of type " + str(self.parent.dataType().target().browseName()) + " but found nothing.")
295  return None
296 
297  if not ebodypart.tagName == self.parent.dataType().target().browseName():
298  logger.error("Expected ExtensionObject to hold a variable of type " + str(self.parent.dataType().target().browseName()) + " but found " + str(ebodypart.tagName) + " instead.")
299  return None
300  extobj.alias(ebodypart.tagName)
301 
302  ebodypart = ebodypart.firstChild
303  if not ebodypart.nodeType == ebodypart.ELEMENT_NODE:
304  ebodypart = getNextElementNode(ebodypart)
305  if ebodypart == None:
306  logger.error("Description of dataType " + str(self.parent.dataType().target().browseName()) + " in ExtensionObject is empty/invalid.")
307  return None
308 
309  extobj.value = []
310  for e in enc:
311  if not ebodypart == None:
312  extobj.value.append(extobj.__parseXMLSingleValue(ebodypart, alias=None, encodingPart=e))
313  else:
314  logger.error("Expected encoding " + str(e) + " but found none in body.")
315  ebodypart = getNextElementNode(ebodypart)
316  return extobj
317 
319  pass
320 
322  pass
323 
325  return self.__binTypeId__
326 
327  def __str__(self):
328  if self.__alias__ != None:
329  return "'" + self.alias() + "':" + self.stringRepresentation + "(" + str(self.value) + ")"
330  return self.stringRepresentation + "(" + str(self.value) + ")"
331 
332  def __repr__(self):
333  return self.__str__()
334 
335  def printOpen62541CCode_SubType(self, asIndirect=True):
336  return ""
337 
338  def printOpen62541CCode(self, bootstrapping = True):
339  codegen = open62541_MacroHelper()
340  code = []
341  valueName = self.parent.getCodePrintableID() + "_variant_DataContents"
342 
343  # self.value either contains a list of multiple identical BUILTINTYPES, or it
344  # contains a single builtintype (which may be a container); choose if we need
345  # to create an array or a single variable.
346  # Note that some genious defined that there are arrays of size 1, which are
347  # distinctly different then a single value, so we need to check that as well
348  # Semantics:
349  # -3: Scalar or 1-dim
350  # -2: Scalar or x-dim | x>0
351  # -1: Scalar
352  # 0: x-dim | x>0
353  # n: n-dim | n>0
354  if (len(self.value) == 0):
355  return code
356  if not isinstance(self.value[0], opcua_value_t):
357  return code
358 
359  if self.parent.valueRank() != -1 and (self.parent.valueRank() >=0 or (len(self.value) > 1 and (self.parent.valueRank() != -2 or self.parent.valueRank() != -3))):
360  # User the following strategy for all directly mappable values a la 'UA_Type MyInt = (UA_Type) 23;'
361  if self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_GUID:
362  logger.warn("Don't know how to print array of GUID in node " + str(self.parent.id()))
363  elif self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_DATETIME:
364  logger.warn("Don't know how to print array of DateTime in node " + str(self.parent.id()))
365  elif self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_DIAGNOSTICINFO:
366  logger.warn("Don't know how to print array of DiagnosticInfo in node " + str(self.parent.id()))
367  elif self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_STATUSCODE:
368  logger.warn("Don't know how to print array of StatusCode in node " + str(self.parent.id()))
369  else:
370  if self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_EXTENSIONOBJECT:
371  for v in self.value:
372  logger.debug("Building extObj array index " + str(self.value.index(v)))
373  code = code + v.printOpen62541CCode_SubType_build(arrayIndex=self.value.index(v))
374  #code.append("attr.value.type = &UA_TYPES[UA_TYPES_" + self.value[0].stringRepresentation.upper() + "];")
375  code.append("UA_" + self.value[0].stringRepresentation + " " + valueName + "[" + str(len(self.value)) + "];")
376  if self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_EXTENSIONOBJECT:
377  for v in self.value:
378  logger.debug("Printing extObj array index " + str(self.value.index(v)))
379  code.append(valueName + "[" + str(self.value.index(v)) + "] = " + v.printOpen62541CCode_SubType(asIndirect=False) + ";")
380  code.append("UA_free(" + v.printOpen62541CCode_SubType() + ");")
381  else:
382  for v in self.value:
383  code.append(valueName + "[" + str(self.value.index(v)) + "] = " + v.printOpen62541CCode_SubType() + ";")
384  code.append("UA_Variant_setArray( &attr.value, &" + valueName +
385  ", (UA_Int32) " + str(len(self.value)) + ", &UA_TYPES[UA_TYPES_" + self.value[0].stringRepresentation.upper() + "]);")
386  else:
387  # User the following strategy for all directly mappable values a la 'UA_Type MyInt = (UA_Type) 23;'
388  if self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_GUID:
389  logger.warn("Don't know how to print scalar GUID in node " + str(self.parent.id()))
390  elif self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_DATETIME:
391  logger.warn("Don't know how to print scalar DateTime in node " + str(self.parent.id()))
392  elif self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_DIAGNOSTICINFO:
393  logger.warn("Don't know how to print scalar DiagnosticInfo in node " + str(self.parent.id()))
394  elif self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_STATUSCODE:
395  logger.warn("Don't know how to print scalar StatusCode in node " + str(self.parent.id()))
396  else:
397  # The following strategy applies to all other types, in particular strings and numerics.
398  if self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_EXTENSIONOBJECT:
399  code = code + self.value[0].printOpen62541CCode_SubType_build()
400  #code.append("attr.value.type = &UA_TYPES[UA_TYPES_" + self.value[0].stringRepresentation.upper() + "];")
401  if self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_EXTENSIONOBJECT:
402  code.append("UA_" + self.value[0].stringRepresentation + " *" + valueName + " = " + self.value[0].printOpen62541CCode_SubType() + ";")
403  code.append("UA_Variant_setScalar( &attr.value, " + valueName + ", &UA_TYPES[UA_TYPES_" + self.value[0].stringRepresentation.upper() + "]);")
404 
405  #FIXME: There is no membership definition for extensionObjects generated in this function.
406  #code.append("UA_" + self.value[0].stringRepresentation + "_deleteMembers(" + valueName + ");")
407  else:
408  if bootstrapping == True:
409  code.append("UA_Variant* " + self.parent.getCodePrintableID() + "_variant = UA_Variant_new();" )
410  code.append("UA_" + self.value[0].stringRepresentation + " *" + valueName + " = UA_" + self.value[0].stringRepresentation + "_new();")
411  code.append("*" + valueName + " = " + self.value[0].printOpen62541CCode_SubType() + ";")
412  if bootstrapping == False:
413  code.append("UA_Variant_setScalar( &attr.value, " + valueName + ", &UA_TYPES[UA_TYPES_" + self.value[0].stringRepresentation.upper() + "]);")
414  else:
415  code.append("UA_Variant_setScalar( "+self.parent.getCodePrintableID()+"_variant, " + valueName + ", &UA_TYPES[UA_TYPES_" + self.value[0].stringRepresentation.upper() + "]);")
416  #code.append("UA_" + self.value[0].stringRepresentation + "_deleteMembers(" + valueName + ");")
417  return code
418 
419 
420 
423 
426  self.stringRepresentation = "ExtensionObject"
427  self.__typeId__ = None
428 
430  self.__binTypeId__ = BUILTINTYPE_TYPEID_EXTENSIONOBJECT
431 
432  def typeId(self, data=None):
433  if not data == None:
434  self.__typeId__ = data
435  return self.__typeId__
436 
438  return self.__codeInstanceName__
439 
440  def setCodeInstanceName(self, recursionDepth, arrayIndex):
441  self.__inVariableRecursionDepth__ = recursionDepth
442  self.__inVariableArrayIndex__ = arrayIndex
443  self.__codeInstanceName__ = self.parent.getCodePrintableID() + "_" + str(self.alias()) + "_" + str(arrayIndex) + "_" + str(recursionDepth)
444  return self.__codeInstanceName__
445 
446  def printOpen62541CCode_SubType_build(self, recursionDepth=0, arrayIndex=0):
447  code = [""]
448  codegen = open62541_MacroHelper();
449 
450  logger.debug("Building extensionObject for " + str(self.parent.id()))
451  logger.debug("Value " + str(self.value))
452  logger.debug("Encoding " + str(self.getEncodingRule()))
453 
454  self.setCodeInstanceName(recursionDepth, arrayIndex)
455  # If there are any ExtensionObjects instide this ExtensionObject, we need to
456  # generate one-time-structs for them too before we can proceed;
457  for subv in self.value:
458  if isinstance(subv, list):
459  logger.debug("ExtensionObject contains an ExtensionObject, which is currently not encodable!", LOG_LEVEL_ERR)
460 
461  code.append("struct {")
462  for field in self.getEncodingRule():
463  ptrSym = ""
464  # If this is an Array, this is pointer to its contents with a AliasOfFieldSize entry
465  if field[2] != 0:
466  code.append(" UA_Int32 " + str(field[0]) + "Size;")
467  ptrSym = "*"
468  if len(field[1]) == 1:
469  code.append(" UA_" + str(field[1][0]) + " " + ptrSym + str(field[0]) + ";")
470  else:
471  code.append(" UA_ExtensionObject " + " " + ptrSym + str(field[0]) + ";")
472  code.append("} " + self.getCodeInstanceName() + "_struct;")
473 
474  # Assign data to the struct contents
475  # Track the encoding rule definition to detect arrays and/or ExtensionObjects
476  encFieldIdx = 0
477  for subv in self.value:
478  encField = self.getEncodingRule()[encFieldIdx]
479  encFieldIdx = encFieldIdx + 1;
480  logger.debug("Encoding of field " + subv.alias() + " is " + str(subv.getEncodingRule()) + "defined by " + str(encField))
481  # Check if this is an array
482  if encField[2] == 0:
483  code.append(self.getCodeInstanceName()+"_struct."+subv.alias() + " = " + subv.printOpen62541CCode_SubType(asIndirect=False) + ";")
484  else:
485  if isinstance(subv, list):
486  # this is an array
487  code.append(self.getCodeInstanceName()+"_struct."+subv.alias() + "Size = " + str(len(subv)) + ";")
488  code.append(self.getCodeInstanceName()+"_struct."+subv.alias()+" = (UA_" + subv.stringRepresentation + " *) UA_malloc(sizeof(UA_" + subv.stringRepresentation + ")*"+ str(len(subv))+");")
489  logger.debug("Encoding included array of " + str(len(subv)) + " values.")
490  for subvidx in range(0,len(subv)):
491  subvv = subv[subvidx]
492  logger.debug(" " + str(subvix) + " " + str(subvv))
493  code.append(self.getCodeInstanceName()+"_struct."+subv.alias() + "[" + str(subvidx) + "] = " + subvv.printOpen62541CCode_SubType(asIndirect=True) + ";")
494  code.append("}")
495  else:
496  code.append(self.getCodeInstanceName()+"_struct."+subv.alias() + "Size = 1;")
497  code.append(self.getCodeInstanceName()+"_struct."+subv.alias()+" = (UA_" + subv.stringRepresentation + " *) UA_malloc(sizeof(UA_" + subv.stringRepresentation + "));")
498  code.append(self.getCodeInstanceName()+"_struct."+subv.alias() + "[0] = " + subv.printOpen62541CCode_SubType(asIndirect=True) + ";")
499 
500 
501  # Allocate some memory
502  code.append("UA_ExtensionObject *" + self.getCodeInstanceName() + " = UA_ExtensionObject_new();")
503  code.append(self.getCodeInstanceName() + "->encoding = UA_EXTENSIONOBJECT_ENCODED_BYTESTRING;")
504  code.append(self.getCodeInstanceName() + "->content.encoded.typeId = UA_NODEID_NUMERIC(" + str(self.parent.dataType().target().id().ns) + ", " + str(self.parent.dataType().target().id().i) + "+ UA_ENCODINGOFFSET_BINARY);")
505  code.append("if(UA_ByteString_allocBuffer(&" + self.getCodeInstanceName() + "->content.encoded.body, 65000) != UA_STATUSCODE_GOOD) {}" )
506 
507  # Encode each value as a bytestring seperately.
508  code.append("size_t " + self.getCodeInstanceName() + "_encOffset = 0;" )
509  encFieldIdx = 0;
510  for subv in self.value:
511  encField = self.getEncodingRule()[encFieldIdx]
512  encFieldIdx = encFieldIdx + 1;
513  if encField[2] == 0:
514  #code.append("UA_" + subv.stringRepresentation + "_encodeBinary(&" + self.getCodeInstanceName()+"_struct."+subv.alias() + ", &" + self.getCodeInstanceName() + "->content.encoded.body, &" + self.getCodeInstanceName() + "_encOffset);" )
515  code.append("retval |= UA_encodeBinary(&" + self.getCodeInstanceName()+"_struct."+subv.alias() + ", &UA_TYPES[UA_TYPES_" + subv.stringRepresentation.upper() + "], NULL, NULL, &" + self.getCodeInstanceName() + "->content.encoded.body, &" + self.getCodeInstanceName() + "_encOffset);" )
516  else:
517  if isinstance(subv, list):
518  for subvidx in range(0,len(subv)):
519  #code.append("UA_" + subv.stringRepresentation + "_encodeBinary(&" + self.getCodeInstanceName()+"_struct."+subv.alias() + "[" + str(subvidx) + "], &" + self.getCodeInstanceName() + "->content.encoded.body, &" + self.getCodeInstanceName() + "_encOffset);" )
520  code.append("retval |= UA_encodeBinary(&" + self.getCodeInstanceName()+"_struct."+subv.alias() + "[" + str(subvidx) + "], &UA_TYPES[UA_TYPES_" + subv.stringRepresentation.upper() + "], NULL, NULL, &" + self.getCodeInstanceName() + "->content.encoded.body, &" + self.getCodeInstanceName() + "_encOffset);" )
521  else:
522  code.append("retval |= UA_encodeBinary(&" + self.getCodeInstanceName()+"_struct."+subv.alias() + "[0], &UA_TYPES[UA_TYPES_" + subv.stringRepresentation.upper() + "], NULL, NULL, &" + self.getCodeInstanceName() + "->content.encoded.body, &" + self.getCodeInstanceName() + "_encOffset);" )
523 
524  # Reallocate the memory by swapping the 65k Bytestring for a new one
525  code.append(self.getCodeInstanceName() + "->content.encoded.body.length = " + self.getCodeInstanceName() + "_encOffset;");
526  code.append("UA_Byte *" + self.getCodeInstanceName() + "_newBody = (UA_Byte *) UA_malloc(" + self.getCodeInstanceName() + "_encOffset );" )
527  code.append("memcpy(" + self.getCodeInstanceName() + "_newBody, " + self.getCodeInstanceName() + "->content.encoded.body.data, " + self.getCodeInstanceName() + "_encOffset);" )
528  code.append("UA_Byte *" + self.getCodeInstanceName() + "_oldBody = " + self.getCodeInstanceName() + "->content.encoded.body.data;");
529  code.append(self.getCodeInstanceName() + "->content.encoded.body.data = " +self.getCodeInstanceName() + "_newBody;")
530  code.append("UA_free(" + self.getCodeInstanceName() + "_oldBody);")
531  code.append("")
532  return code
533 
534  def printOpen62541CCode_SubType(self, asIndirect=True):
535  if asIndirect == False:
536  return "*" + str(self.getCodeInstanceName())
537  return str(self.getCodeInstanceName())
538 
539  def __str__(self):
540  return "'" + self.alias() + "':" + self.stringRepresentation + "(" + str(self.value) + ")"
541 
544  self.stringRepresentation = "LocalizedText"
545 
547  self.__binTypeId__ = BUILTINTYPE_TYPEID_LOCALIZEDTEXT
548 
549  def parseXML(self, xmlvalue):
550  # Expect <LocalizedText> or <AliasName>
551  # <Locale>xx_XX</Locale>
552  # <Text>TextText</Text>
553  # <LocalizedText> or </AliasName>
554  #
555  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
556  logger.error("Expected XML Element, but got junk...")
557  return
558 
559  if self.alias() != None:
560  if not self.alias() == xmlvalue.tagName:
561  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
562  else:
563  if not self.stringRepresentation == xmlvalue.tagName:
564  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
565 
566  if xmlvalue.firstChild == None:
567  if self.alias() != None:
568  logger.debug("Neither locale nor text in XML description field " + self.alias() + ". Setting to default ['en_US','']")
569  else:
570  logger.debug("Neither locale nor text in XML description. Setting to default ['en_US','']")
571  self.value = ['en_US','']
572  return
573 
574  self.value = []
575  tmp = xmlvalue.getElementsByTagName("Locale")
576  if len(tmp) == 0:
577  logger.warn("Did not find a locale. Setting to en_US per default.")
578  self.value.append('en_US')
579  else:
580  if tmp[0].firstChild == None:
581  logger.warn("Locale tag without contents. Setting to en_US per default.")
582  self.value.append('en_US')
583  else:
584  self.value.append(tmp[0].firstChild.data)
585  clean = ""
586  for s in self.value[0]:
587  if s in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_":
588  clean = clean + s
589  self.value[0] = clean
590 
591  tmp = xmlvalue.getElementsByTagName("Text")
592  if len(tmp) == 0:
593  logger.warn("Did not find a Text. Setting to empty string per default.")
594  self.value.append('')
595  else:
596  if tmp[0].firstChild == None:
597  logger.warn("Text tag without content. Setting to empty string per default.")
598  self.value.append('')
599  else:
600  self.value.append(tmp[0].firstChild.data)
601 
602  def printOpen62541CCode_SubType(self, asIndirect=True):
603  if asIndirect==True:
604  code = "UA_LOCALIZEDTEXT_ALLOC(\"" + str(self.value[0]) + "\", \"" + str(self.value[1].encode('utf-8')) + "\")"
605  else:
606  code = "UA_LOCALIZEDTEXT(\"" + str(self.value[0]) + "\", \"" + str(self.value[1].encode('utf-8')) + "\")"
607  return code
608 
611  self.stringRepresentation = "ExpandedNodeId"
612 
614  self.__binTypeId__ = BUILTINTYPE_TYPEID_EXPANDEDNODEID
615 
616  def parseXML(self, xmlvalue):
617  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
618  logger.error("Expected XML Element, but got junk...")
619  return
620 
621  logger.debug("Not implemented", LOG_LEVEL_ERR)
622 
623  def printOpen62541CCode_SubType(self, asIndirect=True):
624  #FIXME! This one is definetely broken!
625  code = ""
626  return code
627 
630  self.stringRepresentation = "NodeId"
631 
633  self.__binTypeId__ = BUILTINTYPE_TYPEID_NODEID
634 
635  def parseXML(self, xmlvalue):
636  # Expect <NodeId> or <Alias>
637  # <Identifier> # It is unclear whether or not this is manditory. Identifier tags are used in Namespace 0.
638  # ns=x;i=y or similar string representation of id()
639  # </Identifier>
640  # </NodeId> or </Alias>
641  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
642  logger.error("Expected XML Element, but got junk...")
643  return
644 
645  if self.alias() != None:
646  if not self.alias() == xmlvalue.tagName:
647  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
648  else:
649  if not self.stringRepresentation == xmlvalue.tagName:
650  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
651 
652  # Catch XML <NodeId />
653  if xmlvalue.firstChild == None :
654  logger.error("No value is given, which is illegal for Node Types...")
655  self.value = None
656  else:
657  # Check if there is an <Identifier> tag
658  if len(xmlvalue.getElementsByTagName("Identifier")) != 0:
659  xmlvalue = xmlvalue.getElementsByTagName("Identifier")[0]
660  self.value = self.parent.getNamespace().getNodeByIDString(unicode(xmlvalue.firstChild.data))
661  if self.value == None:
662  logger.error("Node with id " + str(unicode(xmlvalue.firstChild.data)) + " was not found in namespace.")
663 
664  def printOpen62541CCode_SubType(self, asIndirect=True):
665  if self.value == None:
666  return "UA_NODEID_NUMERIC(0,0)"
667  nodeId = self.value.id()
668  if nodeId.i != None:
669  return "UA_NODEID_NUMERIC(" + str(nodeId.ns) + ", " + str(nodeId.i) + ")"
670  elif nodeId.s != None:
671  return "UA_NODEID_STRING(" + str(nodeId.ns) + ", " + str(nodeId.s) + ")"
672  elif nodeId.b != None:
673  logger.debug("NodeID Generation macro for bytestrings has not been implemented.")
674  return "UA_NODEID_NUMERIC(0,0)"
675  elif nodeId.g != None:
676  logger.debug("NodeID Generation macro for guids has not been implemented.")
677  return "UA_NODEID_NUMERIC(0,0)"
678  return "UA_NODEID_NUMERIC(0,0)"
679 
682  self.stringRepresentation = "DateTime"
683 
685  self.__binTypeId__ = BUILTINTYPE_TYPEID_DATETIME
686 
687  def parseXML(self, xmlvalue):
688  # Expect <DateTime> or <AliasName>
689  # 2013-08-13T21:00:05.0000L
690  # </DateTime> or </AliasName>
691  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
692  logger.error("Expected XML Element, but got junk...")
693  return
694 
695  if self.alias() != None:
696  if not self.alias() == xmlvalue.tagName:
697  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
698  else:
699  if not self.stringRepresentation == xmlvalue.tagName:
700  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
701 
702  # Catch XML <DateTime /> by setting the value to a default
703  if xmlvalue.firstChild == None :
704  logger.debug("No value is given. Setting to default now()")
705  self.value = strptime(strftime("%Y-%m-%dT%H:%M%S"), "%Y-%m-%dT%H:%M%S")
706  else:
707  timestr = unicode(xmlvalue.firstChild.data)
708  # .NET tends to create this garbage %Y-%m-%dT%H:%M:%S.0000z
709  # strip everything after the "." away for a posix time_struct
710  if "." in timestr:
711  timestr = timestr[:timestr.index(".")]
712  # If the last character is not numeric, remove it
713  while len(timestr)>0 and not timestr[-1] in "0123456789":
714  timestr = timestr[:-1]
715  try:
716  self.value = strptime(timestr, "%Y-%m-%dT%H:%M:%S")
717  except:
718  logger.error("Timestring format is illegible. Expected 2001-01-30T21:22:23, but got " + timestr + " instead. Time will be defaultet to now()")
719  self.value = strptime(strftime("%Y-%m-%dT%H:%M%S"), "%Y-%m-%dT%H:%M%S")
720 
723  self.stringRepresentation = "QualifiedName"
724 
726  self.__binTypeId__ = BUILTINTYPE_TYPEID_QUALIFIEDNAME
727 
728  def parseXML(self, xmlvalue):
729  # Expect <QualifiedName> or <AliasName>
730  # <NamespaceIndex>Int16<NamespaceIndex> # Optional, apparently ommitted if ns=0 ??? (Not given in OPCUA Nodeset2)
731  # <Name>SomeString<Name> # Speculation: Manditory if NamespaceIndex is given, omitted otherwise?
732  # </QualifiedName> or </AliasName>
733  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
734  logger.error("Expected XML Element, but got junk...")
735  return
736 
737  if self.alias() != None:
738  if not self.alias() == xmlvalue.tagName:
739  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
740  else:
741  if not self.stringRepresentation == xmlvalue.tagName:
742  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
743 
744  # Catch XML <Qalified /> by setting the value to a default
745  if xmlvalue.firstChild == None :
746  logger.debug("No value is given. Setting to default empty string in ns=0: [0, '']")
747  self.value = [0, '']
748  else:
749  # Is a namespace index passed?
750  if len(xmlvalue.getElementsByTagName("NamespaceIndex")) != 0:
751  self.value = [int(xmlvalue.getElementsByTagName("NamespaceIndex")[0].firstChild.data)]
752  # namespace index is passed and <Name> tags are now manditory?
753  if len(xmlvalue.getElementsByTagName("Name")) != 0:
754  self.value.append(xmlvalue.getElementsByTagName("Name")[0].firstChild.data)
755  else:
756  logger.debug("No name is specified, will default to empty string")
757  self.value.append('')
758  else:
759  logger.debug("No namespace is specified, will default to 0")
760  self.value = [0]
761  self.value.append(unicode(xmlvalue.firstChild.data))
762 
763  def printOpen62541CCode_SubType(self, asIndirect=True):
764  code = "UA_QUALIFIEDNAME_ALLOC(" + str(self.value[0]) + ", \"" + self.value[1].encode('utf-8') + "\")"
765  return code
766 
769  self.stringRepresentation = "StatusCode"
770 
772  self.__binTypeId__ = BUILTINTYPE_TYPEID_STATUSCODE
773 
774  def parseXML(self, xmlvalue):
775  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
776  logger.error("Expected XML Element, but got junk...")
777  return
778  logger.warn("Not implemented")
779 
782  self.stringRepresentation = "StatusCode"
783 
785  self.__binTypeId__ = BUILTINTYPE_TYPEID_DIAGNOSTICINFO
786 
787  def parseXML(self, xmlvalue):
788  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
789  logger.error("Expected XML Element, but got junk...")
790  return
791  logger.warn("Not implemented")
792 
795  self.stringRepresentation = "Guid"
796 
798  self.__binTypeId__ = BUILTINTYPE_TYPEID_GUID
799 
800  def parseXML(self, xmlvalue):
801  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
802  logger.error("Expected XML Element, but got junk...")
803  return
804 
805  if self.alias() != None:
806  if not self.alias() == xmlvalue.tagName:
807  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
808  else:
809  if not self.stringRepresentation == xmlvalue.tagName:
810  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
811 
812  # Catch XML <Guid /> by setting the value to a default
813  if xmlvalue.firstChild == None:
814  logger.debug("No value is given. Setting to default 0")
815  self.value = [0,0,0,0]
816  else:
817  self.value = unicode(xmlvalue.firstChild.data)
818  self.value = self.value.replace("{","")
819  self.value = self.value.replace("}","")
820  self.value = self.value.split("-")
821  tmp = []
822  ok = True
823  for g in self.value:
824  try:
825  tmp.append(int("0x"+g, 16))
826  except:
827  logger.error("Invalid formatting of Guid. Expected {01234567-89AB-CDEF-ABCD-0123456789AB}, got " + unicode(xmlvalue.firstChild.data))
828  self.value = [0,0,0,0,0]
829  ok = False
830  if len(tmp) != 5:
831  logger.error("Invalid formatting of Guid. Expected {01234567-89AB-CDEF-ABCD-0123456789AB}, got " + unicode(xmlvalue.firstChild.data))
832  self.value = [0,0,0,0]
833  ok = False
834  self.value = tmp
835 
838  self.stringRepresentation = "Boolean"
839 
841  self.__binTypeId__ = BUILTINTYPE_TYPEID_BOOLEAN
842 
843  def parseXML(self, xmlvalue):
844  # Expect <Boolean>value</Boolean> or
845  # <Aliasname>value</Aliasname>
846  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
847  logger.error("Expected XML Element, but got junk...")
848  return
849 
850  if self.alias() != None:
851  if not self.alias() == xmlvalue.tagName:
852  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
853  else:
854  if not self.stringRepresentation == xmlvalue.tagName:
855  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
856 
857  # Catch XML <Boolean /> by setting the value to a default
858  if xmlvalue.firstChild == None:
859  logger.debug("No value is given. Setting to default 0")
860  self.value = "false"
861  else:
862  if "false" in unicode(xmlvalue.firstChild.data).lower():
863  self.value = "false"
864  else:
865  self.value = "true"
866 
867  def printOpen62541CCode_SubType(self, asIndirect=True):
868  return "(UA_" + self.stringRepresentation + ") " + str(self.value)
869 
872  self.stringRepresentation = "Byte"
873 
875  self.__binTypeId__ = BUILTINTYPE_TYPEID_BYTE
876 
877  def parseXML(self, xmlvalue):
878  # Expect <Byte>value</Byte> or
879  # <Aliasname>value</Aliasname>
880  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
881  logger.error("Expected XML Element, but got junk...")
882  return
883 
884  if self.alias() != None:
885  if not self.alias() == xmlvalue.tagName:
886  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
887  else:
888  if not self.stringRepresentation == xmlvalue.tagName:
889  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
890 
891  # Catch XML <Byte /> by setting the value to a default
892  if xmlvalue.firstChild == None:
893  logger.debug("No value is given. Setting to default 0")
894  self.value = 0
895  else:
896  try:
897  self.value = int(unicode(xmlvalue.firstChild.data))
898  except:
899  logger.error("Error parsing integer. Expected " + self.stringRepresentation + " but got " + unicode(xmlvalue.firstChild.data))
900 
901  def printOpen62541CCode_SubType(self, asIndirect=True):
902  return "(UA_" + self.stringRepresentation + ") " + str(self.value)
903 
906  self.stringRepresentation = "SByte"
907 
909  self.__binTypeId__ = BUILTINTYPE_TYPEID_SBYTE
910 
911  def parseXML(self, xmlvalue):
912  # Expect <SByte>value</SByte> or
913  # <Aliasname>value</Aliasname>
914  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
915  logger.error("Expected XML Element, but got junk...")
916  return
917 
918  if self.alias() != None:
919  if not self.alias() == xmlvalue.tagName:
920  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
921  else:
922  if not self.stringRepresentation == xmlvalue.tagName:
923  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
924 
925  # Catch XML <SByte /> by setting the value to a default
926  if xmlvalue.firstChild == None:
927  logger.debug("No value is given. Setting to default 0")
928  self.value = 0
929  else:
930  try:
931  self.value = int(unicode(xmlvalue.firstChild.data))
932  except:
933  logger.error("Error parsing integer. Expected " + self.stringRepresentation + " but got " + unicode(xmlvalue.firstChild.data))
934 
935  def printOpen62541CCode_SubType(self, asIndirect=True):
936  return "(UA_" + self.stringRepresentation + ") " + str(self.value)
937 
940  self.stringRepresentation = "Int16"
941 
943  self.__binTypeId__ = BUILTINTYPE_TYPEID_INT16
944 
945  def parseXML(self, xmlvalue):
946  # Expect <Int16>value</Int16> or
947  # <Aliasname>value</Aliasname>
948  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
949  logger.error("Expected XML Element, but got junk...")
950  return
951 
952  if self.alias() != None:
953  if not self.alias() == xmlvalue.tagName:
954  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
955  else:
956  if not self.stringRepresentation == xmlvalue.tagName:
957  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
958 
959  # Catch XML <Int16 /> by setting the value to a default
960  if xmlvalue.firstChild == None:
961  logger.debug("No value is given. Setting to default 0")
962  self.value = 0
963  else:
964  try:
965  self.value = int(unicode(xmlvalue.firstChild.data))
966  except:
967  logger.error("Error parsing integer. Expected " + self.stringRepresentation + " but got " + unicode(xmlvalue.firstChild.data))
968 
969  def printOpen62541CCode_SubType(self, asIndirect=True):
970  return "(UA_" + self.stringRepresentation + ") " + str(self.value)
971 
974  self.stringRepresentation = "UInt16"
975 
977  self.__binTypeId__ = BUILTINTYPE_TYPEID_UINT16
978 
979  def parseXML(self, xmlvalue):
980  # Expect <UInt16>value</UInt16> or
981  # <Aliasname>value</Aliasname>
982  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
983  logger.error("Expected XML Element, but got junk...")
984  return
985 
986  if self.alias() != None:
987  if not self.alias() == xmlvalue.tagName:
988  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
989  else:
990  if not self.stringRepresentation == xmlvalue.tagName:
991  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
992 
993  # Catch XML <UInt16 /> by setting the value to a default
994  if xmlvalue.firstChild == None:
995  logger.debug("No value is given. Setting to default 0")
996  self.value = 0
997  else:
998  try:
999  self.value = int(unicode(xmlvalue.firstChild.data))
1000  except:
1001  logger.error("Error parsing integer. Expected " + self.stringRepresentation + " but got " + unicode(xmlvalue.firstChild.data))
1002 
1003  def printOpen62541CCode_SubType(self, asIndirect=True):
1004  return "(UA_" + self.stringRepresentation + ") " + str(self.value)
1005 
1008  self.stringRepresentation = "Int32"
1009 
1011  self.__binTypeId__ = BUILTINTYPE_TYPEID_INT32
1012 
1013  def parseXML(self, xmlvalue):
1014  # Expect <Int32>value</Int32> or
1015  # <Aliasname>value</Aliasname>
1016  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
1017  logger.error("Expected XML Element, but got junk...")
1018  return
1019 
1020  if self.alias() != None:
1021  if not self.alias() == xmlvalue.tagName:
1022  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
1023  else:
1024  if not self.stringRepresentation == xmlvalue.tagName:
1025  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
1026 
1027  # Catch XML <Int32 /> by setting the value to a default
1028  if xmlvalue.firstChild == None:
1029  logger.debug("No value is given. Setting to default 0")
1030  self.value = 0
1031  else:
1032  try:
1033  self.value = int(unicode(xmlvalue.firstChild.data))
1034  except:
1035  logger.error("Error parsing integer. Expected " + self.stringRepresentation + " but got " + unicode(xmlvalue.firstChild.data))
1036 
1037  def printOpen62541CCode_SubType(self, asIndirect=True):
1038  return "(UA_" + self.stringRepresentation + ") " + str(self.value)
1039 
1042  self.stringRepresentation = "UInt32"
1043 
1045  self.__binTypeId__ = BUILTINTYPE_TYPEID_UINT32
1046 
1047  def parseXML(self, xmlvalue):
1048  # Expect <UInt32>value</UInt32> or
1049  # <Aliasname>value</Aliasname>
1050  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
1051  logger.error("Expected XML Element, but got junk...")
1052  return
1053 
1054  if self.alias() != None:
1055  if not self.alias() == xmlvalue.tagName:
1056  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
1057  else:
1058  if not self.stringRepresentation == xmlvalue.tagName:
1059  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
1060 
1061  # Catch XML <UInt32 /> by setting the value to a default
1062  if xmlvalue.firstChild == None:
1063  logger.debug("No value is given. Setting to default 0")
1064  self.value = 0
1065  else:
1066  try:
1067  self.value = int(unicode(xmlvalue.firstChild.data))
1068  except:
1069  logger.error("Error parsing integer. Expected " + self.stringRepresentation + " but got " + unicode(xmlvalue.firstChild.data))
1070 
1071  def printOpen62541CCode_SubType(self, asIndirect=True):
1072  return "(UA_" + self.stringRepresentation + ") " + str(self.value)
1073 
1076  self.stringRepresentation = "Int64"
1077 
1079  self.__binTypeId__ = BUILTINTYPE_TYPEID_INT64
1080 
1081  def parseXML(self, xmlvalue):
1082  # Expect <Int64>value</Int64> or
1083  # <Aliasname>value</Aliasname>
1084  if self.alias() != None:
1085  if not self.alias() == xmlvalue.tagName:
1086  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
1087  else:
1088  if not self.stringRepresentation == xmlvalue.tagName:
1089  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
1090 
1091  # Catch XML <Int64 /> by setting the value to a default
1092  if xmlvalue.firstChild == None:
1093  logger.debug("No value is given. Setting to default 0")
1094  self.value = 0
1095  else:
1096  try:
1097  self.value = int(unicode(xmlvalue.firstChild.data))
1098  except:
1099  logger.error("Error parsing integer. Expected " + self.stringRepresentation + " but got " + unicode(xmlvalue.firstChild.data))
1100 
1101  def printOpen62541CCode_SubType(self, asIndirect=True):
1102  return "(UA_" + self.stringRepresentation + ") " + str(self.value)
1103 
1106  self.stringRepresentation = "UInt64"
1107 
1109  self.__binTypeId__ = BUILTINTYPE_TYPEID_UINT64
1110 
1111  def parseXML(self, xmlvalue):
1112  # Expect <UInt16>value</UInt16> or
1113  # <Aliasname>value</Aliasname>
1114  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
1115  logger.error("Expected XML Element, but got junk...")
1116  return
1117 
1118  if self.alias() != None:
1119  if not self.alias() == xmlvalue.tagName:
1120  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
1121  else:
1122  if not self.stringRepresentation == xmlvalue.tagName:
1123  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
1124 
1125  # Catch XML <UInt64 /> by setting the value to a default
1126  if xmlvalue.firstChild == None:
1127  logger.debug("No value is given. Setting to default 0")
1128  self.value = 0
1129  else:
1130  try:
1131  self.value = int(unicode(xmlvalue.firstChild.data))
1132  except:
1133  logger.error("Error parsing integer. Expected " + self.stringRepresentation + " but got " + unicode(xmlvalue.firstChild.data))
1134 
1135  def printOpen62541CCode_SubType(self, asIndirect=True):
1136  return "(UA_" + self.stringRepresentation + ") " + str(self.value)
1137 
1140  self.stringRepresentation = "Float"
1141 
1143  self.__binTypeId__ = BUILTINTYPE_TYPEID_FLOAT
1144 
1145  def parseXML(self, xmlvalue):
1146  # Expect <Float>value</Float> or
1147  # <Aliasname>value</Aliasname>
1148  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
1149  logger.error("Expected XML Element, but got junk...")
1150  return
1151 
1152  if self.alias() != None:
1153  if not self.alias() == xmlvalue.tagName:
1154  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
1155  else:
1156  if not self.stringRepresentation == xmlvalue.tagName:
1157  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
1158 
1159  # Catch XML <Float /> by setting the value to a default
1160  if xmlvalue.firstChild == None:
1161  logger.debug("No value is given. Setting to default 0")
1162  self.value = 0.0
1163  else:
1164  try:
1165  self.value = float(unicode(xmlvalue.firstChild.data))
1166  except:
1167  logger.error("Error parsing integer. Expected " + self.stringRepresentation + " but got " + unicode(xmlvalue.firstChild.data))
1168 
1169  def printOpen62541CCode_SubType(self, asIndirect=True):
1170  return "(UA_" + self.stringRepresentation + ") " + str(self.value)
1171 
1174  self.stringRepresentation = "Double"
1175 
1177  self.__binTypeId__ = BUILTINTYPE_TYPEID_DOUBLE
1178 
1179  def parseXML(self, xmlvalue):
1180  # Expect <Double>value</Double> or
1181  # <Aliasname>value</Aliasname>
1182  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
1183  logger.error("Expected XML Element, but got junk...")
1184  return
1185 
1186  if self.alias() != None:
1187  if not self.alias() == xmlvalue.tagName:
1188  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
1189  else:
1190  if not self.stringRepresentation == xmlvalue.tagName:
1191  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
1192 
1193  # Catch XML <Double /> by setting the value to a default
1194  if xmlvalue.firstChild == None:
1195  logger.debug("No value is given. Setting to default 0")
1196  self.value = 0.0
1197  else:
1198  try:
1199  self.value = float(unicode(xmlvalue.firstChild.data))
1200  except:
1201  logger.error("Error parsing integer. Expected " + self.stringRepresentation + " but got " + unicode(xmlvalue.firstChild.data))
1202 
1203  def printOpen62541CCode_SubType(self, asIndirect=True):
1204  return "(UA_" + self.stringRepresentation + ") " + str(self.value)
1205 
1208  self.stringRepresentation = "String"
1209 
1211  self.__binTypeId__ = BUILTINTYPE_TYPEID_STRING
1212 
1213  def pack(self):
1214  bin = structpack("I", len(unicode(self.value)))
1215  bin = bin + str(self.value)
1216  return bin
1217 
1218  def parseXML(self, xmlvalue):
1219  # Expect <String>value</String> or
1220  # <Aliasname>value</Aliasname>
1221  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
1222  logger.error("Expected XML Element, but got junk...")
1223  return
1224 
1225  if self.alias() != None:
1226  if not self.alias() == xmlvalue.tagName:
1227  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
1228  else:
1229  if not self.stringRepresentation == xmlvalue.tagName:
1230  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
1231 
1232  # Catch XML <String /> by setting the value to a default
1233  if xmlvalue.firstChild == None:
1234  logger.debug("No value is given. Setting to default 0")
1235  self.value = ""
1236  else:
1237  self.value = str(unicode(xmlvalue.firstChild.data))
1238 
1239  def printOpen62541CCode_SubType(self, asIndirect=True):
1240  code = "UA_STRING_ALLOC(\"" + self.value.encode('utf-8') + "\")"
1241  return code
1242 
1245  self.stringRepresentation = "XmlElement"
1246 
1248  self.__binTypeId__ = BUILTINTYPE_TYPEID_XMLELEMENT
1249 
1250  def printOpen62541CCode_SubType(self, asIndirect=True):
1251  code = "UA_XMLELEMENT_ALLOC(\"" + self.value.encode('utf-8') + "\")"
1252  return code
1253 
1256  self.stringRepresentation = "ByteString"
1257 
1259  self.__binTypeId__ = BUILTINTYPE_TYPEID_BYTESTRING
1260 
1261  def parseXML(self, xmlvalue):
1262  # Expect <ByteString>value</ByteString> or
1263  # <Aliasname>value</Aliasname>
1264  if xmlvalue == None or xmlvalue.nodeType != xmlvalue.ELEMENT_NODE:
1265  logger.error("Expected XML Element, but got junk...")
1266  return
1267 
1268  if self.alias() != None:
1269  if not self.alias() == xmlvalue.tagName:
1270  logger.warn("Expected an aliased XML field called " + self.alias() + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
1271  else:
1272  if not self.stringRepresentation == xmlvalue.tagName:
1273  logger.warn("Expected XML field " + self.stringRepresentation + " but got " + xmlvalue.tagName + " instead. This is a parsing error of opcua_value_t.__parseXMLSingleValue(), will try to continue anyway.")
1274 
1275  # Catch XML <ByteString /> by setting the value to a default
1276  if xmlvalue.firstChild == None:
1277  logger.debug("No value is given. Setting to default 0")
1278  self.value = ""
1279  else:
1280  self.value = str(unicode(xmlvalue.firstChild.data))
1281 
1282  def printOpen62541CCode_SubType(self, asIndirect=True):
1283  bs = ""
1284  for line in self.value:
1285  bs = bs + str(line).replace("\n","");
1286  outs = bs
1287  logger.debug("Encoded Bytestring: " + outs)
1288 # bs = bs.decode('base64')
1289 # outs = ""
1290 # for s in bs:
1291 # outs = outs + hex(ord(s)).upper().replace("0X", "\\x")
1292  code = "UA_STRING_ALLOC(\"" + outs + "\")"
1293  return code
ua_builtin_types.opcua_BuiltinType_byte_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:871
ua_builtin_types.opcua_BuiltinType_localizedtext_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:546
ua_builtin_types.opcua_value_t.knownTypes
list knownTypes
Definition: ua_builtin_types.py:52
ua_builtin_types.opcua_value_t.getEncodingRule
def getEncodingRule(self)
Definition: ua_builtin_types.py:84
ua_builtin_types.opcua_value_t.setEncodingRule
def setEncodingRule(self, encoding)
Definition: ua_builtin_types.py:81
ua_builtin_types.opcua_BuiltinType_extensionObject_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:534
ua_builtin_types.opcua_BuiltinType_expandednodeid_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:613
ua_builtin_types.opcua_BuiltinType_localizedtext_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:543
ua_builtin_types.opcua_BuiltinType_uint16_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:976
ua_builtin_types.opcua_BuiltinType_byte_t
Definition: ua_builtin_types.py:870
ua_builtin_types.opcua_BuiltinType_bytestring_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:1261
ua_builtin_types.opcua_BuiltinType_xmlelement_t
Definition: ua_builtin_types.py:1243
ua_builtin_types.opcua_BuiltinType_bytestring_t
Definition: ua_builtin_types.py:1254
ua_builtin_types.opcua_BuiltinType_double_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:1176
ua_builtin_types.opcua_BuiltinType_uint32_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:1047
ua_builtin_types.opcua_BuiltinType_sbyte_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:908
ua_builtin_types.opcua_BuiltinType_qualifiedname_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:725
ua_builtin_types.opcua_value_t.alias
def alias(self, data=None)
Definition: ua_builtin_types.py:87
ua_builtin_types.opcua_BuiltinType_extensionObject_t.setCodeInstanceName
def setCodeInstanceName(self, recursionDepth, arrayIndex)
Definition: ua_builtin_types.py:440
ua_builtin_types.opcua_value_t.__alias__
__alias__
Definition: ua_builtin_types.py:49
ua_builtin_types.opcua_value_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:335
ua_builtin_types.opcua_BuiltinType_uint32_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:1041
ua_builtin_types.opcua_BuiltinType_sbyte_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:911
ua_builtin_types.opcua_BuiltinType_boolean_t
Definition: ua_builtin_types.py:836
ua_builtin_types.opcua_BuiltinType_extensionObject_t.__str__
def __str__(self)
Definition: ua_builtin_types.py:539
ua_builtin_types.opcua_BuiltinType_boolean_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:837
ua_builtin_types.opcua_BuiltinType_uint64_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:1108
ua_builtin_types.opcua_BuiltinType_uint16_t
Definition: ua_builtin_types.py:972
ua_builtin_types.opcua_BuiltinType_uint16_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:979
ua_builtin_types.opcua_BuiltinType_nodeid_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:632
ua_builtin_types.opcua_value_t.getNumericRepresentation
def getNumericRepresentation(self)
Definition: ua_builtin_types.py:324
ua_builtin_types.opcua_value_t.__binTypeId__
int __binTypeId__
Definition: ua_builtin_types.py:50
ua_builtin_types.opcua_BuiltinType_localizedtext_t
Definition: ua_builtin_types.py:542
ua_builtin_types.opcua_BuiltinType_double_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:1179
ua_builtin_types.opcua_BuiltinType_float_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:1142
ua_builtin_types.opcua_value_t.getTypeByString
def getTypeByString(self, stringName, encodingRule)
Definition: ua_builtin_types.py:102
ua_builtin_types.opcua_BuiltinType_diagnosticinfo_t
Definition: ua_builtin_types.py:780
ua_builtin_types.opcua_BuiltinType_extensionObject_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:429
ua_builtin_types.opcua_BuiltinType_float_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:1169
ua_builtin_types.opcua_BuiltinType_nodeid_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:664
ua_builtin_types.opcua_BuiltinType_int32_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:1037
ua_builtin_types.opcua_BuiltinType_statuscode_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:771
ua_builtin_types.opcua_BuiltinType_expandednodeid_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:623
ua_builtin_types.opcua_BuiltinType_diagnosticinfo_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:787
ua_builtin_types.opcua_BuiltinType_int64_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:1078
ua_builtin_types.opcua_BuiltinType_guid_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:794
ua_builtin_types.opcua_BuiltinType_int16_t
Definition: ua_builtin_types.py:938
ua_builtin_types.opcua_BuiltinType_uint32_t
Definition: ua_builtin_types.py:1040
ua_builtin_types.opcua_value_t.__value__
__value__
Definition: ua_builtin_types.py:99
ua_builtin_types.opcua_BuiltinType_extensionObject_t.printOpen62541CCode_SubType_build
def printOpen62541CCode_SubType_build(self, recursionDepth=0, arrayIndex=0)
Definition: ua_builtin_types.py:446
ua_builtin_types.opcua_BuiltinType_localizedtext_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:549
ua_builtin_types.opcua_BuiltinType_qualifiedname_t
Definition: ua_builtin_types.py:721
ua_builtin_types.opcua_BuiltinType_extensionObject_t.__typeId__
__typeId__
Definition: ua_builtin_types.py:427
ua_builtin_types.opcua_BuiltinType_int64_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:1101
ua_builtin_types.opcua_BuiltinType_int16_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:945
ua_builtin_types.opcua_BuiltinType_string_t
Definition: ua_builtin_types.py:1206
ua_builtin_types.opcua_BuiltinType_extensionObject_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:425
ua_builtin_types.opcua_BuiltinType_qualifiedname_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:763
ua_builtin_types.opcua_value_t.__parseXMLSingleValue
def __parseXMLSingleValue(self, xmlvalue, alias=None, encodingPart=None)
Definition: ua_builtin_types.py:202
ua_builtin_types.getNextElementNode
def getNextElementNode(xmlvalue)
Definition: ua_builtin_types.py:33
open62541_MacroHelper.open62541_MacroHelper
Definition: open62541_MacroHelper.py:34
ua_builtin_types.opcua_BuiltinType_nodeid_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:635
ua_builtin_types.opcua_BuiltinType_int64_t
Definition: ua_builtin_types.py:1074
ua_builtin_types.opcua_BuiltinType_boolean_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:843
ua_builtin_types.opcua_BuiltinType_uint32_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:1071
ua_builtin_types.opcua_value_t.stringRepresentation
string stringRepresentation
Definition: ua_builtin_types.py:51
ua_builtin_types.opcua_BuiltinType_float_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:1145
ua_builtin_types.opcua_value_t
Definition: ua_builtin_types.py:46
ua_builtin_types.opcua_value_t.__repr__
def __repr__(self)
Definition: ua_builtin_types.py:332
ua_builtin_types.opcua_BuiltinType_datetime_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:687
ua_builtin_types.opcua_BuiltinType_diagnosticinfo_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:784
ua_builtin_types.opcua_BuiltinType_xmlelement_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:1244
ua_builtin_types.opcua_BuiltinType_guid_t
Definition: ua_builtin_types.py:793
str
#define str(a)
Definition: ua_adapter.cpp:52
ua_builtin_types.opcua_BuiltinType_diagnosticinfo_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:781
ua_builtin_types.opcua_BuiltinType_int64_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:1075
ua_builtin_types.opcua_BuiltinType_statuscode_t
Definition: ua_builtin_types.py:767
ua_builtin_types.opcua_BuiltinType_byte_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:901
ua_builtin_types.opcua_value_t.__init__
def __init__(self, parent)
Definition: ua_builtin_types.py:55
ua_builtin_types.opcua_BuiltinType_uint16_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:973
ua_builtin_types.opcua_BuiltinType_string_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:1218
ua_builtin_types.opcua_BuiltinType_int16_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:939
ua_builtin_types.opcua_BuiltinType_uint16_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:1003
ua_builtin_types.opcua_BuiltinType_uint64_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:1105
ua_builtin_types.opcua_BuiltinType_expandednodeid_t
Definition: ua_builtin_types.py:609
ua_builtin_types.opcua_BuiltinType_statuscode_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:768
ua_builtin_types.opcua_BuiltinType_int32_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:1007
ua_builtin_types.opcua_BuiltinType_sbyte_t
Definition: ua_builtin_types.py:904
ua_builtin_types.opcua_BuiltinType_byte_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:877
ua_builtin_types.opcua_BuiltinType_float_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:1139
ua_builtin_types.opcua_BuiltinType_int32_t
Definition: ua_builtin_types.py:1006
ua_builtin_types.opcua_BuiltinType_uint32_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:1044
ua_builtin_types.opcua_BuiltinType_string_t.pack
def pack(self)
Definition: ua_builtin_types.py:1213
ua_builtin_types.opcua_BuiltinType_uint64_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:1111
ua_builtin_types.opcua_value_t.encodingRule
encodingRule
Definition: ua_builtin_types.py:69
ua_builtin_types.opcua_value_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:318
ua_builtin_types.unicode
def unicode(s)
Definition: ua_builtin_types.py:43
ua_builtin_types.opcua_BuiltinType_int16_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:942
ua_builtin_types.opcua_BuiltinType_bytestring_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:1258
ua_builtin_types.opcua_BuiltinType_guid_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:800
ua_builtin_types.opcua_BuiltinType_expandednodeid_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:616
ua_builtin_types.opcua_value_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:321
ua_builtin_types.opcua_BuiltinType_int32_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:1010
ua_builtin_types.opcua_BuiltinType_datetime_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:681
ua_builtin_types.opcua_BuiltinType_double_t
Definition: ua_builtin_types.py:1172
ua_builtin_types.opcua_BuiltinType_uint64_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:1135
ua_builtin_types.opcua_BuiltinType_qualifiedname_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:728
ua_builtin_types.opcua_BuiltinType_int32_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:1013
ua_builtin_types.opcua_BuiltinType_expandednodeid_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:610
ua_builtin_types.opcua_BuiltinType_float_t
Definition: ua_builtin_types.py:1138
ua_builtin_types.opcua_BuiltinType_extensionObject_t.getCodeInstanceName
def getCodeInstanceName(self)
Definition: ua_builtin_types.py:437
ua_builtin_types.opcua_BuiltinType_string_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:1210
ua_builtin_types.opcua_value_t.dataType
dataType
Definition: ua_builtin_types.py:68
ua_builtin_types.opcua_BuiltinType_sbyte_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:905
ua_builtin_types.opcua_BuiltinType_datetime_t
Definition: ua_builtin_types.py:680
ua_builtin_types.opcua_BuiltinType_int16_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:969
ua_builtin_types.opcua_BuiltinType_string_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:1239
ua_builtin_types.opcua_BuiltinType_extensionObject_t.typeId
def typeId(self, data=None)
Definition: ua_builtin_types.py:432
ua_builtin_types.opcua_BuiltinType_qualifiedname_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:722
ua_builtin_types.opcua_value_t.parent
parent
Definition: ua_builtin_types.py:53
ua_builtin_types.opcua_value_t.isBuiltinByString
def isBuiltinByString(self, string)
Definition: ua_builtin_types.py:92
ua_builtin_types.opcua_BuiltinType_bytestring_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:1255
ua_builtin_types.opcua_BuiltinType_string_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:1207
ua_builtin_types.opcua_value_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:175
ua_builtin_types.opcua_BuiltinType_sbyte_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:935
ua_builtin_types.opcua_BuiltinType_byte_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:874
ua_builtin_types.opcua_BuiltinType_int64_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:1081
ua_builtin_types.opcua_value_t.value
value
Definition: ua_builtin_types.py:47
ua_builtin_types.opcua_BuiltinType_localizedtext_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:602
ua_builtin_types.opcua_BuiltinType_boolean_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:867
ua_builtin_types.opcua_BuiltinType_double_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:1173
ua_builtin_types.opcua_BuiltinType_guid_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:797
ua_builtin_types.opcua_BuiltinType_nodeid_t.setStringReprentation
def setStringReprentation(self)
Definition: ua_builtin_types.py:629
generate_open62541CCode.id
id
Definition: generate_open62541CCode.py:127
ua_builtin_types.opcua_BuiltinType_xmlelement_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:1247
ua_builtin_types.opcua_BuiltinType_double_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:1203
ua_builtin_types.opcua_BuiltinType_extensionObject_t.__inVariableRecursionDepth__
__inVariableRecursionDepth__
Definition: ua_builtin_types.py:441
ua_builtin_types.opcua_value_t.printOpen62541CCode
def printOpen62541CCode(self, bootstrapping=True)
Definition: ua_builtin_types.py:338
ua_builtin_types.opcua_BuiltinType_datetime_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:684
ua_builtin_types.opcua_BuiltinType_xmlelement_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:1250
ua_builtin_types.opcua_BuiltinType_uint64_t
Definition: ua_builtin_types.py:1104
ua_builtin_types.opcua_BuiltinType_bytestring_t.printOpen62541CCode_SubType
def printOpen62541CCode_SubType(self, asIndirect=True)
Definition: ua_builtin_types.py:1282
ua_builtin_types.opcua_BuiltinType_extensionObject_t.__codeInstanceName__
__codeInstanceName__
Definition: ua_builtin_types.py:443
ua_builtin_types.opcua_value_t.getValueFieldByAlias
def getValueFieldByAlias(self, fieldname)
Definition: ua_builtin_types.py:71
ua_builtin_types.opcua_BuiltinType_statuscode_t.parseXML
def parseXML(self, xmlvalue)
Definition: ua_builtin_types.py:774
ua_builtin_types.opcua_BuiltinType_nodeid_t
Definition: ua_builtin_types.py:628
ua_builtin_types.opcua_BuiltinType_boolean_t.setNumericRepresentation
def setNumericRepresentation(self)
Definition: ua_builtin_types.py:840
ua_builtin_types.opcua_value_t.__str__
def __str__(self)
Definition: ua_builtin_types.py:327
ua_builtin_types.opcua_BuiltinType_extensionObject_t
Definition: ua_builtin_types.py:424
ua_builtin_types.opcua_BuiltinType_extensionObject_t.__inVariableArrayIndex__
__inVariableArrayIndex__
Definition: ua_builtin_types.py:442