Go to the documentation of this file.00001 if __name__ == "__main__":
00002 inputfile = open("NodeIds.csv")
00003 outputfile = open("../opcua/ua/object_ids.py", "w")
00004 outputfile.write("#AUTOGENERATED!!!\n")
00005 outputfile.write("\n")
00006 outputfile.write("from enum import IntEnum\n")
00007 outputfile.write("\n")
00008
00009
00010 outputfile.write("class ObjectIds(object):\n")
00011 outputfile.write(" Null = 0\n")
00012 for line in inputfile:
00013 name, nb, datatype = line.split(",")
00014 outputfile.write(" {0} = {1}\n".format(name, nb))
00015 inputfile.close()
00016 inputfile = open("NodeIds.csv")
00017 outputfile.write("\n\nObjectIdNames = {}\n")
00018 outputfile.write("ObjectIdNames[0] = 'Null'\n".format(nb, name))
00019 for line in inputfile:
00020 name, nb, datatype = line.split(",")
00021 outputfile.write("ObjectIdNames[{0}] = '{1}'\n".format(nb, name))
00022
00023 inputfile = open("AttributeIds.csv")
00024 outputfile = open("../opcua/ua/attribute_ids.py", "w")
00025 outputfile.write("#AUTOGENERATED!!!\n")
00026 outputfile.write("\n")
00027 outputfile.write("from enum import IntEnum\n")
00028 outputfile.write("\n")
00029 outputfile.write("class AttributeIds(IntEnum):\n")
00030 for line in inputfile:
00031 name, nb = line.split(",")
00032 outputfile.write(" {0} = {1}\n".format(name.strip(), nb.strip()))
00033