示例#1
0
        /// <summary>
        /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
        /// </summary>
        protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
        {
            NodeStateCollection predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context, "Quickstarts.DataTypes.Types.Quickstarts.DataTypes.Types.PredefinedNodes.uanodes", typeof(Quickstarts.DataTypes.Types.VehicleType).Assembly, true);
            predefinedNodes.LoadFromBinaryResource(context, "Quickstarts.DataTypes.Instances.Quickstarts.DataTypes.Instances.PredefinedNodes.uanodes", null, true);

            return(predefinedNodes);
        }
        /// <summary>
        /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
        /// </summary>
        protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
        {
            var type            = GetType().GetTypeInfo();
            var predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context,
                                                   $"{type.Assembly.GetName().Name}.Servers.{type.Namespace}.Design.{type.Namespace}.Types.PredefinedNodes.uanodes",
                                                   type.Assembly, true);
            predefinedNodes.LoadFromBinaryResource(context,
                                                   $"{type.Assembly.GetName().Name}.Servers.{type.Namespace}.Design.{type.Namespace}.Instances.PredefinedNodes.uanodes",
                                                   type.Assembly, true);
            return(predefinedNodes);
        }
示例#3
0
        /// <summary>
        /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
        /// </summary>
        protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
        {
            NodeStateCollection predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context,
                                                   "Quickstarts.Boiler.Server.Opc.Ua.MTConnect.PredefinedNodes.uanodes",
                                                   typeof(BoilerNodeManager).GetTypeInfo().Assembly,
                                                   true);
            predefinedNodes.LoadFromBinaryResource(context,
                                                   "Quickstarts.Boiler.Server.Quickstarts.Boiler.PredefinedNodes.uanodes",
                                                   typeof(BoilerNodeManager).GetTypeInfo().Assembly,
                                                   true);
            return(predefinedNodes);
        }
示例#4
0
        /// <inheritdoc/>
        public void LoadUaDefinedTypes(ISystemContext context)
        {
            if (m_uaTypesLoaded)
            {
                return;
            }

            NodeStateCollection predefinedNodes = new NodeStateCollection();
            var assembly = typeof(ArgumentCollection).GetTypeInfo().Assembly;

            predefinedNodes.LoadFromBinaryResource(context, "Opc.Ua.Stack.Generated.Opc.Ua.PredefinedNodes.uanodes", assembly, true);

            for (int ii = 0; ii < predefinedNodes.Count; ii++)
            {
                BaseTypeState type = predefinedNodes[ii] as BaseTypeState;

                if (type == null)
                {
                    continue;
                }

                type.Export(context, m_nodes);
            }
            m_uaTypesLoaded = true;
        }
示例#5
0
        /// <summary>
        /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
        /// </summary>
        protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
        {
            NodeStateCollection predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context, "TutorialServer.Model.TutorialModel.PredefinedNodes.uanodes", null, true);
            return(predefinedNodes);
        }
        /// <summary>
        /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
        /// </summary>
        protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
        {
            NodeStateCollection predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context, "Quickstarts.Servers.Boiler.Boiler.PredefinedNodes.uanodes", this.GetType().GetTypeInfo().Assembly, true);
            return(predefinedNodes);
        }
        /// <summary>
        /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
        /// </summary>
        protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
        {
            NodeStateCollection predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context, "Quickstarts.SimpleEvents.Server.Quickstarts.SimpleEvents.PredefinedNodes.uanodes", null, true);
            return(predefinedNodes);
        }
        /// <summary>
        /// Loads a node set from a file or resource and address them to the set of predefined nodes.
        /// </summary>
        protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
        {
            // We know the model name to load but because this project is compiled for different environments we don't know
            // the assembly it is in. Therefor we search for it:
            var assembly     = this.GetType().GetTypeInfo().Assembly;
            var names        = assembly.GetManifestResourceNames();
            var resourcePath = String.Empty;

            foreach (var module in names)
            {
                if (module.Contains("SampleCompany.SampleServer.Model.PredefinedNodes.uanodes"))
                {
                    resourcePath = module;
                    break;
                }
            }

            if (resourcePath == String.Empty)
            {
                // No assembly found containing the nodes of the model. Behaviour here can differ but in this case we just return null.
                return(null);
            }

            var predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context, resourcePath, assembly, true);
            return(predefinedNodes);
        }
