/// <summary> /// Adds an OPC UA Node to this OPC UA server topology node using the OPC UA node description. /// </summary> public void AddOpcServerNode(ContosoOpcNodeDescription opcUaNodeDescription, List <ContosoPerformanceRelevance> opcUaNodeRelevance) { foreach (var node in NodeList) { if (OpCodeRequiresOpcUaNode(opcUaNodeDescription.OpCode) && node.NodeId == opcUaNodeDescription.NodeId ) { throw new Exception(string.Format("The OPC UA node with NodeId '{0}' and SymbolicName '{1}' does already exist. Please change.", opcUaNodeDescription.NodeId, opcUaNodeDescription.SymbolicName)); } } ContosoOpcUaNode opcUaNodeObject = new ContosoOpcUaNode( opcUaNodeDescription.NodeId, opcUaNodeDescription.SymbolicName, opcUaNodeRelevance, opcUaNodeDescription); NodeList.Add(opcUaNodeObject); }
/// <summary> /// Ctor for a Contoso OPC UA node, using alert related descriptions. /// </summary> public ContosoOpcUaNode( string opcUaNodeId, string opcUaSymbolicName, List <ContosoPerformanceRelevance> opcUaNodeRelevance, ContosoOpcNodeDescription opcNodeDescription) : base(opcUaNodeId, opcUaSymbolicName) { Relevance = opcUaNodeRelevance; OpCode = opcNodeDescription.OpCode; Units = opcNodeDescription.Units; Visible = opcNodeDescription.Visible; ConstValue = opcNodeDescription.ConstValue; Minimum = opcNodeDescription.Minimum; Maximum = opcNodeDescription.Maximum; MinimumAlertActions = new List <ContosoAlertActionDefinition>(); MinimumAlertActions.AddRange(ContosoAlertActionDefinition.Init(opcNodeDescription.MinimumAlertActions)); MaximumAlertActions = new List <ContosoAlertActionDefinition>(); MaximumAlertActions.AddRange(ContosoAlertActionDefinition.Init(opcNodeDescription.MaximumAlertActions)); Last = new ContosoDataItem(); }