/// <summary> /// Constructs the router around the given system context. /// </summary> /// <param name="context">The context of the system where this /// router relies on.</param> /// <exception cref="ArgumentNullException"> /// If the <paramref name="context"/> parameter is <c>null</c>. /// </exception> public LogEventRouter(ISystemContext context) { if (context == null) throw new ArgumentNullException("context"); Context = context; }
/// <summary> /// Initializes the object as a collection of counters which change value on read. /// </summary> protected override void OnAfterCreate(ISystemContext context, NodeState node) { base.OnAfterCreate(context, node); UpdateStateVariable(context, Objects.ExclusiveLimitStateMachineType_High, CurrentState); UpdateTransitionVariable(context, 0, LastTransition); }
/// <summary> /// Initializes the object as a collection of counters which change value on read. /// </summary> protected override void OnAfterCreate(ISystemContext context, NodeState node) { base.OnAfterCreate(context, node); this.Simulation.OnAfterTransition = OnControlSimulation; m_random = new Random(); }
/// <summary> /// Initializes the instance with the default values. /// </summary> protected override void Initialize(ISystemContext context) { base.Initialize(context); Executable = true; UserExecutable = true; }
public SystemEventRegistry(ISystemContext context) { if (context == null) throw new ArgumentNullException("context"); Context = context; }
/// <summary> /// Adds an alias to the node set. /// </summary> public void AddAlias(ISystemContext context, string alias, Opc.Ua.NodeId nodeId) { int count = 1; if (this.Aliases != null) { for (int ii = 0; ii < this.Aliases.Length; ii++) { if (this.Aliases[ii].Alias == alias) { this.Aliases[ii].Value = Export(nodeId, context.NamespaceUris); return; } } count += this.Aliases.Length; } NodeIdAlias[] aliases = new NodeIdAlias[count]; if (this.Aliases != null) { Array.Copy(this.Aliases, aliases, this.Aliases.Length); } aliases[count-1] = new NodeIdAlias() { Alias = alias, Value = Export(nodeId, context.NamespaceUris) }; this.Aliases = aliases; }
/// <summary> /// Initializes the snapshot from an instance. /// </summary> /// <param name="context">The context.</param> /// <param name="state">The state.</param> public void Initialize( ISystemContext context, BaseInstanceState state) { m_typeDefinitionId = state.TypeDefinitionId; m_snapshot = CreateChildNode(context, state); }
/// <summary> /// Creates a new browser object with a set of filters. /// </summary> public AreaBrowser( ISystemContext context, ViewDescription view, NodeId referenceType, bool includeSubtypes, BrowseDirection browseDirection, QualifiedName browseName, IEnumerable<IReference> additionalReferences, bool internalOnly, AreaState area) : base( context, view, referenceType, includeSubtypes, browseDirection, browseName, additionalReferences, internalOnly) { m_stage = Stage.Begin; if (area != null) { m_area = AreaState.GetDirectory(context, area.NodeId); m_isRoot = area.IsRoot; } }
/// <summary> /// Initializes the instance with the default values. /// </summary> protected override void Initialize(ISystemContext context) { base.Initialize(context); InverseName = null; Symmetric = false; }
/// <summary> /// Creates a new browser object with a set of filters. /// </summary> public Browser( ISystemContext context, ViewDescription view, NodeId referenceType, bool includeSubtypes, BrowseDirection browseDirection, QualifiedName browseName, IEnumerable<IReference> additionalReferences, bool internalOnly, Opc.Ua.Client.Session client, NamespaceMapper mapper, NodeState source, NodeId rootId) : base( context, view, referenceType, includeSubtypes, browseDirection, browseName, additionalReferences, internalOnly) { m_client = client; m_mapper = mapper; m_source = source; m_rootId = rootId; m_stage = Stage.Begin; }
/// <summary> /// Checks if the directory has changed since the last check. /// </summary> public void CheckForChanges(ISystemContext context) { DirectoryInfo directory = GetDirectory(context, this.NodeId); if (directory == null) { return; } directory.Refresh(); DateTime lastWriteTime = DateTime.MinValue; if (!directory.Exists) { if (m_lastWriteTime == DateTime.MinValue) { return; } } else { lastWriteTime = directory.LastWriteTime.ToUniversalTime(); if (lastWriteTime == m_lastWriteTime) { return; } } this.LastUpdateTime.UpdateChangeMasks(NodeStateChangeMasks.Value); this.CreateController.UpdateChangeMasks(NodeStateChangeMasks.NonValue); m_lastWriteTime = lastWriteTime; }
/// <summary> /// Initializes an area from a directory. /// </summary> public AreaState(ISystemContext context, DirectoryInfo directoryInfo) : base(null) { directoryInfo.Refresh(); string name = directoryInfo.Name; // need to read the correct casing from the file system. if (directoryInfo.Exists) { DirectoryInfo[] directories = directoryInfo.Parent.GetDirectories(name); if (directories != null && directories.Length > 0) { name = directories[0].Name; } } // get the system to use. FileSystemMonitor system = context.SystemHandle as FileSystemMonitor; if (system != null) { this.NodeId = system.CreateNodeIdFromDirectoryPath(ObjectTypes.AreaType, directoryInfo.FullName); this.BrowseName = new QualifiedName(name, system.NamespaceIndex); this.OnValidate = system.ValidateArea; } this.DisplayName = new LocalizedText(name); this.EventNotifier = EventNotifiers.None; this.TypeDefinitionId = GetDefaultTypeDefinitionId(context.NamespaceUris); }
public PasswordRecoveryByRecoveryClue(IEmailSender eMailSender, ISystemContext systemContext, ICryptoProvider cryptoProvider, IConfigurationProvider configProvider) { this.eMailSender = eMailSender; this.systemContext = systemContext; this.cryptoProvider = cryptoProvider; this.configProvider = configProvider; }
public PasswordRecoveryByResetLink(IAccountContext accountContext, IEmailSender eMailSender, ISystemContext systemContext, IConfigurationProvider configProvider) { this.accountContext = accountContext; this.eMailSender = eMailSender; this.systemContext = systemContext; this.configProvider = configProvider; }
/// <summary> /// Sets the active state of the condition. /// </summary> /// <param name="context">The system context.</param> /// <param name="active">if set to <c>true</c> the condition is active.</param> public override void SetActiveState( ISystemContext context, bool active) { // set it inactive. if (!active) { SetLimitState(context, LimitAlarmStates.Inactive); return; } // check if the level state machine needs an initial state. if (this.LimitState.CurrentState.Id.Value != null) { base.SetActiveState(context, true); return; } // assume a high if the high limit is specified. if (this.HighLimit != null) { SetLimitState(context, LimitAlarmStates.High); } else { SetLimitState(context, LimitAlarmStates.Low); } }
public void TestTearDown() { OnTearDown(); if (QueryContext != null) QueryContext.Dispose(); if (session != null) session.Dispose(); if (Database != null) Database.Dispose(); if (DatabaseContext != null) DatabaseContext.Dispose(); if (SystemContext != null) SystemContext.Dispose(); Database = null; DatabaseContext = null; SystemContext = null; QueryContext = null; session = null; }
public TriggerEventRouter(ISystemContext systemContext) { if (systemContext == null) throw new ArgumentNullException("systemContext"); SystemContext = systemContext; }
/// <summary> /// Handles the generate values method. /// </summary> protected override ServiceResult OnGenerateValues( ISystemContext context, MethodState method, NodeId objectId, uint count) { TestDataSystem system = context.SystemHandle as TestDataSystem; if (system == null) { return StatusCodes.BadOutOfService; } GenerateValue(system, SByteValue); GenerateValue(system, ByteValue); GenerateValue(system, Int16Value); GenerateValue(system, UInt16Value); GenerateValue(system, Int32Value); GenerateValue(system, UInt32Value); GenerateValue(system, UInt32Value); GenerateValue(system, Int64Value); GenerateValue(system, UInt64Value); GenerateValue(system, FloatValue); GenerateValue(system, DoubleValue); GenerateValue(system, NumberValue); GenerateValue(system, IntegerValue); GenerateValue(system, UIntegerValue); return base.OnGenerateValues(context, method, objectId, count); }
/// <summary> /// Called after a node is created. /// </summary> protected override void OnAfterCreate(ISystemContext context, NodeState node) { base.OnAfterCreate(context, node); if (this.ShelvingState != null) { if (this.ShelvingState.UnshelveTime != null) { this.ShelvingState.UnshelveTime.OnSimpleReadValue = OnReadUnshelveTime; this.ShelvingState.UnshelveTime.MinimumSamplingInterval = 1000; } this.ShelvingState.OneShotShelve.OnCallMethod = OnOneShotShelve; this.ShelvingState.OneShotShelve.OnReadExecutable = IsOneShotShelveExecutable; this.ShelvingState.OneShotShelve.OnReadUserExecutable = IsOneShotShelveExecutable; this.ShelvingState.TimedShelve.OnCall = OnTimedShelve; this.ShelvingState.TimedShelve.OnReadExecutable = IsTimedShelveExecutable; this.ShelvingState.TimedShelve.OnReadUserExecutable = IsTimedShelveExecutable; this.ShelvingState.Unshelve.OnCallMethod = OnUnshelve; this.ShelvingState.Unshelve.OnReadExecutable = IsTimedShelveExecutable; this.ShelvingState.Unshelve.OnReadUserExecutable = IsTimedShelveExecutable; } }
/// <summary> /// Initializes the object as a collection of counters which change value on read. /// </summary> protected override void OnAfterCreate(ISystemContext context, NodeState node) { base.OnAfterCreate(context, node); InitializeVariable(context, BooleanValue, TestData.Variables.UserScalarValueObjectType_BooleanValue); InitializeVariable(context, SByteValue, TestData.Variables.UserScalarValueObjectType_SByteValue); InitializeVariable(context, ByteValue, TestData.Variables.UserScalarValueObjectType_ByteValue); InitializeVariable(context, Int16Value, TestData.Variables.UserScalarValueObjectType_Int16Value); InitializeVariable(context, UInt16Value, TestData.Variables.UserScalarValueObjectType_UInt16Value); InitializeVariable(context, Int32Value, TestData.Variables.UserScalarValueObjectType_Int32Value); InitializeVariable(context, UInt32Value, TestData.Variables.UserScalarValueObjectType_UInt32Value); InitializeVariable(context, Int64Value, TestData.Variables.UserScalarValueObjectType_Int64Value); InitializeVariable(context, UInt64Value, TestData.Variables.UserScalarValueObjectType_UInt64Value); InitializeVariable(context, FloatValue, TestData.Variables.UserScalarValueObjectType_FloatValue); InitializeVariable(context, DoubleValue, TestData.Variables.UserScalarValueObjectType_DoubleValue); InitializeVariable(context, StringValue, TestData.Variables.UserScalarValueObjectType_StringValue); InitializeVariable(context, DateTimeValue, TestData.Variables.UserScalarValueObjectType_DateTimeValue); InitializeVariable(context, GuidValue, TestData.Variables.UserScalarValueObjectType_GuidValue); InitializeVariable(context, ByteStringValue, TestData.Variables.UserScalarValueObjectType_ByteStringValue); InitializeVariable(context, XmlElementValue, TestData.Variables.UserScalarValueObjectType_XmlElementValue); InitializeVariable(context, NodeIdValue, TestData.Variables.UserScalarValueObjectType_NodeIdValue); InitializeVariable(context, ExpandedNodeIdValue, TestData.Variables.UserScalarValueObjectType_ExpandedNodeIdValue); InitializeVariable(context, QualifiedNameValue, TestData.Variables.UserScalarValueObjectType_QualifiedNameValue); InitializeVariable(context, LocalizedTextValue, TestData.Variables.UserScalarValueObjectType_LocalizedTextValue); InitializeVariable(context, StatusCodeValue, TestData.Variables.UserScalarValueObjectType_StatusCodeValue); InitializeVariable(context, VariantValue, TestData.Variables.UserScalarValueObjectType_VariantValue); }
/// <summary> /// Creates a new browser object with a set of filters. /// </summary> public NodeBrowser( ISystemContext context, ViewDescription view, NodeId referenceType, bool includeSubtypes, BrowseDirection browseDirection, QualifiedName browseName, IEnumerable<IReference> additionalReferences, bool internalOnly) { m_context = context; m_view = view; m_referenceType = referenceType; m_includeSubtypes = includeSubtypes; m_browseDirection = browseDirection; m_browseName = browseName; m_internalOnly = internalOnly; m_references = new List<IReference>(); m_index = 0; // add any additional references if they meet the criteria. if (additionalReferences != null) { foreach (IReference reference in additionalReferences) { if (IsRequired(reference.ReferenceTypeId, reference.IsInverse)) { m_references.Add(reference); } } } }
/// <summary> /// Creates a new browser object with a set of filters. /// </summary> /// <param name="context">The system context to use.</param> /// <param name="view">The view which may restrict the set of references/nodes found.</param> /// <param name="referenceType">The type of references being followed.</param> /// <param name="includeSubtypes">Whether subtypes of the reference type are followed.</param> /// <param name="browseDirection">Which way the references are being followed.</param> /// <param name="browseName">The browse name of a specific target (used when translating browse paths).</param> /// <param name="additionalReferences">Any additional references that should be included.</param> /// <param name="internalOnly">If true the browser should not making blocking calls to external systems.</param> /// <param name="itemId">The item id.</param> /// <param name="namespaceIndex">Index of the namespace.</param> public DaElementBrowser( ISystemContext context, ViewDescription view, NodeId referenceType, bool includeSubtypes, BrowseDirection browseDirection, QualifiedName browseName, IEnumerable<IReference> additionalReferences, bool internalOnly, string itemId, ushort namespaceIndex) : base( context, view, referenceType, includeSubtypes, browseDirection, browseName, additionalReferences, internalOnly) { m_itemId = itemId; m_namespaceIndex = namespaceIndex; m_stage = Stage.Begin; }
/// <summary> /// Initializes the object as a collection of counters which change value on read. /// </summary> protected override void OnAfterCreate(ISystemContext context, NodeState node) { base.OnAfterCreate(context, node); UpdateStateVariable(context, Objects.ProgramStateMachineType_Ready, CurrentState); UpdateTransitionVariable(context, 0, LastTransition); Start.OnCallMethod = OnStart; Start.OnReadExecutable = IsStartExecutable; Start.OnReadUserExecutable = IsStartUserExecutable; Suspend.OnCallMethod = OnSuspend; Suspend.OnReadExecutable = IsSuspendExecutable; Suspend.OnReadUserExecutable = IsSuspendUserExecutable; Resume.OnCallMethod = OnResume; Resume.OnReadExecutable = IsResumeExecutable; Resume.OnReadUserExecutable = IsResumeUserExecutable; Halt.OnCallMethod = OnHalt; Halt.OnReadExecutable = IsHaltExecutable; Halt.OnReadUserExecutable = IsHaltUserExecutable; Reset.OnCallMethod = OnReset; Reset.OnReadExecutable = IsResetExecutable; Reset.OnReadUserExecutable = IsResetUserExecutable; }
/// <summary> /// Initializes the object as a collection of counters which change value on read. /// </summary> protected override void OnAfterCreate(ISystemContext context, NodeState node) { base.OnAfterCreate(context, node); UpdateStateVariable(context, Objects.ShelvedStateMachineType_Unshelved, CurrentState); UpdateTransitionVariable(context, 0, LastTransition); }
/// <summary> /// Changes the state of the simulation. /// </summary> private ServiceResult OnControlSimulation( ISystemContext context, StateMachineState machine, uint transitionId, uint causeId, IList<object> inputArguments, IList<object> outputArguments) { switch (causeId) { case Opc.Ua.Methods.ProgramStateMachineType_Start: { if (m_simulationTimer != null) { m_simulationTimer.Dispose(); m_simulationTimer = null; } uint updateRate = this.Simulation.UpdateRate.Value; if (updateRate < 100) { updateRate = 100; Simulation.UpdateRate.Value = updateRate; } m_simulationContext = context; m_simulationTimer = new Timer(DoSimulation, null, (int)updateRate, (int)updateRate); break; } case Opc.Ua.Methods.ProgramStateMachineType_Halt: case Opc.Ua.Methods.ProgramStateMachineType_Suspend: { if (m_simulationTimer != null) { m_simulationTimer.Dispose(); m_simulationTimer = null; } m_simulationContext = context; break; } case Opc.Ua.Methods.ProgramStateMachineType_Reset: { if (m_simulationTimer != null) { m_simulationTimer.Dispose(); m_simulationTimer = null; } m_simulationContext = context; break; } } return ServiceResult.Good; }
public static SqlBinary AsBinary(this IQueryPlanNode planNode, ISystemContext context) { using (var memoryStream = new MemoryStream()) { context.SerializeQueryPlan(planNode, memoryStream); memoryStream.Flush(); return new SqlBinary(memoryStream.ToArray()); } }
internal SqlCompileContext(ISystemContext systemContext, string sourceText) { if (string.IsNullOrEmpty(sourceText)) throw new ArgumentNullException("sourceText"); SystemContext = systemContext; SourceText = sourceText; }
/// <summary> /// Creates a new instance of a item. /// </summary> public ArchiveItemState(ISystemContext context, ArchiveItem item, ushort namespaceIndex) : base(null) { m_archiveItem = item; this.TypeDefinitionId = VariableTypeIds.DataItemType; this.SymbolicName = m_archiveItem.Name; this.NodeId = ConstructId(m_archiveItem.UniquePath, namespaceIndex); this.BrowseName = new QualifiedName(m_archiveItem.Name, namespaceIndex); this.DisplayName = new LocalizedText(this.BrowseName.Name); this.Description = null; this.WriteMask = 0; this.UserWriteMask = 0; this.DataType = DataTypeIds.BaseDataType; this.ValueRank = ValueRanks.Scalar; this.AccessLevel = AccessLevels.HistoryReadOrWrite | AccessLevels.CurrentRead; this.UserAccessLevel = AccessLevels.HistoryReadOrWrite | AccessLevels.CurrentRead; this.MinimumSamplingInterval = MinimumSamplingIntervals.Indeterminate; this.Historizing = true; m_annotations = new PropertyState<Annotation>(this); m_annotations.ReferenceTypeId = ReferenceTypeIds.HasProperty; m_annotations.TypeDefinitionId = VariableTypeIds.PropertyType; m_annotations.SymbolicName = Opc.Ua.BrowseNames.Annotations; m_annotations.BrowseName = Opc.Ua.BrowseNames.Annotations; m_annotations.DisplayName = new LocalizedText(m_annotations.BrowseName.Name); m_annotations.Description = null; m_annotations.WriteMask = 0; m_annotations.UserWriteMask = 0; m_annotations.DataType = DataTypeIds.Annotation; m_annotations.ValueRank = ValueRanks.Scalar; m_annotations.AccessLevel = AccessLevels.HistoryReadOrWrite; m_annotations.UserAccessLevel = AccessLevels.HistoryReadOrWrite; m_annotations.MinimumSamplingInterval = MinimumSamplingIntervals.Indeterminate; m_annotations.Historizing = false; this.AddChild(m_annotations); m_annotations.NodeId = NodeTypes.ConstructIdForComponent(m_annotations, namespaceIndex); m_configuration = new HistoricalDataConfigurationState(this); m_configuration.MaxTimeInterval = new PropertyState<double>(m_configuration); m_configuration.MinTimeInterval = new PropertyState<double>(m_configuration); ; m_configuration.StartOfArchive = new PropertyState<DateTime>(m_configuration); m_configuration.StartOfOnlineArchive = new PropertyState<DateTime>(m_configuration); m_configuration.Create( context, null, Opc.Ua.BrowseNames.HAConfiguration, null, true); m_configuration.SymbolicName = Opc.Ua.BrowseNames.HAConfiguration; m_configuration.ReferenceTypeId = ReferenceTypeIds.HasHistoricalConfiguration; this.AddChild(m_configuration); }
/// <summary> /// Called after a node is created. /// </summary> protected override void OnAfterCreate(ISystemContext context, NodeState node) { base.OnAfterCreate(context, node); if (this.Respond != null) { this.Respond.OnCall = OnRespondCalled; } }
public void TestSetUp() { SystemContext = CreateSystemContext(); DatabaseContext = CreateDatabaseContext(SystemContext); Database = CreateDatabase(DatabaseContext); QueryContext = CreateQueryContext(Database); OnSetUp(); }
/// <summary> /// Updates the effective state for the condition. /// </summary> /// <param name="context">The context.</param> protected virtual void UpdateEffectiveState(ISystemContext context) { SetEffectiveSubState(context, this.EnabledState.Value, DateTime.MinValue); }