static void SetupAddressSpace(object sender, EventArgs e)
        {
            CodeGenNodeManager mgr = sender as CodeGenNodeManager;

            ///////////////////////////////////////
            //Sample code for adding referenced companion specification nodeset file(s).
            ///////////////////////////////////////
            //mgr.ImportXml("Opc.Ua.Di.NodeSet2.xml");
            ///////////////////////////////////////

            //Load actual project nodeset
            mgr.ImportProjectNodesetXml();

            /*
             * ///////////////////////////////////////
             * //Sample code for instantiating an object. Uncomment the code below.
             * ///////////////////////////////////////
             * //Opc.Ua.Server.ServerInternalData by default adds the application configuration <ApplicationUri>
             * //to the namespace which makes our starting namespace index to 2.
             * string fromObjectTypeNodeId         = "29855";          // Node id to instantiate from.
             * ushort fromObjectTypeNamespaceIndex = 2;                // Node Id namespace index to instantiate from.
             * IdType fromObjectTypeNodeIdType     = IdType.Numeric;   // Node Id Type  to instantiate from.
             *
             * string instanceBrowseName       = "myDotNetObjB";
             * string instanceDisplayName      = "myDotNetObjD";
             * string instanceNodeId           = "myDotNetObjI";
             * ushort instanceNamespaceIndex   = 2;
             * IdType instanceNodeIdType       = IdType.String;
             *
             * string parentNodeId             = "85";                 //Objects Folder
             * ushort parentNamespaceIndex     = 0;                    //OPC UA namespace
             * IdType parentNodeIdType         = IdType.Numeric;
             *
             * string objectTypeFileNoExtension = "type_ObjectType_MyObjectType_1991378193_0";
             *
             * Dictionary<CodeGenNodeID, CodeGenNodeID> childrenIDMap = new Dictionary<CodeGenNodeID, CodeGenNodeID>();
             * //Uncomment code below to change children's Node ID. Add more in the map for other children.
             * //CodeGenNodeID nodeSource = new CodeGenNodeID("20600", 2, IdType.Numeric);
             * //CodeGenNodeID newNodeId  = new CodeGenNodeID("myVarNewIdFromCode", 2, IdType.String);
             * //childrenIDMap.Add(nodeSource, newNodeId);
             *
             * CodeGenObjectTypeBase objectBase = mgr.CreateObject(childrenIDMap, null,
             *                                                   objectTypeFileNoExtension, instanceBrowseName,
             *                                                   fromObjectTypeNodeId, fromObjectTypeNamespaceIndex, fromObjectTypeNodeIdType,
             *                                                   instanceNodeId, instanceNamespaceIndex, parentNodeIdType,
             *                                                   parentNodeId, parentNamespaceIndex, instanceNodeIdType
             *                                                  );
             * ObjectType_MyObjectType_1991378193_0 obj = objectBase as ObjectType_MyObjectType_1991378193_0;
             * obj.GetNode().DisplayName = instanceDisplayName;
             * mgr.AddToReferences(new NodeStateReference(ReferenceTypes.Organizes, false, obj.GetNode().NodeId));
             * mgr.AddPredefinedNodeExt(mgr.SystemContext, obj.GetNode());
             *
             * //Sample code to change the browse name of the child. Children are accessible directly from their parent.
             * //obj.obj_MyObjectChild_obj1_1697828377_0.GetNode().BrowseName = "NewBrowseNameFromCode";
             */
        }
        public override bool Initialize(Dictionary <CodeGenNodeID, CodeGenNodeID> childrenIDMap,
                                        CodeGenNodeManager addressSpaceMgr)
        {
            Console.WriteLine("VariableType_RoomName_627147307_0::Initialize");

            bool success = true;

            m_addressSpaceMgr = addressSpaceMgr;
            ushort namespaceIndex = 0;

            // Set attributes
            this.GetNode().UserWriteMask           = AttributeWriteMask.None;
            this.GetNode().UserAccessLevel         = AccessLevels.CurrentRead;
            this.GetNode().Timestamp               = DateTime.UtcNow;
            this.GetNode().StatusCode              = StatusCodes.Good;
            this.GetNode().OnWriteValue            = CodeGenReadWriteHandler.GetInstance().OnWrite;
            this.GetNode().OnReadValue             = CodeGenReadWriteHandler.GetInstance().OnRead;
            this.GetNode().BrowseName              = "RoomName";
            this.GetNode().DisplayName             = "RoomName";
            this.GetNode().Description             = "";
            this.GetNode().Historizing             = false;
            this.GetNode().MinimumSamplingInterval = 0;
            this.GetNode().AccessLevel             = AccessLevels.None | AccessLevels.CurrentRead;
            this.GetNode().WriteMask               = AttributeWriteMask.None



            ;

            /*********************/
            // Set Default Value
            /*********************/
            bool   setDefaultValue  = true;
            string defaultValueStr  = "String";
            string defaultValueType = "String";

            if (setDefaultValue)
            {
                try
                {
                    if (defaultValueType == "Decimal")
                    {
                        this.GetNode().Value = Convert.ToDecimal(defaultValueStr);
                    }
                    else if (defaultValueType == "Double")
                    {
                        this.GetNode().Value = Convert.ToDouble(defaultValueStr);
                    }
                    else if (defaultValueType == "Boolean")
                    {
                        this.GetNode().Value = (defaultValueStr == "1");
                    }
                    else if (defaultValueType == "SByte")
                    {
                        this.GetNode().Value = Convert.ToSByte(defaultValueStr);
                    }
                    else if (defaultValueType == "Int16")
                    {
                        this.GetNode().Value = Convert.ToInt16(defaultValueStr);
                    }
                    else if (defaultValueType == "Int32")
                    {
                        this.GetNode().Value = Convert.ToInt32(defaultValueStr);
                    }
                    else if (defaultValueType == "Int64")
                    {
                        this.GetNode().Value = Convert.ToInt64(defaultValueStr);
                    }
                    else if (defaultValueType == "Byte")
                    {
                        this.GetNode().Value = Convert.ToByte(defaultValueStr);
                    }
                    else if (defaultValueType == "UInt16")
                    {
                        this.GetNode().Value = Convert.ToUInt16(defaultValueStr);
                    }
                    else if (defaultValueType == "UInt32")
                    {
                        this.GetNode().Value = Convert.ToUInt16(defaultValueStr);
                    }
                    else if (defaultValueType == "UInt64")
                    {
                        this.GetNode().Value = Convert.ToUInt16(defaultValueStr);
                    }
                    else
                    {
                        this.GetNode().Value = defaultValueStr; //Everything else will be set as string.
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error setting node's default value to:{0} error:{1}", defaultValueStr, ex.ToString());
                }
            }

            //Create Children variables


            //Create Children properties


            return(success);
        }
        public override bool Initialize(Dictionary <CodeGenNodeID, CodeGenNodeID> childrenIDMap,
                                        CodeGenNodeManager addressSpaceMgr)
        {
            Console.WriteLine("ObjectType_Station_468461068_0::Initialize");

            bool success = true;

            m_addressSpaceMgr = addressSpaceMgr;
            ushort namespaceIndex = 0;

            // Set attributes
            this.GetNode().BrowseName  = "Station";
            this.GetNode().DisplayName = "Station";
            this.GetNode().Description = "";
            this.GetNode().WriteMask   = AttributeWriteMask.None



            ;

            //Create Children objects


            //Create Children variables

            {
                string childBrowseName            = "Name";
                string childFileNoExtension       = "type_VariableType_Name_420871476_0";
                string childTypeDefId             = "63";
                ushort childTypeDefNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childTypeDefNodeIdType     = 0;

                string childDataTypeId             = "12";
                ushort childDataTypeNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childDataTypeNodeIdType     = 0;
                int    childDataTypeValueRank      = -1;
                string childDataTypeArrayDimension = "";

                string childSourceId             = "9837";
                ushort childSourceNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("ModelStation");
                ushort childSourceNodeIdType     = 1;
                NodeId newChildId = Helper.CreateID(childrenIDMap, m_addressSpaceMgr,
                                                    childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType);

                var_Name_420871476_0 = (VariableType_Name_420871476_0)
                                       (m_addressSpaceMgr.CreateVariable(childrenIDMap,
                                                                         this.GetNode(), childFileNoExtension, childBrowseName,
                                                                         childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType,
                                                                         newChildId.Identifier.ToString(), newChildId.NamespaceIndex, (IdType)newChildId.IdType,
                                                                         m_nodeId, m_namespaceIndex, m_nodeIdType,
                                                                         childDataTypeValueRank));
                VariableType_Name_420871476_0 local = var_Name_420871476_0;
                m_addressSpaceMgr.AddPredefinedNodeExt(m_addressSpaceMgr.SystemContext, local.GetNode());

                local.SetDataType(childDataTypeId, childDataTypeNamespaceIndex, (IdType)childDataTypeNodeIdType);
            }

            {
                string childBrowseName            = "TargetTemp";
                string childFileNoExtension       = "type_VariableType_TargetTemp_1537019957_0";
                string childTypeDefId             = "63";
                ushort childTypeDefNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childTypeDefNodeIdType     = 0;

                string childDataTypeId             = "10";
                ushort childDataTypeNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childDataTypeNodeIdType     = 0;
                int    childDataTypeValueRank      = -1;
                string childDataTypeArrayDimension = "";

                string childSourceId             = "29520";
                ushort childSourceNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("ModelStation");
                ushort childSourceNodeIdType     = 0;
                NodeId newChildId = Helper.CreateID(childrenIDMap, m_addressSpaceMgr,
                                                    childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType);

                var_TargetTemp_1537019957_0 = (VariableType_TargetTemp_1537019957_0)
                                              (m_addressSpaceMgr.CreateVariable(childrenIDMap,
                                                                                this.GetNode(), childFileNoExtension, childBrowseName,
                                                                                childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType,
                                                                                newChildId.Identifier.ToString(), newChildId.NamespaceIndex, (IdType)newChildId.IdType,
                                                                                m_nodeId, m_namespaceIndex, m_nodeIdType,
                                                                                childDataTypeValueRank));
                VariableType_TargetTemp_1537019957_0 local = var_TargetTemp_1537019957_0;
                m_addressSpaceMgr.AddPredefinedNodeExt(m_addressSpaceMgr.SystemContext, local.GetNode());

                local.SetDataType(childDataTypeId, childDataTypeNamespaceIndex, (IdType)childDataTypeNodeIdType);
            }

            {
                string childBrowseName            = "NowTemp";
                string childFileNoExtension       = "type_VariableType_NowTemp_1652098010_0";
                string childTypeDefId             = "63";
                ushort childTypeDefNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childTypeDefNodeIdType     = 0;

                string childDataTypeId             = "10";
                ushort childDataTypeNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childDataTypeNodeIdType     = 0;
                int    childDataTypeValueRank      = -1;
                string childDataTypeArrayDimension = "";

                string childSourceId             = "16599";
                ushort childSourceNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("ModelStation");
                ushort childSourceNodeIdType     = 0;
                NodeId newChildId = Helper.CreateID(childrenIDMap, m_addressSpaceMgr,
                                                    childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType);

                var_NowTemp_1652098010_0 = (VariableType_NowTemp_1652098010_0)
                                           (m_addressSpaceMgr.CreateVariable(childrenIDMap,
                                                                             this.GetNode(), childFileNoExtension, childBrowseName,
                                                                             childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType,
                                                                             newChildId.Identifier.ToString(), newChildId.NamespaceIndex, (IdType)newChildId.IdType,
                                                                             m_nodeId, m_namespaceIndex, m_nodeIdType,
                                                                             childDataTypeValueRank));
                VariableType_NowTemp_1652098010_0 local = var_NowTemp_1652098010_0;
                m_addressSpaceMgr.AddPredefinedNodeExt(m_addressSpaceMgr.SystemContext, local.GetNode());

                local.SetDataType(childDataTypeId, childDataTypeNamespaceIndex, (IdType)childDataTypeNodeIdType);
            }

            {
                string childBrowseName            = "Heat";
                string childFileNoExtension       = "type_VariableType_Heat_2031185702_0";
                string childTypeDefId             = "63";
                ushort childTypeDefNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childTypeDefNodeIdType     = 0;

                string childDataTypeId             = "1";
                ushort childDataTypeNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childDataTypeNodeIdType     = 0;
                int    childDataTypeValueRank      = -1;
                string childDataTypeArrayDimension = "";

                string childSourceId             = "26810";
                ushort childSourceNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("ModelStation");
                ushort childSourceNodeIdType     = 0;
                NodeId newChildId = Helper.CreateID(childrenIDMap, m_addressSpaceMgr,
                                                    childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType);

                var_Heat_2031185702_0 = (VariableType_Heat_2031185702_0)
                                        (m_addressSpaceMgr.CreateVariable(childrenIDMap,
                                                                          this.GetNode(), childFileNoExtension, childBrowseName,
                                                                          childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType,
                                                                          newChildId.Identifier.ToString(), newChildId.NamespaceIndex, (IdType)newChildId.IdType,
                                                                          m_nodeId, m_namespaceIndex, m_nodeIdType,
                                                                          childDataTypeValueRank));
                VariableType_Heat_2031185702_0 local = var_Heat_2031185702_0;
                m_addressSpaceMgr.AddPredefinedNodeExt(m_addressSpaceMgr.SystemContext, local.GetNode());

                local.SetDataType(childDataTypeId, childDataTypeNamespaceIndex, (IdType)childDataTypeNodeIdType);
            }


            //Create Children properties


            //Create Children methods



            return(success);
        }
Example #4
0
        public static NodeId CreateID(Dictionary <CodeGenNodeID, CodeGenNodeID> childrenIDMap, CodeGenNodeManager nodeMgr,
                                      object nodeId, ushort namespaceIndex, IdType nodeIdType)
        {
            CodeGenNodeID newNodeID       = null;
            CodeGenNodeID sourceNodeID    = new CodeGenNodeID(nodeId, namespaceIndex, nodeIdType);
            NodeId        newNodeIDToFind = null;

            bool foundInMap = childrenIDMap.TryGetValue(sourceNodeID, out newNodeID);

            if (foundInMap)
            {
                newNodeIDToFind = CreateID(newNodeID.NodeId, namespaceIndex, newNodeID.IDType);
                if (nodeMgr.Find(newNodeIDToFind) != null)
                {
                    throw new Exception("Helper.CreateID from childrenIDMap already exists in the address space.");
                }
            }

            /* If the needed new id is not in the childrenIDMap, create a custom ID with String Type
             * by trying first from 1 to whatever is next id non-existent in the address space.
             */
            if (!foundInMap)
            {
                newNodeID = new CodeGenNodeID(0, 0, IdType.String);
                newNodeID.NamespaceIndex = namespaceIndex;


                int numericId = 1;

                do
                {
                    if (nodeIdType != IdType.Numeric)
                    {
                        newNodeID.NodeId = (String)nodeId + "_" + Convert.ToString(numericId);
                    }
                    else
                    {
                        newNodeID.NodeId = Convert.ToString(numericId);
                    }

                    newNodeIDToFind = CreateID(newNodeID.NodeId, namespaceIndex, newNodeID.IDType);
                    numericId++;
                }while (nodeMgr.Find(newNodeIDToFind) != null);
            }

            return(CreateID(newNodeID.NodeId, namespaceIndex, newNodeID.IDType));
        }
        public override bool Initialize(Dictionary <CodeGenNodeID, CodeGenNodeID> childrenIDMap,
                                        CodeGenNodeManager addressSpaceMgr)
        {
            Console.WriteLine("ObjectType_RoomDTO_1054562535_0::Initialize");

            bool success = true;

            m_addressSpaceMgr = addressSpaceMgr;
            ushort namespaceIndex = 0;

            // Set attributes
            this.GetNode().BrowseName  = "RoomDTO";
            this.GetNode().DisplayName = "RoomDTO";
            this.GetNode().Description = "";
            this.GetNode().WriteMask   = AttributeWriteMask.None



            ;

            //Create Children objects


            //Create Children variables

            {
                string childBrowseName            = "Name-210620154030-14";
                string childFileNoExtension       = "type_VariableType_Name_210620154030_14_784679566_0";
                string childTypeDefId             = "63";
                ushort childTypeDefNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childTypeDefNodeIdType     = 0;

                string childDataTypeId             = "24";
                ushort childDataTypeNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childDataTypeNodeIdType     = 0;
                int    childDataTypeValueRank      = -1;
                string childDataTypeArrayDimension = "";

                string childSourceId             = "RoomName_DTO";
                ushort childSourceNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("TemperatureHandler");
                ushort childSourceNodeIdType     = 1;
                NodeId newChildId = Helper.CreateID(childrenIDMap, m_addressSpaceMgr,
                                                    childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType);

                var_Name_210620154030_14_784679566_0 = (VariableType_Name_210620154030_14_784679566_0)
                                                       (m_addressSpaceMgr.CreateVariable(childrenIDMap,
                                                                                         this.GetNode(), childFileNoExtension, childBrowseName,
                                                                                         childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType,
                                                                                         newChildId.Identifier.ToString(), newChildId.NamespaceIndex, (IdType)newChildId.IdType,
                                                                                         m_nodeId, m_namespaceIndex, m_nodeIdType,
                                                                                         childDataTypeValueRank));
                VariableType_Name_210620154030_14_784679566_0 local = var_Name_210620154030_14_784679566_0;
                m_addressSpaceMgr.AddPredefinedNodeExt(m_addressSpaceMgr.SystemContext, local.GetNode());

                local.SetDataType(childDataTypeId, childDataTypeNamespaceIndex, (IdType)childDataTypeNodeIdType);
            }

            {
                string childBrowseName            = "ActualTemperature_DTO";
                string childFileNoExtension       = "type_VariableType_ActualTemperature_DTO_325685183_0";
                string childTypeDefId             = "63";
                ushort childTypeDefNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childTypeDefNodeIdType     = 0;

                string childDataTypeId             = "24";
                ushort childDataTypeNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childDataTypeNodeIdType     = 0;
                int    childDataTypeValueRank      = -1;
                string childDataTypeArrayDimension = "";

                string childSourceId             = "ActualTemperature_DTO";
                ushort childSourceNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("TemperatureHandler");
                ushort childSourceNodeIdType     = 1;
                NodeId newChildId = Helper.CreateID(childrenIDMap, m_addressSpaceMgr,
                                                    childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType);

                var_ActualTemperature_DTO_325685183_0 = (VariableType_ActualTemperature_DTO_325685183_0)
                                                        (m_addressSpaceMgr.CreateVariable(childrenIDMap,
                                                                                          this.GetNode(), childFileNoExtension, childBrowseName,
                                                                                          childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType,
                                                                                          newChildId.Identifier.ToString(), newChildId.NamespaceIndex, (IdType)newChildId.IdType,
                                                                                          m_nodeId, m_namespaceIndex, m_nodeIdType,
                                                                                          childDataTypeValueRank));
                VariableType_ActualTemperature_DTO_325685183_0 local = var_ActualTemperature_DTO_325685183_0;
                m_addressSpaceMgr.AddPredefinedNodeExt(m_addressSpaceMgr.SystemContext, local.GetNode());

                local.SetDataType(childDataTypeId, childDataTypeNamespaceIndex, (IdType)childDataTypeNodeIdType);
            }

            {
                string childBrowseName            = "ID_DTO";
                string childFileNoExtension       = "type_VariableType_ID_DTO_1134910354_0";
                string childTypeDefId             = "63";
                ushort childTypeDefNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childTypeDefNodeIdType     = 0;

                string childDataTypeId             = "24";
                ushort childDataTypeNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childDataTypeNodeIdType     = 0;
                int    childDataTypeValueRank      = -1;
                string childDataTypeArrayDimension = "";

                string childSourceId             = "ID_DTO";
                ushort childSourceNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("TemperatureHandler");
                ushort childSourceNodeIdType     = 1;
                NodeId newChildId = Helper.CreateID(childrenIDMap, m_addressSpaceMgr,
                                                    childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType);

                var_ID_DTO_1134910354_0 = (VariableType_ID_DTO_1134910354_0)
                                          (m_addressSpaceMgr.CreateVariable(childrenIDMap,
                                                                            this.GetNode(), childFileNoExtension, childBrowseName,
                                                                            childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType,
                                                                            newChildId.Identifier.ToString(), newChildId.NamespaceIndex, (IdType)newChildId.IdType,
                                                                            m_nodeId, m_namespaceIndex, m_nodeIdType,
                                                                            childDataTypeValueRank));
                VariableType_ID_DTO_1134910354_0 local = var_ID_DTO_1134910354_0;
                m_addressSpaceMgr.AddPredefinedNodeExt(m_addressSpaceMgr.SystemContext, local.GetNode());

                local.SetDataType(childDataTypeId, childDataTypeNamespaceIndex, (IdType)childDataTypeNodeIdType);
            }

            {
                string childBrowseName            = "GoalTemperature_DTO";
                string childFileNoExtension       = "type_VariableType_GoalTemperature_DTO_606346491_0";
                string childTypeDefId             = "63";
                ushort childTypeDefNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childTypeDefNodeIdType     = 0;

                string childDataTypeId             = "24";
                ushort childDataTypeNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childDataTypeNodeIdType     = 0;
                int    childDataTypeValueRank      = -1;
                string childDataTypeArrayDimension = "";

                string childSourceId             = "GoalTemperature_DTO";
                ushort childSourceNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("TemperatureHandler");
                ushort childSourceNodeIdType     = 1;
                NodeId newChildId = Helper.CreateID(childrenIDMap, m_addressSpaceMgr,
                                                    childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType);

                var_GoalTemperature_DTO_606346491_0 = (VariableType_GoalTemperature_DTO_606346491_0)
                                                      (m_addressSpaceMgr.CreateVariable(childrenIDMap,
                                                                                        this.GetNode(), childFileNoExtension, childBrowseName,
                                                                                        childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType,
                                                                                        newChildId.Identifier.ToString(), newChildId.NamespaceIndex, (IdType)newChildId.IdType,
                                                                                        m_nodeId, m_namespaceIndex, m_nodeIdType,
                                                                                        childDataTypeValueRank));
                VariableType_GoalTemperature_DTO_606346491_0 local = var_GoalTemperature_DTO_606346491_0;
                m_addressSpaceMgr.AddPredefinedNodeExt(m_addressSpaceMgr.SystemContext, local.GetNode());

                local.SetDataType(childDataTypeId, childDataTypeNamespaceIndex, (IdType)childDataTypeNodeIdType);
            }


            //Create Children properties


            //Create Children methods



            return(success);
        }
Example #6
0
 public abstract bool Initialize(Dictionary <CodeGenNodeID, CodeGenNodeID> childrenIDMap, CodeGenNodeManager addressSpaceMgr);
        public override bool Initialize(Dictionary <CodeGenNodeID, CodeGenNodeID> childrenIDMap,
                                        CodeGenNodeManager addressSpaceMgr)
        {
            Console.WriteLine("ObjectType_ServerRequest_111707335_0::Initialize");

            bool success = true;

            m_addressSpaceMgr = addressSpaceMgr;
            ushort namespaceIndex = 0;

            // Set attributes
            this.GetNode().BrowseName  = "ServerRequest";
            this.GetNode().DisplayName = "ServerRequest";
            this.GetNode().Description = "";
            this.GetNode().WriteMask   = AttributeWriteMask.None



            ;

            //Create Children objects


            //Create Children variables


            //Create Children properties

            {
                string childBrowseName            = "GoalTemp";
                string childFileNoExtension       = "type_VariableType_GoalTemp_662026670_0";
                string childTypeDefId             = "68";
                ushort childTypeDefNamespaceIndex = 0;
                ushort childTypeDefNodeIdType     = 0;

                string childDataTypeId             = "24";
                ushort childDataTypeNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childDataTypeNodeIdType     = 0;
                int    childDataTypeValueRank      = -1;
                string childDataTypeArrayDimension = "";

                string childSourceId             = "GoalTemp";
                ushort childSourceNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("TemperatureHandler");
                ushort childSourceNodeIdType     = 1;
                NodeId newChildId = Helper.CreateID(childrenIDMap, m_addressSpaceMgr,
                                                    childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType);

                var_GoalTemp_662026670_0 = (VariableType_GoalTemp_662026670_0)
                                           (m_addressSpaceMgr.CreateProperty(childrenIDMap,
                                                                             this.GetNode(), childFileNoExtension, childBrowseName,
                                                                             childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType,
                                                                             newChildId.Identifier.ToString(), newChildId.NamespaceIndex, (IdType)newChildId.IdType,
                                                                             m_nodeId, m_namespaceIndex, m_nodeIdType,
                                                                             childDataTypeValueRank));
                VariableType_GoalTemp_662026670_0 local = var_GoalTemp_662026670_0;
                m_addressSpaceMgr.AddPredefinedNodeExt(m_addressSpaceMgr.SystemContext, local.GetNode());

                local.SetDataType(childDataTypeId, childDataTypeNamespaceIndex, (IdType)childDataTypeNodeIdType);
            }

            {
                string childBrowseName            = "RoomName";
                string childFileNoExtension       = "type_VariableType_RoomName_627147307_0";
                string childTypeDefId             = "68";
                ushort childTypeDefNamespaceIndex = 0;
                ushort childTypeDefNodeIdType     = 0;

                string childDataTypeId             = "24";
                ushort childDataTypeNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("http://opcfoundation.org/UA/");
                ushort childDataTypeNodeIdType     = 0;
                int    childDataTypeValueRank      = -1;
                string childDataTypeArrayDimension = "";

                string childSourceId             = "RoomName";
                ushort childSourceNamespaceIndex = (ushort)m_addressSpaceMgr.SystemContext.NamespaceUris.GetIndex("TemperatureHandler");
                ushort childSourceNodeIdType     = 1;
                NodeId newChildId = Helper.CreateID(childrenIDMap, m_addressSpaceMgr,
                                                    childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType);

                var_RoomName_627147307_0 = (VariableType_RoomName_627147307_0)
                                           (m_addressSpaceMgr.CreateProperty(childrenIDMap,
                                                                             this.GetNode(), childFileNoExtension, childBrowseName,
                                                                             childSourceId, childSourceNamespaceIndex, (IdType)childSourceNodeIdType,
                                                                             newChildId.Identifier.ToString(), newChildId.NamespaceIndex, (IdType)newChildId.IdType,
                                                                             m_nodeId, m_namespaceIndex, m_nodeIdType,
                                                                             childDataTypeValueRank));
                VariableType_RoomName_627147307_0 local = var_RoomName_627147307_0;
                m_addressSpaceMgr.AddPredefinedNodeExt(m_addressSpaceMgr.SystemContext, local.GetNode());

                local.SetDataType(childDataTypeId, childDataTypeNamespaceIndex, (IdType)childDataTypeNodeIdType);
            }


            //Create Children methods



            return(success);
        }