示例#9
0
        /// <summary>
        /// Loads a node set from a file or resource and adds them to the set of predefined nodes.
        /// </summary>
        protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
        {
            NodeStateCollection predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context, "Opc.Ua.Gds.Server.Model.Opc.Ua.Gds.PredefinedNodes.uanodes", typeof(ApplicationsNodeManager).GetTypeInfo().Assembly, true);
            return(predefinedNodes);
        }
示例#10
0
        /// <summary>
        /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
        /// </summary>
        protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
        {
            NodeStateCollection predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context, "Opc.Ua.Com.Common.Opc.Ua.Com.PredefinedNodes.uanodes", null, true);
            return(predefinedNodes);
        }
示例#11
0
        /// <summary>
        /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
        /// </summary>
        protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
        {
            NodeStateCollection predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context, "Opc.Ua.Sample.TCD.TCD.PredefinedNodes.uanodes", this.GetType().GetTypeInfo().Assembly, true);
            return(predefinedNodes);
        }
示例#12
0
        protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
        {
            NodeStateCollection predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context, Resources.BinaryNodePath.ToString(), this.GetType().GetTypeInfo().Assembly, true);
            Console.WriteLine("***MyOPCServer: number of Node loaded from source " + predefinedNodes.Count.ToString() + "***");
            return(predefinedNodes);
        }
 protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
 {
     NodeStateCollection predefinedNodes = new NodeStateCollection();
     predefinedNodes.LoadFromBinaryResource(context,
         "MicrosoftOpcUa.PredefinedNodes.uanodes",
         typeof(MicrosoftOpcUaNodeManager).GetTypeInfo().Assembly,
         true);
     return predefinedNodes;
 }
示例#14
0
        /// <summary>
        /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
        /// </summary>
        protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
        {
            NodeStateCollection predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context,
                                                   "SimpleEvent/SimpleEvents.PredefinedNodes.uanodes",
                                                   typeof(SimpleEventsNodeManager).GetTypeInfo().Assembly,
                                                   true);
            return(predefinedNodes);
        }
        /// <summary>
        /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
        /// </summary>
        protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
        {
            // Set your .uanodes file to Build Action = Embedded Resource
            // resourcePath parameter of LoadFromBinaryResource() is project name + directory + file name

            NodeStateCollection predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context, "OpcUaChatServer.Server." + "OpcUa.Model.Published." + "OpcUaChatServer.PredefinedNodes.uanodes", this.GetType().GetTypeInfo().Assembly, true);
            return(predefinedNodes);
        }
        /// <summary>
        /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
        /// </summary>
        protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
        {
            NodeStateCollection predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context,
                                                   "Quickstarts.HistoricalEvents.Server.Model.Quickstarts.HistoricalEvents.PredefinedNodes.uanodes",
                                                   typeof(HistoricalEventsNodeManager).GetTypeInfo().Assembly,
                                                   true);
            return(predefinedNodes);
        }
示例#17
0
        protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
        {
            NodeStateCollection predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context,
                                                   @"ModelDesignOutput\ITSOPCCourseCode.OPCUA.SampleServer.PredefinedNodes.uanodes",
                                                   typeof(SampleNodeManager).GetTypeInfo().Assembly,
                                                   true);

            return(predefinedNodes);
        }
示例#18
0
        /// <summary>
        /// Loads the UA defined types into the cache.
        /// </summary>
        /// <param name="context">The context.</param>
        public void LoadUaDefinedTypes(ISystemContext context)
        {
            NodeStateCollection predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context, "Opc.Ua.Stack.Generated.Opc.Ua.PredefinedNodes.uanodes", typeof(NodeState).Assembly, true);

            for (int ii = 0; ii < predefinedNodes.Count; ii++)
            {
                BaseTypeState type = predefinedNodes[ii] as BaseTypeState;

                if (type == null)
                {
                    continue;
                }

                type.Export(context, m_nodes);
            }
        }
