/// <summary> /// Does any initialization required before the address space can be used. /// </summary> /// <remarks> /// The externalReferences is an out parameter that allows the node manager to link to nodes /// in other node managers. For example, the 'Objects' node is managed by the CoreNodeManager and /// should have a reference to the root folder node(s) exposed by this node manager. /// </remarks> public override void CreateAddressSpace(IDictionary <NodeId, IList <IReference> > externalReferences) { lock (Lock) { // ensure the namespace used by the node manager is in the server's namespace table. m_typeNamespaceIndex = Server.NamespaceUris.GetIndexOrAppend(Namespaces.TestData); m_namespaceIndex = Server.NamespaceUris.GetIndexOrAppend(Namespaces.TestData + "/Instance"); base.CreateAddressSpace(externalReferences); // start monitoring the system status. m_systemStatusCondition = (TestSystemConditionState)FindPredefinedNode( new NodeId(Objects.Data_Conditions_SystemStatus, m_typeNamespaceIndex), typeof(TestSystemConditionState)); if (m_systemStatusCondition != null) { m_systemStatusTimer = new Timer(OnCheckSystemStatus, null, 5000, 5000); m_systemStatusCondition.Retain.Value = true; } // link all conditions to the conditions folder. NodeState conditionsFolder = (NodeState)FindPredefinedNode( new NodeId(Objects.Data_Conditions, m_typeNamespaceIndex), typeof(NodeState)); foreach (NodeState node in PredefinedNodes.Values) { ConditionState condition = node as ConditionState; if (condition != null && !Object.ReferenceEquals(condition.Parent, conditionsFolder)) { condition.AddNotifier(SystemContext, null, true, conditionsFolder); conditionsFolder.AddNotifier(SystemContext, null, false, condition); } } // enable history for all numeric scalar values. ScalarValueObjectState scalarValues = (ScalarValueObjectState)FindPredefinedNode( new NodeId(Objects.Data_Dynamic_Scalar, m_typeNamespaceIndex), typeof(ScalarValueObjectState)); scalarValues.Int32Value.Historizing = true; scalarValues.Int32Value.AccessLevel = (byte)(scalarValues.Int32Value.AccessLevel | AccessLevels.HistoryRead); m_system.EnableHistoryArchiving(scalarValues.Int32Value); } }