1 if __name__ ==
"__main__":
2 inputfile = open(
"NodeIds.csv")
3 outputfile = open(
"../opcua/ua/object_ids.py",
"w")
4 outputfile.write(
"#AUTOGENERATED!!!\n")
6 outputfile.write(
"from enum import IntEnum\n")
10 outputfile.write(
"class ObjectIds(object):\n")
11 outputfile.write(
" Null = 0\n")
12 for line
in inputfile:
13 name, nb, datatype = line.split(
",")
14 outputfile.write(
" {0} = {1}\n".format(name, nb))
16 inputfile = open(
"NodeIds.csv")
17 outputfile.write(
"\n\nObjectIdNames = {}\n")
18 outputfile.write(
"ObjectIdNames[0] = 'Null'\n".format(nb, name))
19 for line
in inputfile:
20 name, nb, datatype = line.split(
",")
21 outputfile.write(
"ObjectIdNames[{0}] = '{1}'\n".format(nb, name))
23 inputfile = open(
"AttributeIds.csv")
24 outputfile = open(
"../opcua/ua/attribute_ids.py",
"w")
25 outputfile.write(
"#AUTOGENERATED!!!\n")
26 outputfile.write(
"\n")
27 outputfile.write(
"from enum import IntEnum\n")
28 outputfile.write(
"\n")
29 outputfile.write(
"class AttributeIds(IntEnum):\n")
30 for line
in inputfile:
31 name, nb = line.split(
",")
32 outputfile.write(
" {0} = {1}\n".format(name.strip(), nb.strip()))