示例#19
0
        /// <summary>
        /// Indexes the well known subtypes.
        /// </summary>
        private void IndexWellKnownTypes()
        {
            SystemContext context = new SystemContext();
            context.EncodeableFactory = m_session.MessageContext.Factory;
            context.NamespaceUris = m_session.NamespaceUris;
            context.ServerUris = m_session.ServerUris;

            NodeStateCollection predefinedNodes = new NodeStateCollection();
            predefinedNodes.LoadFromBinaryResource(context, "Opc.Ua.Stack.Generated.Opc.Ua.PredefinedNodes.uanodes", typeof(NodeState).Assembly, true);
            
            NodeIdDictionary<BaseTypeState> types = new NodeIdDictionary<BaseTypeState>();

            // collect the instance declarations for all types.
            for (int ii = 0; ii < predefinedNodes.Count; ii++)
            {
                BaseTypeState type = predefinedNodes[ii] as BaseTypeState;

                if (type != null)
                {
                    types.Add(type.NodeId, type);
                }
            }

            // index only those types which are subtypes of BaseEventType.
            foreach (BaseTypeState type in types.Values)
            {
                BaseTypeState subType = type;
                BaseTypeState superType = null;

                int eventType = 0;

                while (subType != null)
                {
                    if (subType.NodeId == Opc.Ua.ObjectTypeIds.ConditionType || subType.SuperTypeId == Opc.Ua.ObjectTypeIds.ConditionType)
                    {
                        eventType = OpcRcw.Ae.Constants.CONDITION_EVENT;
                    }

                    else if (subType.NodeId == Opc.Ua.ObjectTypeIds.AuditEventType || subType.SuperTypeId == Opc.Ua.ObjectTypeIds.AuditEventType)
                    {
                        eventType = OpcRcw.Ae.Constants.TRACKING_EVENT;
                    }

                    else if (subType.NodeId == Opc.Ua.ObjectTypeIds.BaseEventType || subType.SuperTypeId == Opc.Ua.ObjectTypeIds.BaseEventType)
                    {
                        eventType = OpcRcw.Ae.Constants.SIMPLE_EVENT;
                    }

                    // found an event, collect the attribute and index it.
                    if (eventType != 0)
                    {
                        List<AeEventAttribute> declarations = new List<AeEventAttribute>();
                        Dictionary<string, AeEventAttribute> map = new Dictionary<string, AeEventAttribute>();

                        ComAeUtils.CollectInstanceDeclarations(
                            m_session,
                            this,
                            type,
                            null,
                            declarations,
                            map);

                        AeEventCategory declaration = new AeEventCategory();
                        declaration.TypeId = type.NodeId;
                        declaration.SuperTypeId = type.SuperTypeId;
                        declaration.EventType = eventType;
                        declaration.Description = (LocalizedText.IsNullOrEmpty(type.DisplayName))?type.BrowseName.Name:type.DisplayName.Text;
                        declaration.Attributes = declarations;
                        m_eventTypes[declaration.TypeId] = declaration;
                        break;
                    }

                    // follow the tree to the parent.
                    if (!types.TryGetValue(subType.SuperTypeId, out superType))
                    {
                        break;
                    }

                    subType = superType;
                }
            }

            // hide the built in attributes.
            AeEventCategory category = GetCategory(Opc.Ua.ObjectTypeIds.BaseEventType);

            if (category != null)
            {
                for (int ii = 0; ii < category.Attributes.Count; ii++)
                {
                    switch (category.Attributes[ii].BrowsePathDisplayText)
                    {
                        case Opc.Ua.BrowseNames.Message:
                        case Opc.Ua.BrowseNames.Severity:
                        case Opc.Ua.BrowseNames.SourceName:
                        case Opc.Ua.BrowseNames.Time:
                        case Opc.Ua.BrowseNames.ReceiveTime:
                        case Opc.Ua.BrowseNames.LocalTime:
                        {
                            category.Attributes[ii].Hidden = true;
                            break;
                        }
                    }
                }
            }
        }
示例#20
0
 /// <summary>
 /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
 /// </summary>
 protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context) {
     NodeStateCollection predefinedNodes = new NodeStateCollection();
     predefinedNodes.LoadFromBinaryResource(context, "Opc.Ua.Sample.TestData.TestData.PredefinedNodes.uanodes",
         null, true);
     return predefinedNodes;
 }
示例#21
0
        /// <summary>
        /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
        /// </summary>
        protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
        {
            NodeStateCollection predefinedNodes = new NodeStateCollection();
            
            predefinedNodes.LoadFromBinaryResource(context, "Quickstarts.DataTypes.Types.Quickstarts.DataTypes.Types.PredefinedNodes.uanodes", typeof(Quickstarts.DataTypes.Types.VehicleType).Assembly, true);
            predefinedNodes.LoadFromBinaryResource(context, "Quickstarts.DataTypes.Instances.Quickstarts.DataTypes.Instances.PredefinedNodes.uanodes", null, true);

            return predefinedNodes;
        }
示例#22
0
 /// <summary>
 /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
 /// </summary>
 protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
 {
     NodeStateCollection predefinedNodes = new NodeStateCollection();
     predefinedNodes.LoadFromBinaryResource(context, "Quickstarts.ViewsServer.Model.Quickstarts.Views.PredefinedNodes.uanodes", null, true);
     return predefinedNodes;
 }
        /// <summary>
        /// Loads the UA defined types into the cache.
        /// </summary>
        /// <param name="context">The context.</param>
        public void LoadUaDefinedTypes(ISystemContext context)
        {
            NodeStateCollection predefinedNodes = new NodeStateCollection();
            predefinedNodes.LoadFromBinaryResource(context, "Opc.Ua.Core.Stack.Generated.Opc.Ua.PredefinedNodes.uanodes", typeof(ArgumentCollection).GetTypeInfo().Assembly, true);
            
            for (int ii = 0; ii < predefinedNodes.Count; ii++)
            {
                BaseTypeState type = predefinedNodes[ii] as BaseTypeState;

                if (type == null)
                {
                    continue;
                }

                type.Export(context, m_nodes);
            }
        }
示例#24
0
 /// <summary>
 /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
 /// </summary>
 protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
 {
     NodeStateCollection predefinedNodes = new NodeStateCollection();
     predefinedNodes.LoadFromBinaryResource(context, "Opc.Ua.Com.Common.Opc.Ua.Com.PredefinedNodes.uanodes", null, true);
     return predefinedNodes;
 }
示例#25
0
        /// <summary>
        /// Indexes the well known subtypes.
        /// </summary>
        private void IndexWellKnownTypes()
        {
            SystemContext context = new SystemContext();

            context.EncodeableFactory = m_session.MessageContext.Factory;
            context.NamespaceUris     = m_session.NamespaceUris;
            context.ServerUris        = m_session.ServerUris;

            NodeStateCollection predefinedNodes = new NodeStateCollection();

            predefinedNodes.LoadFromBinaryResource(context, "Opc.Ua.Stack.Generated.Opc.Ua.PredefinedNodes.uanodes", typeof(NodeState).Assembly, true);

            NodeIdDictionary <BaseTypeState> types = new NodeIdDictionary <BaseTypeState>();

            // collect the instance declarations for all types.
            for (int ii = 0; ii < predefinedNodes.Count; ii++)
            {
                BaseTypeState type = predefinedNodes[ii] as BaseTypeState;

                if (type != null)
                {
                    types.Add(type.NodeId, type);
                }
            }

            // index only those types which are subtypes of BaseEventType.
            foreach (BaseTypeState type in types.Values)
            {
                BaseTypeState subType   = type;
                BaseTypeState superType = null;

                int eventType = 0;

                while (subType != null)
                {
                    if (subType.NodeId == Opc.Ua.ObjectTypeIds.ConditionType || subType.SuperTypeId == Opc.Ua.ObjectTypeIds.ConditionType)
                    {
                        eventType = OpcRcw.Ae.Constants.CONDITION_EVENT;
                    }

                    else if (subType.NodeId == Opc.Ua.ObjectTypeIds.AuditEventType || subType.SuperTypeId == Opc.Ua.ObjectTypeIds.AuditEventType)
                    {
                        eventType = OpcRcw.Ae.Constants.TRACKING_EVENT;
                    }

                    else if (subType.NodeId == Opc.Ua.ObjectTypeIds.BaseEventType || subType.SuperTypeId == Opc.Ua.ObjectTypeIds.BaseEventType)
                    {
                        eventType = OpcRcw.Ae.Constants.SIMPLE_EVENT;
                    }

                    // found an event, collect the attribute and index it.
                    if (eventType != 0)
                    {
                        List <AeEventAttribute> declarations      = new List <AeEventAttribute>();
                        Dictionary <string, AeEventAttribute> map = new Dictionary <string, AeEventAttribute>();

                        ComAeUtils.CollectInstanceDeclarations(
                            m_session,
                            this,
                            type,
                            null,
                            declarations,
                            map);

                        AeEventCategory declaration = new AeEventCategory();
                        declaration.TypeId               = type.NodeId;
                        declaration.SuperTypeId          = type.SuperTypeId;
                        declaration.EventType            = eventType;
                        declaration.Description          = (LocalizedText.IsNullOrEmpty(type.DisplayName))?type.BrowseName.Name:type.DisplayName.Text;
                        declaration.Attributes           = declarations;
                        m_eventTypes[declaration.TypeId] = declaration;
                        break;
                    }

                    // follow the tree to the parent.
                    if (!types.TryGetValue(subType.SuperTypeId, out superType))
                    {
                        break;
                    }

                    subType = superType;
                }
            }

            // hide the built in attributes.
            AeEventCategory category = GetCategory(Opc.Ua.ObjectTypeIds.BaseEventType);

            if (category != null)
            {
                for (int ii = 0; ii < category.Attributes.Count; ii++)
                {
                    switch (category.Attributes[ii].BrowsePathDisplayText)
                    {
                    case Opc.Ua.BrowseNames.Message:
                    case Opc.Ua.BrowseNames.Severity:
                    case Opc.Ua.BrowseNames.SourceName:
                    case Opc.Ua.BrowseNames.Time:
                    case Opc.Ua.BrowseNames.ReceiveTime:
                    case Opc.Ua.BrowseNames.LocalTime:
                    {
                        category.Attributes[ii].Hidden = true;
                        break;
                    }
                    }
                }
            }
        }
示例#26
0
 /// <summary>
 /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
 /// </summary>
 protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
 {
     NodeStateCollection predefinedNodes = new NodeStateCollection();
     predefinedNodes.LoadFromBinaryResource(context, "Opc.Ua.Stack.Generated.Opc.Ua.PredefinedNodes.uanodes", typeof(NodeState).Assembly, true);
     return predefinedNodes;
 }
示例#27
0
 /// <summary>
 /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
 /// </summary>
 protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
 {
     NodeStateCollection predefinedNodes = new NodeStateCollection();
     predefinedNodes.LoadFromBinaryResource(context, "DsatsDemoServer.Model.DsatsDemo.PredefinedNodes.uanodes", null, true);
     return predefinedNodes;
 }
 /// <summary>
 /// Loads a node set from a file or resource and addes them to the set of predefined nodes.
 /// </summary>
 protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
 {
     NodeStateCollection predefinedNodes = new NodeStateCollection();
     predefinedNodes.LoadFromBinaryResource(context, "Opc.Ua.Sample.TestData.TestData.PredefinedNodes.uanodes", this.GetType().GetTypeInfo().Assembly, true);
     return predefinedNodes;
 }