/// <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); }
private void RestoreIsExpandedState() { bool newIsExpanded = false; PropertyEntry property = this.PropertyEntry; if (property != null) { PropertyState state = PropertyStateContainer.Instance.GetPropertyState( ModelUtilities.GetCachedSubPropertyHierarchyPath(property)); newIsExpanded = state.SubPropertiesExpanded; } this.IsExpanded = newIsExpanded; _exposedSubProperties = false; }
/// <summary> /// /// </summary> /// <param name="html"></param> /// <param name="property"></param> /// <param name="joint"></param> /// <returns></returns> public static IHtmlString IconLabel(this HtmlHelper html, PropertyState property, bool joint = false) { IHtmlString result = null; var propertyName = property.Name; if (joint) { EntityTypeState entityType; html.CurrentHost().EntityTypeSet.TryGetEntityType(property.EntityTypeId, out entityType); propertyName = entityType.Name + propertyName; } result = string.IsNullOrEmpty(property.Icon) ? html.Raw(string.Format("<label>{0}</label>", property.Name)) : html.Raw(string.Format("<img src='/content/icons/16x16/{0}' /><label>{1}</label>", property.Icon, propertyName)); return(result); }
static PropertyState GetState(DmdType type) { if (type.TryGetData(out PropertyState state)) { return(state); } return(CreateState(type)); PropertyState CreateState(DmdType type2) { var state2 = new PropertyState(type2); return(type2.GetOrCreateData(() => state2)); } }
private ServiceResult OnWriteAnalogRange( ISystemContext context, NodeState node, NumericRange indexRange, QualifiedName dataEncoding, ref object value, ref StatusCode statusCode, ref DateTime timestamp) { PropertyState <Opc.Ua.Range> variable = node as PropertyState <Opc.Ua.Range>; ExtensionObject extensionObject = value as ExtensionObject; TypeInfo typeInfo = TypeInfo.Construct(value); if (variable == null || extensionObject == null || typeInfo == null || typeInfo == Opc.Ua.TypeInfo.Unknown) { return(StatusCodes.BadTypeMismatch); } Opc.Ua.Range newRange = extensionObject.Body as Opc.Ua.Range; AnalogItemState parent = variable.Parent as AnalogItemState; if (newRange == null || parent == null) { return(StatusCodes.BadTypeMismatch); } if (indexRange != NumericRange.Empty) { return(StatusCodes.BadIndexRangeInvalid); } TypeInfo parentTypeInfo = TypeInfo.Construct(parent.Value); Opc.Ua.Range parentRange = GetAnalogRange(parentTypeInfo.BuiltInType); if (parentRange.High < newRange.High || parentRange.Low > newRange.Low) { return(StatusCodes.BadOutOfRange); } value = newRange; return(ServiceResult.Good); }
protected void SetState(PropertyState newState) { switch (newState) { case PropertyState.Uninitialized: case PropertyState.Unchanged: case PropertyState.New: case PropertyState.Modified: case PropertyState.Deleted: this._state = newState; break; default: throw new ArgumentOutOfRangeException(nameof(newState), (object)newState, "New state must be a valid PropertyState."); } }
private void LoadNodeList(BaseObjectState trigger) { LogHelper.Instance.Info(string.Format("Nodes number:{0}.", channel.Nodes.Values.Count)); foreach (var node in channel.Nodes.Values) { node.SystemContext = this.SystemContext; node.NamespaceIndex = NamespaceIndex; node.Trigger = trigger; PropertyState property = BuildPropertyState(trigger, node.Key, node.Name, DataTypeHelper.GetDataTypeId(node.OpcNodeType)); node.OpcNode = property; trigger.AddChild(property); //LogHelper.Instance.Info(string.Format("Node:{0} is OK.",node.Key)); } }
public void PropertyItem_MouseUp(object sender, MouseEventArgs e) { if (this.Enabled && clickStarted) { if (clickStarted) { if (state == PropertyState.Checked) { state = PropertyState.Unchecked; } else if (state == PropertyState.Unchecked) { state = PropertyState.Checked; } else if (state == PropertyState.Closed) { if (type == PropertyType.Container) //open container { state = PropertyState.Openened; foreach (PropertyItem item in Controls) { item.Show(); } actualMove = 1 * this.Controls.Count * change; changeBounds(); ContainerOpened(this.ItemNr, this.Controls.Count); } else //open type field for editfield { } } else { state = PropertyState.Closed; foreach (PropertyItem item in Controls) { item.Hide(); } actualMove = -1 * this.Controls.Count * change; changeBounds(); ContainerClosed(this.itemNr, this.Controls.Count); } } this.Invalidate(); } clickStarted = false; }
public ServiceResult OnWriteValue(ISystemContext context, NodeState node, ref object value) { if (context.UserIdentity == null || context.UserIdentity.TokenType == UserTokenType.Anonymous) { TranslationInfo info = new TranslationInfo( "BadUserAccessDenied", "en-US", "User cannot change value."); return(new ServiceResult(StatusCodes.BadUserAccessDenied, new LocalizedText(info))); } // attempt to update file system. try { string filePath = value as string; PropertyState <string> variable = node as PropertyState <string>; if (!String.IsNullOrEmpty(variable.Value)) { FileInfo file = new FileInfo(variable.Value); if (file.Exists) { file.Delete(); } } if (!String.IsNullOrEmpty(filePath)) { FileInfo file = new FileInfo(filePath); using (StreamWriter writer = file.CreateText()) { writer.WriteLine(System.Security.Principal.WindowsIdentity.GetCurrent().Name); } } value = filePath; } catch (Exception e) { return(ServiceResult.Create(e, StatusCodes.BadUserAccessDenied, "Could not update file system.")); } return(ServiceResult.Good); }
public CodeGenVariableTypeBase CreateProperty(Dictionary <CodeGenNodeID, CodeGenNodeID> childrenIDMap, NodeState parent, string fileNoExtension, string name, string typeId, ushort typeNamespaceIndex, IdType typeNodeIdType, string nodeId, ushort namespaceIndex, IdType nodeIdType, string parentNodeId, ushort parentNamespaceIndex, IdType parentNodeIdType, int valueRank) { PropertyState property = new PropertyState(parent); property.SymbolicName = name; property.ReferenceTypeId = ReferenceTypes.HasProperty; property.TypeDefinitionId = VariableTypeIds.PropertyType; property.NodeId = Helper.CreateID(childrenIDMap, this, nodeId, namespaceIndex, nodeIdType); property.ValueRank = valueRank; property.ArrayDimensions = null; //TODO: More code for different types if (valueRank == ValueRanks.OneDimension) { property.ArrayDimensions = new ReadOnlyList <uint>(new List <uint> { 0 }); } else if (valueRank == ValueRanks.TwoDimensions) { property.ArrayDimensions = new ReadOnlyList <uint>(new List <uint> { 0, 0 }); } if (parent != null) { parent.AddChild(property); } CodeGenVariableTypeBase newNode = CodeGenNodeFactory.CreateVariable(name, fileNoExtension, typeId, typeNamespaceIndex, typeNodeIdType, nodeId, namespaceIndex, nodeIdType, parentNodeId, parentNamespaceIndex, parentNodeIdType); newNode.SetNode(property); newNode.IsProperty(true); newNode.Initialize(childrenIDMap, this); return(newNode); }
public PropertyState HasValue(ReferenceStep referenceStep) { PropertyReference propertyReference1 = new PropertyReference(referenceStep); object second = null; PropertyState propertyState1 = PropertyState.Unset; bool flag = false; SceneNode[] selectedNodes = this.designerContext.SelectionManager.SelectedNodes; if (selectedNodes != null && selectedNodes.Length > 0) { foreach (SceneNode node in selectedNodes) { PropertyReference propertyReference2 = this.FilterProperty(node, propertyReference1); if (propertyReference2 != null) { PropertyState propertyState2 = node.IsSet(propertyReference2); object computedValue = node.GetComputedValue(propertyReference2); if (!flag) { second = this.CopyIfFreezable(computedValue); propertyState1 = propertyState2; flag = true; } else { if (propertyState2 != propertyState1) { propertyState1 = PropertyState.Mixed; break; } if (!PropertyUtilities.Compare(computedValue, second, node.ViewModel.DefaultView)) { object obj = MixedProperty.Mixed; propertyState1 = PropertyState.Mixed; break; } } } } } if (!flag) { propertyState1 = this.designerContext.AmbientPropertyManager.GetAmbientValue(propertyReference1) == DependencyProperty.UnsetValue ? PropertyState.Unset : PropertyState.Set; } return(propertyState1); }
private static (PropertyNode prop, PropertyState state) SplitProperty(ControlInfoJson.RuleEntry rule) { var script = rule.InvariantScript; var prop = new PropertyNode() { Expression = new ExpressionNode() { Expression = script }, Identifier = rule.Property }; var state = new PropertyState() { PropertyName = rule.Property, ExtensionData = rule.ExtensionData, NameMap = rule.NameMap, RuleProviderType = rule.RuleProviderType }; return(prop, state); }
/// <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) { // create a object to represent the process being controlled. BaseObjectState process = new BaseObjectState(null); process.NodeId = new NodeId(1, NamespaceIndex); process.BrowseName = new QualifiedName("My Process", NamespaceIndex); process.DisplayName = process.BrowseName.Name; process.TypeDefinitionId = ObjectTypeIds.BaseObjectType; // ensure the process object can be found via the server object. IList <IReference> references = null; if (!externalReferences.TryGetValue(ObjectIds.ObjectsFolder, out references)) { externalReferences[ObjectIds.ObjectsFolder] = references = new List <IReference>(); } process.AddReference(ReferenceTypeIds.Organizes, true, ObjectIds.ObjectsFolder); references.Add(new NodeStateReference(ReferenceTypeIds.Organizes, false, process.NodeId)); // a property to report the process state. PropertyState <string> state = new PropertyState <string>(process); state.NodeId = new NodeId(2, NamespaceIndex); state.BrowseName = new QualifiedName("LogFilePath", NamespaceIndex); state.DisplayName = state.BrowseName.Name; state.TypeDefinitionId = VariableTypeIds.PropertyType; state.ReferenceTypeId = ReferenceTypeIds.HasProperty; state.DataType = DataTypeIds.String; state.ValueRank = ValueRanks.Scalar; state.AccessLevel = AccessLevels.CurrentReadOrWrite; state.UserAccessLevel = AccessLevels.CurrentRead; state.Value = ".\\Log.txt"; process.AddChild(state); state.OnReadUserAccessLevel = OnReadUserAccessLevel; state.OnSimpleWriteValue = OnWriteValue; // save in dictionary. AddPredefinedNode(SystemContext, process); } }
/// <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) { //----------------- A few examples of hard coded nodes in the Address Space ------------------- //counter for the NodeId identifier: uint id = 1; //a first node: BaseObjectState testObjectNode = new BaseObjectState(null); // Set the attributes: testObjectNode.NodeId = new NodeId(id++, NamespaceIndex); testObjectNode.BrowseName = new QualifiedName("test_ObjectNode", NamespaceIndex); testObjectNode.DisplayName = testObjectNode.BrowseName.Name; testObjectNode.TypeDefinitionId = ObjectTypeIds.BaseObjectType; // ensure testObjectNode can be found via the server object: add references to/from it! IList <IReference> references = null; if (!externalReferences.TryGetValue(ObjectIds.ObjectsFolder, out references)) { externalReferences[ObjectIds.ObjectsFolder] = references = new List <IReference>(); } testObjectNode.AddReference(ReferenceTypeIds.Organizes, true, ObjectIds.ObjectsFolder); references.Add(new NodeStateReference(ReferenceTypeIds.Organizes, false, testObjectNode.NodeId)); //a second node: PropertyState testPropertyNode = new PropertyState(testObjectNode); // Set the attributes: testPropertyNode.NodeId = new NodeId(id++, NamespaceIndex); testPropertyNode.BrowseName = new QualifiedName("test_PropertyNode", NamespaceIndex); testPropertyNode.DisplayName = testPropertyNode.BrowseName.Name; testPropertyNode.TypeDefinitionId = VariableTypeIds.PropertyType; testPropertyNode.ReferenceTypeId = ReferenceTypeIds.HasProperty; testPropertyNode.DataType = DataTypeIds.Int32; testPropertyNode.ValueRank = ValueRanks.OneDimension; testPropertyNode.ArrayDimensions = new ReadOnlyList <uint>(new uint[] { 5 }); testPropertyNode.Value = new int[] { 7, -18, 56, 0, 3 }; //add this node as a child of the previous node: testObjectNode.AddChild(testPropertyNode); // save in dictionary. AddPredefinedNode(SystemContext, testObjectNode); //--------------------------------------------------------------------------------------------- } }
/// <summary> /// プロパティ(入力コントロール)の表示状態の取得 /// </summary> /// <param name="PropertyName">プロパティ名</param> /// <returns>プロパティの表示状態</returns> public PropertyState GetPropertyState(string PropertyName) { PropertyState result = PropertyState.None; if (this.tableLayoutPanels.ContainsKey(PropertyName)) { if (this.tableLayoutPanels[PropertyName].Visible) { result = PropertyState.Show; } else { result = PropertyState.Hide; } } return(result); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return(null); } BaseInstanceState instance = null; switch (browseName.Name) { case animal.BrowseNames.Weight: { if (createOrReplace) { if (Weight == null) { if (replacement == null) { Weight = new PropertyState <double>(this); } else { Weight = (PropertyState <double>)replacement; } } } instance = Weight; break; } } if (instance != null) { return(instance); } return(base.FindChild(context, browseName, createOrReplace, replacement)); }
private EditorStateStore getEditorStateStore() { // creating dynamic properties with Property value null, but with PropertyName var dynPropStates = new List <DynamicPropertyState>(); dynPropStates.AddRange(new List <DynamicPropertyState> { new DynamicPropertyState() { PropertyName = "LayoutX" }, new DynamicPropertyState() { PropertyName = "LayoutY" }, new DynamicPropertyState() { PropertyName = "LayoutWidth" }, new DynamicPropertyState() { PropertyName = "LayoutHeight" }, }); var editorStateStore = new EditorStateStore(); var someProperty = new PropertyState() { PropertyName = "SomeProperty" }; editorStateStore.TryAddControl(new ControlState() { Name = "Canvas1", TopParentName = "Screen1", DynamicProperties = dynPropStates, HasDynamicProperties = true, Properties = new List <PropertyState> { someProperty }, StyleName = "fluidGrid" }); return(editorStateStore); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return(null); } BaseInstanceState instance = null; switch (browseName.Name) { case Quickstarts.SimpleEvents.BrowseNames.Error: { if (createOrReplace) { if (Error == null) { if (replacement == null) { Error = new PropertyState <StatusCode>(this); } else { Error = (PropertyState <StatusCode>)replacement; } } } instance = Error; break; } } if (instance != null) { return(instance); } return(base.FindChild(context, browseName, createOrReplace, replacement)); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return(null); } BaseInstanceState instance = null; switch (browseName.Name) { case Quickstarts.SimpleEvents.BrowseNames.Steps: { if (createOrReplace) { if (Steps == null) { if (replacement == null) { Steps = new PropertyState <CycleStepDataType[]>(this); } else { Steps = (PropertyState <CycleStepDataType[]>)replacement; } } } instance = Steps; break; } } if (instance != null) { return(instance); } return(base.FindChild(context, browseName, createOrReplace, replacement)); }
/// <summary> /// Initializes a new event. /// </summary> /// <param name="context">The current system context.</param> /// <param name="source">The source of the event.</param> /// <param name="severity">The severity for the event.</param> /// <param name="message">The default message.</param> public virtual void Initialize( ISystemContext context, NodeState source, EventSeverity severity, LocalizedText message) { m_eventId = new PropertyState<byte[]>(this); m_eventId.Value = Guid.NewGuid().ToByteArray(); m_eventType = new PropertyState<NodeId>(this); m_eventType.Value = GetDefaultTypeDefinitionId(context.NamespaceUris); TypeDefinitionId = m_eventType.Value; if (source != null) { if (!NodeId.IsNull(source.NodeId)) { m_sourceNode = new PropertyState<NodeId>(this); m_sourceNode.Value = source.NodeId; m_sourceNode.RolePermissions = source.RolePermissions; m_sourceNode.UserRolePermissions = source.UserRolePermissions; m_sourceNode.NodeId = source.NodeId; } if (!QualifiedName.IsNull(source.BrowseName)) { m_sourceName = new PropertyState<string>(this); m_sourceName.Value = source.BrowseName.Name; } } m_time = new PropertyState<DateTime>(this); m_time.Value = DateTime.UtcNow; m_receiveTime = new PropertyState<DateTime>(this); m_receiveTime.Value = DateTime.UtcNow; m_severity = new PropertyState<ushort>(this); m_severity.Value = (ushort)severity; m_message = new PropertyState<LocalizedText>(this); m_message.Value = message; }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return(null); } BaseInstanceState instance = null; switch (browseName.Name) { case VariableTypeTest.BrowseNames.VariableChild: { if (createOrReplace) { if (VariableChild == null) { if (replacement == null) { VariableChild = new PropertyState <int>(this); } else { VariableChild = (PropertyState <int>)replacement; } } } instance = VariableChild; break; } } if (instance != null) { return(instance); } return(base.FindChild(context, browseName, createOrReplace, replacement)); }
protected void PropertyCountry_SelectedIndexChanged(object sender, EventArgs e) { try { Int64 CountryId = Convert.ToInt64(PropertyCountry.SelectedValue.ToString() == "" ? "0" : PropertyCountry.SelectedValue.ToString()); SqlDataAdapter da = new SqlDataAdapter(); SqlCommand cmd = new SqlCommand("SP_State", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Mode", "SelectStateByCountryId"); cmd.Parameters.AddWithValue("@CountryId", CountryId); da.SelectCommand = cmd; da.Fill(ds); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { PropertyState.DataTextField = "StateName"; PropertyState.DataValueField = "StateId"; PropertyState.DataSource = ds; PropertyState.DataBind(); PropertyState.Items.Insert(0, new ListItem("---Select State---")); } else { PropertyState.DataSource = null; PropertyState.DataBind(); PropertyState.Items.Insert(0, new ListItem("---Select State---")); } } else { PropertyState.DataSource = null; PropertyState.DataBind(); PropertyState.Items.Insert(0, new ListItem("---Select State---")); } } catch (Exception e2) { Response.Write("Error occured : " + e2.Message.ToString()); } }
/// <summary> /// Initializes a new event. /// </summary> /// <param name="context">The current system context.</param> /// <param name="source">The source of the event.</param> /// <param name="severity">The severity for the event.</param> /// <param name="message">The default message.</param> public virtual void Initialize( ISystemContext context, NodeState source, EventSeverity severity, LocalizedText message) { m_eventId = new PropertyState<byte[]>(this); m_eventId.Value = Guid.NewGuid().ToByteArray(); m_eventType = new PropertyState<NodeId>(this); m_eventType.Value = GetDefaultTypeDefinitionId(context.NamespaceUris); TypeDefinitionId = m_eventType.Value; if (source != null) { if (!NodeId.IsNull(source.NodeId)) { m_sourceNode = new PropertyState<NodeId>(this); m_sourceNode.Value = source.NodeId; } if (!QualifiedName.IsNull(source.BrowseName)) { m_sourceName = new PropertyState<string>(this); m_sourceName.Value = source.BrowseName.Name; } } m_time = new PropertyState<DateTime>(this); m_time.Value = DateTime.UtcNow; m_receiveTime = new PropertyState<DateTime>(this); m_receiveTime.Value = DateTime.UtcNow; m_severity = new PropertyState<ushort>(this); m_severity.Value = (ushort)severity; m_message = new PropertyState<LocalizedText>(this); m_message.Value = message; }
public static PropertyTr Create(PropertyState property) { if (property == null) { return(null); } string clrPropertyType = string.Empty; string clrPropertyName = string.Empty; if (property.PropertyInfo != null) { clrPropertyType = property.PropertyInfo.PropertyType.Name; if (clrPropertyType == typeof(Nullable <>).Name) { clrPropertyType = property.PropertyInfo.PropertyType.GetGenericArguments()[0].Name + "?"; } clrPropertyName = property.PropertyInfo.Name; } return(new PropertyTr(property.AcDomain) { Code = property.Code, CreateOn = property.CreateOn, DicId = property.DicId, EntityTypeId = property.EntityTypeId, Icon = property.Icon, Id = property.Id, InputType = property.InputType, IsDetailsShow = property.IsDetailsShow, IsDeveloperOnly = property.IsDeveloperOnly, IsViewField = property.IsViewField, MaxLength = property.MaxLength, Name = property.Name, SortCode = property.SortCode, IsConfigValid = property.IsConfigValid, DbIsNullable = property.DbIsNullable, DbMaxLength = property.DbMaxLength, DbTypeName = property.DbTypeName, ClrPropertyType = clrPropertyType, ClrPropertyName = clrPropertyName }); }
public PropertyItem(string name, PropertyType type) { this.Name = name; this.type = type; this.Height = 15; this.Width = 150; if (type == PropertyType.EditField) { textBox = new TextBox(); this.Controls.Add(textBox); } if ( (type == PropertyType.Container) || (Type == PropertyType.EditField) ) state = PropertyState.Closed; else state = PropertyState.Checked; this.MouseDown += new MouseEventHandler(PropertyItem_MouseDown); this.MouseUp += new MouseEventHandler(PropertyItem_MouseUp); this.textRectangle = new Rectangle(18, 0,0, Height); }
/// <summary> /// Gets the result. /// </summary> /// <param name="context">The context.</param> /// <param name="source">The source.</param> /// <param name="nodeToRead">The node to read.</param> /// <param name="value">The value.</param> /// <param name="diagnosticsMasks">The diagnostics masks.</param> /// <returns></returns> public ServiceResult GetResult( ISystemContext context, NodeState source, ReadValueId nodeToRead, DataValue value, DiagnosticsMasks diagnosticsMasks) { ReadRequest request = nodeToRead.Handle as ReadRequest; if (request == null) { return(StatusCodes.Good); } // read item value. DaItemState item = source as DaItemState; if (item != null) { return(request.GetResult(context, item, nodeToRead, value, diagnosticsMasks)); } // read vendor defined property value. DaPropertyState daProperty = source as DaPropertyState; if (daProperty != null) { return(request.GetResult(context, daProperty, nodeToRead, value, diagnosticsMasks)); } // read UA defined property value. PropertyState uaProperty = source as PropertyState; if (uaProperty != null) { return(request.GetResult(context, uaProperty, nodeToRead, value, diagnosticsMasks)); } return(StatusCodes.Good); }
private static Tween PropertyStateTween(Material material, AnimatedProperty animation) { PropertyState state = animation.property; Tween tween; switch (state.propertyType) { case ShaderPropertyType.Color: tween = material.DOColor(state.colorValue, state.propertyID, state.duration); break; default: tween = material.DOFloat(state.floatValue, state.propertyID, state.duration); break; } tween.SetDelay(animation.StartDelay) .SetUpdate(Settings.IgnoreUnityTimescale) .SetSpeedBased(Settings.SpeedBasedAnimations) .SetEase(animation.Ease); return(tween); }
private PropertyState BuildPropertyState(BaseObjectState trigger, string targetName, string targetSimpleName, NodeId dataTypeId) { PropertyState property = new PropertyState(trigger); property.NodeId = new NodeId(targetName, NamespaceIndex); property.BrowseName = new QualifiedName(targetSimpleName, NamespaceIndex); property.DisplayName = property.BrowseName.Name; property.TypeDefinitionId = VariableTypeIds.PropertyType; property.ReferenceTypeId = ReferenceTypeIds.HasProperty; property.WriteMask = AttributeWriteMask.None; property.UserWriteMask = AccessLevels.None; property.AccessLevel = (byte)AccessLevels.CurrentReadOrWrite; property.UserAccessLevel = (byte)AccessLevels.CurrentReadOrWrite; property.MinimumSamplingInterval = MinimumSamplingIntervals.Continuous; property.Historizing = false; property.AccessRestrictions = AccessRestrictionType.None; property.ValueRank = ValueRanks.Scalar; property.DataType = dataTypeId; property.OnWriteValue = Property_NodeValueEventHandler; //property.Value = null; return(property); }
/// <summary> /// Initializes a new event. /// </summary> /// <param name="context">The current system context.</param> /// <param name="source">The source of the event.</param> /// <param name="severity">The severity for the event.</param> /// <param name="message">The default message.</param> /// <param name="status">Whether the operation that caused the event succeeded.</param> /// <param name="actionTimestamp">When the operation started.</param> public virtual void Initialize( ISystemContext context, NodeState source, EventSeverity severity, LocalizedText message, bool status, DateTime actionTimestamp) { base.Initialize(context, source, severity, message); m_status = new PropertyState <bool>(this); m_status.Value = status; if (actionTimestamp != DateTime.MinValue) { m_actionTimeStamp = new PropertyState <DateTime>(this); m_actionTimeStamp.Value = actionTimestamp; } if (context.NamespaceUris != null) { m_serverId = new PropertyState <string>(this); m_serverId.Value = context.NamespaceUris.GetString(1); } if (context.AuditEntryId != null) { m_clientAuditEntryId = new PropertyState <string>(this); m_clientAuditEntryId.Value = context.AuditEntryId; } if (context.UserIdentity != null) { m_clientUserId = new PropertyState <string>(this); m_clientUserId.Value = context.UserIdentity.DisplayName; } }
/// <summary> /// Initializes a new event. /// </summary> /// <param name="context">The current system context.</param> /// <param name="source">The source of the event.</param> /// <param name="severity">The severity for the event.</param> /// <param name="message">The default message.</param> /// <param name="status">Whether the operation that caused the event succeeded.</param> /// <param name="actionTimestamp">When the operation started.</param> public virtual void Initialize( ISystemContext context, NodeState source, EventSeverity severity, LocalizedText message, bool status, DateTime actionTimestamp) { base.Initialize(context, source, severity, message); m_status = new PropertyState<bool>(this); m_status.Value = status; if (actionTimestamp != DateTime.MinValue) { m_actionTimeStamp = new PropertyState<DateTime>(this); m_actionTimeStamp.Value = actionTimestamp; } if (context.NamespaceUris != null) { m_serverId = new PropertyState<string>(this); m_serverId.Value = context.NamespaceUris.GetString(1); } if (context.AuditEntryId != null) { m_clientAuditEntryId = new PropertyState<string>(this); m_clientAuditEntryId.Value = context.AuditEntryId; } if (context.UserIdentity != null) { m_clientUserId = new PropertyState<string>(this); m_clientUserId.Value = context.UserIdentity.DisplayName; } }
public void ValueTest() { PropertyState <double> _property = new PropertyState <double>(null, "PropertyState"); Assert.AreEqual <NodeStateChangeMasks>(NodeStateChangeMasks.Value, _property.ChangeMasks); Assert.AreEqual <double>(default(double), _property.Value); _property.ClearChangeMasks(new SystemContextFixture(), true); Assert.AreEqual <NodeStateChangeMasks>(NodeStateChangeMasks.None, _property.ChangeMasks); ISystemContext _returnedContext = null; NodeStateChangeMasks _returnedMask = NodeStateChangeMasks.None; NodeState _returnedNodeState = null; int _handlerCalled = 0; _property.OnStateChanged += (x, y, z) => { _returnedContext = x; _returnedNodeState = y; _returnedMask = z; _handlerCalled++; }; _property.Value = 999.99; Assert.AreEqual <NodeStateChangeMasks>(NodeStateChangeMasks.Value, _property.ChangeMasks); Assert.AreEqual <double>(999.99, _property.Value); _property.ClearChangeMasks(new SystemContextFixture(), true); Assert.AreEqual <int>(1, _handlerCalled); Assert.IsNotNull(_returnedContext); Assert.AreSame(_property, _returnedNodeState); Assert.AreEqual <NodeStateChangeMasks>(NodeStateChangeMasks.Value, _returnedMask); Assert.AreEqual <NodeStateChangeMasks>(NodeStateChangeMasks.None, _property.ChangeMasks); }
PropertyState GetPropertyState(string propertyPath, bool checkChildren = false) { PropertyState state = PropertyState.None; // we can have an early exit when state reach PropertyState.Both for (var index = 0; index < targets.Length && state != PropertyState.Both; index++) { Preset preset = (Preset)targets[index]; if (checkChildren && preset.excludedProperties.Any(p => p.StartsWith(propertyPath + ".", StringComparison.Ordinal))) { return(PropertyState.Both); } if (preset.excludedProperties.Any(p => p == propertyPath || propertyPath.StartsWith(p + ".", StringComparison.Ordinal))) { state |= PropertyState.Excluded; } else { state |= PropertyState.Included; } } return(state); }
private void PropertyStateBind() { try { ds = objInteraction.StateSelectAll(); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { PropertyState.DataTextField = "StateName"; PropertyState.DataValueField = "StateId"; PropertyState.DataSource = ds.Tables[0]; PropertyState.DataBind(); PropertyState.Items.Insert(0, new ListItem("---Select State---")); } else { PropertyState.DataSource = null; PropertyState.DataBind(); PropertyState.Items.Insert(0, new ListItem("---Select State---")); } } else { PropertyState.DataSource = null; PropertyState.DataBind(); PropertyState.Items.Insert(0, new ListItem("---Select State---")); } } catch (Exception ex) { } }
public void InitializeValueAndState( string propertyName, object propertyValue, PropertyState overrideState) { //Exceptions.ThrowIfNull((object)propertyName, nameof(propertyName)); IProperty property1 = (IProperty)this._properties[(object)propertyName]; if (property1 == null) { IProperty property2 = (IProperty) new ObjectProperty(overrideState, PropertyFlags.All, propertyValue); this._properties[(object)propertyName] = (object)property2; } else { if (property1.State != PropertyState.Uninitialized) { //throw new CrmArgumentException(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "InitializeValueAndState: method can only be applied to Uninitialized properties. PropertyName: {0}, PropertyValue: {1}, OverrideState: {2}", (object)propertyName, (object)propertyValue.ToString(), (object)overrideState.ToString()), nameof(propertyName)); throw new ArgumentException(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "InitializeValueAndState: method can only be applied to Uninitialized properties. PropertyName: {0}, PropertyValue: {1}, OverrideState: {2}", (object)propertyName, (object)propertyValue.ToString(), (object)overrideState.ToString()), nameof(propertyName)); } property1.Value = propertyValue; ((IPropertyManagement)property1).SetState(overrideState); } }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case Opc.Ua.Fdi7.BrowseNames.Address: { if (createOrReplace) { if (Address == null) { if (replacement == null) { Address = new PropertyState<byte[]>(this); } else { Address = (PropertyState<byte[]>)replacement; } } } instance = Address; break; } case Opc.Ua.Fdi7.BrowseNames.ProtocolIdentifier: { if (createOrReplace) { if (ProtocolIdentifier == null) { if (replacement == null) { ProtocolIdentifier = new PropertyState<string>(this); } else { ProtocolIdentifier = (PropertyState<string>)replacement; } } } instance = ProtocolIdentifier; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case Opc.Ua.Fdi7.BrowseNames.IPAddress: { if (createOrReplace) { if (IPAddress == null) { if (replacement == null) { IPAddress = new PropertyState<byte[]>(this); } else { IPAddress = (PropertyState<byte[]>)replacement; } } } instance = IPAddress; break; } case Opc.Ua.Fdi7.BrowseNames.DevMfg: { if (createOrReplace) { if (DevMfg == null) { if (replacement == null) { DevMfg = new PropertyState<uint>(this); } else { DevMfg = (PropertyState<uint>)replacement; } } } instance = DevMfg; break; } case Opc.Ua.Fdi7.BrowseNames.DevType: { if (createOrReplace) { if (DevType == null) { if (replacement == null) { DevType = new PropertyState<ushort>(this); } else { DevType = (PropertyState<ushort>)replacement; } } } instance = DevType; break; } case Opc.Ua.Fdi7.BrowseNames.DevRev: { if (createOrReplace) { if (DevRev == null) { if (replacement == null) { DevRev = new PropertyState<ushort>(this); } else { DevRev = (PropertyState<ushort>)replacement; } } } instance = DevRev; break; } case Opc.Ua.Fdi7.BrowseNames.DevTag: { if (createOrReplace) { if (DevTag == null) { if (replacement == null) { DevTag = new PropertyState<string>(this); } else { DevTag = (PropertyState<string>)replacement; } } } instance = DevTag; break; } case Opc.Ua.Fdi7.BrowseNames.DevPollAddr: { if (createOrReplace) { if (DevPollAddr == null) { if (replacement == null) { DevPollAddr = new PropertyState<byte>(this); } else { DevPollAddr = (PropertyState<byte>)replacement; } } } instance = DevPollAddr; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <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) { // create a object to represent the process being controlled. BaseObjectState process = new BaseObjectState(null); process.NodeId = new NodeId(1, NamespaceIndex); process.BrowseName = new QualifiedName("My Process", NamespaceIndex); process.DisplayName = process.BrowseName.Name; process.TypeDefinitionId = ObjectTypeIds.BaseObjectType; // ensure the process object can be found via the server object. IList<IReference> references = null; if (!externalReferences.TryGetValue(ObjectIds.ObjectsFolder, out references)) { externalReferences[ObjectIds.ObjectsFolder] = references = new List<IReference>(); } process.AddReference(ReferenceTypeIds.Organizes, true, ObjectIds.ObjectsFolder); references.Add(new NodeStateReference(ReferenceTypeIds.Organizes, false, process.NodeId)); // a property to report the process state. PropertyState<string> state = new PropertyState<string>(process); state.NodeId = new NodeId(2, NamespaceIndex); state.BrowseName = new QualifiedName("LogFilePath", NamespaceIndex); state.DisplayName = state.BrowseName.Name; state.TypeDefinitionId = VariableTypeIds.PropertyType; state.ReferenceTypeId = ReferenceTypeIds.HasProperty; state.DataType = DataTypeIds.String; state.ValueRank = ValueRanks.Scalar; state.AccessLevel = AccessLevels.CurrentReadOrWrite; state.UserAccessLevel = AccessLevels.CurrentRead; state.Value = ".\\Log.txt"; process.AddChild(state); state.OnReadUserAccessLevel = OnReadUserAccessLevel; state.OnSimpleWriteValue = OnWriteValue; // save in dictionary. AddPredefinedNode(SystemContext, process); } }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case Opc.Ua.Plc.BrowseNames.Priority: { if (createOrReplace) { if (Priority == null) { if (replacement == null) { Priority = new PropertyState<uint>(this); } else { Priority = (PropertyState<uint>)replacement; } } } instance = Priority; break; } case Opc.Ua.Plc.BrowseNames.Interval: { if (createOrReplace) { if (Interval == null) { if (replacement == null) { Interval = new PropertyState<string>(this); } else { Interval = (PropertyState<string>)replacement; } } } instance = Interval; break; } case Opc.Ua.Plc.BrowseNames.Single: { if (createOrReplace) { if (Single == null) { if (replacement == null) { Single = new PropertyState<string>(this); } else { Single = (PropertyState<string>)replacement; } } } instance = Single; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case MemoryBuffer.BrowseNames.StartAddress: { if (createOrReplace) { if (StartAddress == null) { if (replacement == null) { StartAddress = new PropertyState<uint>(this); } else { StartAddress = (PropertyState<uint>)replacement; } } } instance = StartAddress; break; } case MemoryBuffer.BrowseNames.SizeInBytes: { if (createOrReplace) { if (SizeInBytes == null) { if (replacement == null) { SizeInBytes = new PropertyState<uint>(this); } else { SizeInBytes = (PropertyState<uint>)replacement; } } } instance = SizeInBytes; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case Opc.Ua.Com.BrowseNames.ServerUrl: { if (createOrReplace) { if (ServerUrl == null) { if (replacement == null) { ServerUrl = new PropertyState<string>(this); } else { ServerUrl = (PropertyState<string>)replacement; } } } instance = ServerUrl; break; } case Opc.Ua.Com.BrowseNames.VendorInfo: { if (createOrReplace) { if (VendorInfo == null) { if (replacement == null) { VendorInfo = new PropertyState<string>(this); } else { VendorInfo = (PropertyState<string>)replacement; } } } instance = VendorInfo; break; } case Opc.Ua.Com.BrowseNames.SoftwareVersion: { if (createOrReplace) { if (SoftwareVersion == null) { if (replacement == null) { SoftwareVersion = new PropertyState<string>(this); } else { SoftwareVersion = (PropertyState<string>)replacement; } } } instance = SoftwareVersion; break; } case Opc.Ua.Com.BrowseNames.ServerState: { if (createOrReplace) { if (ServerState == null) { if (replacement == null) { ServerState = new PropertyState<string>(this); } else { ServerState = (PropertyState<string>)replacement; } } } instance = ServerState; break; } case Opc.Ua.Com.BrowseNames.CurrentTime: { if (createOrReplace) { if (CurrentTime == null) { if (replacement == null) { CurrentTime = new PropertyState<DateTime>(this); } else { CurrentTime = (PropertyState<DateTime>)replacement; } } } instance = CurrentTime; break; } case Opc.Ua.Com.BrowseNames.StartTime: { if (createOrReplace) { if (StartTime == null) { if (replacement == null) { StartTime = new PropertyState<DateTime>(this); } else { StartTime = (PropertyState<DateTime>)replacement; } } } instance = StartTime; break; } case Opc.Ua.Com.BrowseNames.LastUpdateTime: { if (createOrReplace) { if (LastUpdateTime == null) { if (replacement == null) { LastUpdateTime = new PropertyState<DateTime>(this); } else { LastUpdateTime = (PropertyState<DateTime>)replacement; } } } instance = LastUpdateTime; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
private void CheckIfSemanticsHaveChanged(ServerSystemContext systemContext, PropertyState property, object newPropertyValue, object previousPropertyValue) { // check if the changed property is one that can trigger semantic changes string propertyName = property.BrowseName.Name; if (propertyName != BrowseNames.EURange && propertyName != BrowseNames.InstrumentRange && propertyName != BrowseNames.EngineeringUnits && propertyName != BrowseNames.Title && propertyName != BrowseNames.AxisDefinition && propertyName != BrowseNames.FalseState && propertyName != BrowseNames.TrueState && propertyName != BrowseNames.EnumStrings && propertyName != BrowseNames.XAxisDefinition && propertyName != BrowseNames.YAxisDefinition && propertyName != BrowseNames.ZAxisDefinition) { return; } //look for the Parent and its monitoring items foreach (var monitoredNode in m_monitoredNodes.Values) { var propertyState = monitoredNode.Node.FindChild(systemContext, property.BrowseName); if (propertyState!=null && property!= null && propertyState.NodeId == property.NodeId && !Utils.IsEqual(newPropertyValue, previousPropertyValue)) { foreach (var monitoredItem in monitoredNode.DataChangeMonitoredItems) { if (monitoredItem.AttributeId == Attributes.Value) { NodeState node = monitoredNode.Node; if ((node is AnalogItemState && (propertyName == BrowseNames.EURange || propertyName == BrowseNames.EngineeringUnits)) || (node is TwoStateDiscreteState && (propertyName == BrowseNames.FalseState || propertyName == BrowseNames.TrueState)) || (node is MultiStateDiscreteState && (propertyName == BrowseNames.EnumStrings)) || (node is ArrayItemState && (propertyName == BrowseNames.InstrumentRange || propertyName == BrowseNames.EURange || propertyName == BrowseNames.EngineeringUnits || propertyName == BrowseNames.Title)) || ((node is YArrayItemState || node is XYArrayItemState) && (propertyName == BrowseNames.InstrumentRange || propertyName == BrowseNames.EURange || propertyName == BrowseNames.EngineeringUnits || propertyName == BrowseNames.Title || propertyName == BrowseNames.XAxisDefinition)) || (node is ImageItemState && (propertyName == BrowseNames.InstrumentRange || propertyName == BrowseNames.EURange || propertyName == BrowseNames.EngineeringUnits || propertyName == BrowseNames.Title || propertyName == BrowseNames.XAxisDefinition || propertyName == BrowseNames.YAxisDefinition)) || (node is CubeItemState && (propertyName == BrowseNames.InstrumentRange || propertyName == BrowseNames.EURange || propertyName == BrowseNames.EngineeringUnits || propertyName == BrowseNames.Title || propertyName == BrowseNames.XAxisDefinition || propertyName == BrowseNames.YAxisDefinition || propertyName == BrowseNames.ZAxisDefinition)) || (node is NDimensionArrayItemState && (propertyName == BrowseNames.InstrumentRange || propertyName == BrowseNames.EURange || propertyName == BrowseNames.EngineeringUnits || propertyName == BrowseNames.Title || propertyName == BrowseNames.AxisDefinition))) { monitoredItem.SetSemanticsChanged(); DataValue value = new DataValue(); value.ServerTimestamp = DateTime.UtcNow; monitoredNode.Node.ReadAttribute(systemContext, Attributes.Value, monitoredItem.IndexRange, null, value); monitoredItem.QueueValue(value, ServiceResult.Good, true); } } } } } }
/// <summary> /// Parses the DAV result. /// Note that it will only parse if the server status was 207. /// There maybe error outputs on 4xx and 5xx but this will not parsed /// by this class. /// </summary> /// <param name="request"></param> /// <param name="response"></param> /// <param name="uri"></param> public DAVRequestResult(WebDAV request, HttpWebResponse response, Uri uri) { Request = request; Items = new List<Item>(); Status = (ServerStatus)Enum.Parse(typeof(ServerStatus), response.StatusCode.ToString(), false); StatusText = response.StatusDescription; IsMultiState = Status == ServerStatus.MultiStatus; _stream = new MemoryStream(); response.GetResponseStream().CopyTo(_stream); // dispose response.Dispose(); _stream.Seek(0, SeekOrigin.Begin); if (_stream.Length == 0) return; // A kingdom for normal DOMDocument support. // Why not XDocument? XmlReader is faster and less resource hungry. // A huge multitstatus would be first loaded to memory completely. // // This reader can only go forward. Read-* methods will cause // to jump over elements. Hence we stop at the element and // store the element name. Then wait for Text-Elements value // to capture. using(XmlReader reader = XmlReader.Create(_stream, null)) { Item item = new Item(); var waitForResourceType = false; var lastElementName = ""; var waitForLockScope = false; var waitForLockType = false; List<DAVLocking> lockingList = null; List<PropertyState> propertyStateList = null; PropertyState pItem = null; DAVLocking litem = null; while (reader.Read()) { switch (reader.NodeType) { // look for special elements case XmlNodeType.Element: if (reader.NamespaceURI == XmlNamespaces.NsDav) { switch (reader.LocalName) { // DAV Elements // Response case Elements.Response: // start a new item // pItem must be set before d:prop in order to // catch non-real properties such "href" item = new Item(); propertyStateList = new List<PropertyState>(); pItem = new PropertyState(); break; // Resource type case Elements.Collection: if (waitForResourceType) { item.ResourceType = ResourceType.Collection; } break; // Lock case Elements.LockEntry: litem = new DAVLocking(); lockingList.Add(litem); break; case Elements.LockScope: waitForLockScope = true; break; case Elements.LockType: waitForLockType = true; break; case Elements.ExclusiveLocking: if (waitForLockScope) { litem.Scope = DAVLocking.LockScope.Exclusive; } break; case Elements.SharedLocking: if (waitForLockScope) { litem.Scope = DAVLocking.LockScope.Shared; } break; case Elements.WriteLocking: if (waitForLockType) { litem.Type = DAVLocking.LockType.Write; } break; case Elements.LockDiscovery: ///TODO break; // DAV Properties case Elements.Properties: // a pItem was already created before break; case Properties.ResourceType: waitForResourceType = true; break; case Properties.SupportedLock: lockingList = new List<DAVLocking>(); break; default: lastElementName = reader.LocalName; break; } } break; // clean up case XmlNodeType.EndElement: if (reader.NamespaceURI == XmlNamespaces.NsDav) { switch (reader.LocalName) { // DAV Elements case Elements.PropertyState: // save to list and create a new one (which stays maybe temporary) propertyStateList.Add(pItem); pItem = new PropertyState(); break; case Elements.Response: // clean the list // the HTTP Status is important foreach (PropertyState state in propertyStateList) { if (state.Status == ServerStatus.OK) { item.Properties = state.Properties; } else { item.FailedProperties.Add(state); } } // Close the item Items.Add(item); item = null; // Reset the property state list propertyStateList = null; pItem = null; break; // Locking case Elements.LockType: waitForLockType = false; break; case Elements.LockScope: waitForLockScope = false; break; // DAV Properties case Properties.ResourceType: waitForResourceType = false; break; case Properties.SupportedLock: item.Locking = lockingList; break; } } break; // Grap the text values case XmlNodeType.Text: // no whitespace please if (reader.Value == null) continue; // can't set in empty element if (item == null) continue; switch (lastElementName) { // DAV Elements case Elements.Reference: string _ref = Uri.UnescapeDataString(reader.Value); pItem.Properties.Add(lastElementName, _ref); pItem.Properties.Add(lastElementName + ".local", _ref.Trim('/').Split('/').Last()); break; // Status element case Elements.Status: List<string> s = new List<string>(reader.Value.Split(' ')); s.RemoveAt(0); pItem.Status = (ServerStatus)Enum.Parse(typeof(ServerStatus), s[0], false); s.RemoveAt(0); pItem.ServerStatusText = String.Join(" ", s.ToArray()); break; // DAV Properties case Properties.QuotaUsedBytes: case Properties.QuotaAvailableBytes: case Properties.GetContentLength: pItem.Properties.Add(lastElementName, long.Parse(reader.Value)); break; case Properties.DisplayName: case Properties.GetContentLanguage: case Properties.GetContentType: case Properties.GetETag: pItem.Properties.Add(lastElementName, reader.Value); break; case Properties.GetLastModified: case Properties.CreationDate: pItem.Properties.Add(lastElementName, DateTime.Parse(reader.Value)); break; } lastElementName = ""; break; } } } }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case Boiler.BrowseNames.Input1: { if (createOrReplace) { if (Input1 == null) { if (replacement == null) { Input1 = new PropertyState<double>(this); } else { Input1 = (PropertyState<double>)replacement; } } } instance = Input1; break; } case Boiler.BrowseNames.Input2: { if (createOrReplace) { if (Input2 == null) { if (replacement == null) { Input2 = new PropertyState<double>(this); } else { Input2 = (PropertyState<double>)replacement; } } } instance = Input2; break; } case Boiler.BrowseNames.Input3: { if (createOrReplace) { if (Input3 == null) { if (replacement == null) { Input3 = new PropertyState<double>(this); } else { Input3 = (PropertyState<double>)replacement; } } } instance = Input3; break; } case Boiler.BrowseNames.ControlOut: { if (createOrReplace) { if (ControlOut == null) { if (replacement == null) { ControlOut = new PropertyState<double>(this); } else { ControlOut = (PropertyState<double>)replacement; } } } instance = ControlOut; break; } case Boiler.BrowseNames.DescriptionX: { if (createOrReplace) { if (DescriptionX == null) { if (replacement == null) { DescriptionX = new PropertyState<LocalizedText>(this); } else { DescriptionX = (PropertyState<LocalizedText>)replacement; } } } instance = DescriptionX; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case Boiler.BrowseNames.Measurement: { if (createOrReplace) { if (Measurement == null) { if (replacement == null) { Measurement = new PropertyState<double>(this); } else { Measurement = (PropertyState<double>)replacement; } } } instance = Measurement; break; } case Boiler.BrowseNames.SetPoint: { if (createOrReplace) { if (SetPoint == null) { if (replacement == null) { SetPoint = new PropertyState<double>(this); } else { SetPoint = (PropertyState<double>)replacement; } } } instance = SetPoint; break; } case Boiler.BrowseNames.ControlOut: { if (createOrReplace) { if (ControlOut == null) { if (replacement == null) { ControlOut = new PropertyState<double>(this); } else { ControlOut = (PropertyState<double>)replacement; } } } instance = ControlOut; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case Boiler.BrowseNames.UpdateRate: { if (createOrReplace) { if (UpdateRate == null) { if (replacement == null) { UpdateRate = new PropertyState<uint>(this); } else { UpdateRate = (PropertyState<uint>)replacement; } } } instance = UpdateRate; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case Opc.Ua.Fdi7.BrowseNames.ProtocolIdentifier: { if (createOrReplace) { if (ProtocolIdentifier == null) { if (replacement == null) { ProtocolIdentifier = new PropertyState<string>(this); } else { ProtocolIdentifier = (PropertyState<string>)replacement; } } } instance = ProtocolIdentifier; break; } case Opc.Ua.Fdi7.BrowseNames.ServiceProvider: { if (createOrReplace) { if (ServiceProvider == null) { if (replacement == null) { ServiceProvider = new ServerCommunicationGENERICServiceState(this); } else { ServiceProvider = (ServerCommunicationGENERICServiceState)replacement; } } } instance = ServiceProvider; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case Opc.Ua.Fdi7.BrowseNames.Address: { if (createOrReplace) { if (Address == null) { if (replacement == null) { Address = new PropertyState<byte>(this); } else { Address = (PropertyState<byte>)replacement; } } } instance = Address; break; } case Opc.Ua.Fdi7.BrowseNames.OrdinalNumber: { if (createOrReplace) { if (OrdinalNumber == null) { if (replacement == null) { OrdinalNumber = new PropertyState<int>(this); } else { OrdinalNumber = (PropertyState<int>)replacement; } } } instance = OrdinalNumber; break; } case Opc.Ua.Fdi7.BrowseNames.SIFConnection: { if (createOrReplace) { if (SIFConnection == null) { if (replacement == null) { SIFConnection = new PropertyState<bool>(this); } else { SIFConnection = (PropertyState<bool>)replacement; } } } instance = SIFConnection; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case FileSystem.BrowseNames.LastUpdateTime: { if (createOrReplace) { if (LastUpdateTime == null) { if (replacement == null) { LastUpdateTime = new PropertyState<DateTime>(this); } else { LastUpdateTime = (PropertyState<DateTime>)replacement; } } } instance = LastUpdateTime; break; } case FileSystem.BrowseNames.CreateController: { if (createOrReplace) { if (CreateController == null) { if (replacement == null) { CreateController = new CreateControllerMethodState(this); } else { CreateController = (CreateControllerMethodState)replacement; } } } instance = CreateController; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Dispatches the event. /// </summary> private BaseEventState DispatchEvent(ONEVENTSTRUCT e) { NodeId typeId = AeParsedNodeId.Construct(e.dwEventType, e.dwEventCategory, e.szConditionName, m_namespaceIndex); // find the type. AeEventTypeState eventType = m_cache.FindType(m_defaultContext, typeId); if (eventType == null) { return null; } // create a new instance. BaseEventState instance = m_cache.CreateInstance(m_defaultContext, eventType); if (instance == null) { return null; } // fill in fields. UpdateBaseEvent(instance, eventType.EventType, e); if (instance is AuditEventState) { UpdateAuditEvent((AuditEventState)instance, eventType.EventType, e); } if (instance is AlarmConditionState) { UpdateAlarm((AlarmConditionState)instance, eventType.EventType, e); } if (instance is ExclusiveLimitAlarmState) { UpdateExclusiveLimitAlarm((ExclusiveLimitAlarmState)instance, eventType.EventType, e); } else if (instance is NonExclusiveLimitAlarmState) { UpdateNonExclusiveLimitAlarm((NonExclusiveLimitAlarmState)instance, eventType.EventType, e); } // process attributes. bool ackCommentFound = false; object[] values = ComUtils.GetVARIANTs(ref e.pEventAttributes, e.dwNumEventAttrs, false); for (int ii = 0; ii < eventType.EventType.Attributes.Count; ii++) { EventAttribute attribute = eventType.EventType.Attributes[ii]; if (ii >= e.dwNumEventAttrs) { continue; } if (!ackCommentFound && AeTypeCache.IsKnownName(attribute.Description, "ACK COMMENT")) { ConditionState condition = instance as ConditionState; if (condition != null) { condition.Comment = new ConditionVariableState<LocalizedText>(condition); condition.Comment.BrowseName = Opc.Ua.BrowseNames.Comment; condition.Comment.Value = new LocalizedText(values[ii] as string); } ackCommentFound = true; continue; } PropertyState property = new PropertyState(instance); property.SymbolicName = attribute.Description; property.BrowseName = new QualifiedName(property.SymbolicName, m_namespaceIndex); property.Value = values[ii]; instance.AddChild(property); } return instance; }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case DsatsDemo.BrowseNames.ChangePhase: { if (createOrReplace) { if (ChangePhase == null) { if (replacement == null) { ChangePhase = new ChangePhaseMethodState(this); } else { ChangePhase = (ChangePhaseMethodState)replacement; } } } instance = ChangePhase; break; } case DsatsDemo.BrowseNames.ChangePhaseWithString: { if (createOrReplace) { if (ChangePhaseWithString == null) { if (replacement == null) { ChangePhaseWithString = new PropertyState<string>(this); } else { ChangePhaseWithString = (PropertyState<string>)replacement; } } } instance = ChangePhaseWithString; break; } case DsatsDemo.BrowseNames.CurrentPhase: { if (createOrReplace) { if (CurrentPhase == null) { if (replacement == null) { CurrentPhase = new BaseDataVariableState<NodeId>(this); } else { CurrentPhase = (BaseDataVariableState<NodeId>)replacement; } } } instance = CurrentPhase; break; } case DsatsDemo.BrowseNames.Phases: { if (createOrReplace) { if (Phases == null) { if (replacement == null) { Phases = new FolderState(this); } else { Phases = (FolderState)replacement; } } } instance = Phases; break; } case DsatsDemo.BrowseNames.Locks: { if (createOrReplace) { if (Locks == null) { if (replacement == null) { Locks = new FolderState(this); } else { Locks = (FolderState)replacement; } } } instance = Locks; break; } case DsatsDemo.BrowseNames.TopDrive: { if (createOrReplace) { if (TopDrive == null) { if (replacement == null) { TopDrive = new TopDriveState(this); } else { TopDrive = (TopDriveState)replacement; } } } instance = TopDrive; break; } case DsatsDemo.BrowseNames.MudPumps: { if (createOrReplace) { if (MudPumps == null) { if (replacement == null) { MudPumps = new FolderState(this); } else { MudPumps = (FolderState)replacement; } } } instance = MudPumps; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case Quickstarts.DataTypes.Types.BrowseNames.PrimaryVehicle: { if (createOrReplace) { if (PrimaryVehicle == null) { if (replacement == null) { PrimaryVehicle = new PropertyState<VehicleType>(this); } else { PrimaryVehicle = (PropertyState<VehicleType>)replacement; } } } instance = PrimaryVehicle; break; } case Quickstarts.DataTypes.Types.BrowseNames.OwnedVehicles: { if (createOrReplace) { if (OwnedVehicles == null) { if (replacement == null) { OwnedVehicles = new PropertyState<VehicleType[]>(this); } else { OwnedVehicles = (PropertyState<VehicleType[]>)replacement; } } } instance = OwnedVehicles; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case DsatsDemo.BrowseNames.Enabled: { if (createOrReplace) { if (Enabled == null) { if (replacement == null) { Enabled = new PropertyState<bool>(this); } else { Enabled = (PropertyState<bool>)replacement; } } } instance = Enabled; break; } case DsatsDemo.BrowseNames.DeviceReady: { if (createOrReplace) { if (DeviceReady == null) { if (replacement == null) { DeviceReady = new PropertyState<bool>(this); } else { DeviceReady = (PropertyState<bool>)replacement; } } } instance = DeviceReady; break; } case DsatsDemo.BrowseNames.LocalControl: { if (createOrReplace) { if (LocalControl == null) { if (replacement == null) { LocalControl = new PropertyState<bool>(this); } else { LocalControl = (PropertyState<bool>)replacement; } } } instance = LocalControl; break; } case DsatsDemo.BrowseNames.WatchdogCounter: { if (createOrReplace) { if (WatchdogCounter == null) { if (replacement == null) { WatchdogCounter = new PropertyState<uint>(this); } else { WatchdogCounter = (PropertyState<uint>)replacement; } } } instance = WatchdogCounter; break; } case DsatsDemo.BrowseNames.ActiveLockId: { if (createOrReplace) { if (ActiveLockId == null) { if (replacement == null) { ActiveLockId = new PropertyState<string>(this); } else { ActiveLockId = (PropertyState<string>)replacement; } } } instance = ActiveLockId; break; } case DsatsDemo.BrowseNames.AssetInfo: { if (createOrReplace) { if (AssetInfo == null) { if (replacement == null) { AssetInfo = new AssetInfoFolderState(this); } else { AssetInfo = (AssetInfoFolderState)replacement; } } } instance = AssetInfo; break; } case DsatsDemo.BrowseNames.Measurements: { if (createOrReplace) { if (Measurements == null) { if (replacement == null) { Measurements = new FolderState(this); } else { Measurements = (FolderState)replacement; } } } instance = Measurements; break; } case DsatsDemo.BrowseNames.SetPoints: { if (createOrReplace) { if (SetPoints == null) { if (replacement == null) { SetPoints = new FolderState(this); } else { SetPoints = (FolderState)replacement; } } } instance = SetPoints; break; } case DsatsDemo.BrowseNames.Limits: { if (createOrReplace) { if (Limits == null) { if (replacement == null) { Limits = new FolderState(this); } else { Limits = (FolderState)replacement; } } } instance = Limits; break; } case DsatsDemo.BrowseNames.OperationalLimits: { if (createOrReplace) { if (OperationalLimits == null) { if (replacement == null) { OperationalLimits = new FolderState(this); } else { OperationalLimits = (FolderState)replacement; } } } instance = OperationalLimits; break; } case DsatsDemo.BrowseNames.AccessRules: { if (createOrReplace) { if (AccessRules == null) { if (replacement == null) { AccessRules = new FolderState(this); } else { AccessRules = (FolderState)replacement; } } } instance = AccessRules; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <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) { // create a object to represent the process being controlled. BaseObjectState process = new BaseObjectState(null); process.NodeId = new NodeId(1, NamespaceIndex); process.BrowseName = new QualifiedName("My Process", NamespaceIndex); process.DisplayName = process.BrowseName.Name; process.TypeDefinitionId = ObjectTypeIds.BaseObjectType; // ensure the process object can be found via the server object. IList<IReference> references = null; if (!externalReferences.TryGetValue(ObjectIds.ObjectsFolder, out references)) { externalReferences[ObjectIds.ObjectsFolder] = references = new List<IReference>(); } process.AddReference(ReferenceTypeIds.Organizes, true, ObjectIds.ObjectsFolder); references.Add(new NodeStateReference(ReferenceTypeIds.Organizes, false, process.NodeId)); // a property to report the process state. PropertyState<uint> state = m_stateNode = new PropertyState<uint>(process); state.NodeId = new NodeId(2, NamespaceIndex); state.BrowseName = new QualifiedName("State", NamespaceIndex); state.DisplayName = state.BrowseName.Name; state.TypeDefinitionId = VariableTypeIds.PropertyType; state.ReferenceTypeId = ReferenceTypeIds.HasProperty; state.DataType = DataTypeIds.UInt32; state.ValueRank = ValueRanks.Scalar; process.AddChild(state); // a method to start the process. MethodState start = new MethodState(process); start.NodeId = new NodeId(3, NamespaceIndex); start.BrowseName = new QualifiedName("Start", NamespaceIndex); start.DisplayName = start.BrowseName.Name; start.ReferenceTypeId = ReferenceTypeIds.HasComponent; start.UserExecutable = true; start.Executable = true; // add input arguments. start.InputArguments = new PropertyState<Argument[]>(start); start.InputArguments.NodeId = new NodeId(4, NamespaceIndex); start.InputArguments.BrowseName = BrowseNames.InputArguments; start.InputArguments.DisplayName = start.InputArguments.BrowseName.Name; start.InputArguments.TypeDefinitionId = VariableTypeIds.PropertyType; start.InputArguments.ReferenceTypeId = ReferenceTypeIds.HasProperty; start.InputArguments.DataType = DataTypeIds.Argument; start.InputArguments.ValueRank = ValueRanks.OneDimension; Argument[] args = new Argument[2]; args[0] = new Argument(); args[0].Name = "Initial State"; args[0].Description = "The initialize state for the process."; args[0].DataType = DataTypeIds.UInt32; args[0].ValueRank = ValueRanks.Scalar; args[1] = new Argument(); args[1].Name = "Final State"; args[1].Description = "The final state for the process."; args[1].DataType = DataTypeIds.UInt32; args[1].ValueRank = ValueRanks.Scalar; start.InputArguments.Value = args; // add output arguments. start.OutputArguments = new PropertyState<Argument[]>(start); start.OutputArguments.NodeId = new NodeId(5, NamespaceIndex); start.OutputArguments.BrowseName = BrowseNames.OutputArguments; start.OutputArguments.DisplayName = start.OutputArguments.BrowseName.Name; start.OutputArguments.TypeDefinitionId = VariableTypeIds.PropertyType; start.OutputArguments.ReferenceTypeId = ReferenceTypeIds.HasProperty; start.OutputArguments.DataType = DataTypeIds.Argument; start.OutputArguments.ValueRank = ValueRanks.OneDimension; args = new Argument[2]; args[0] = new Argument(); args[0].Name = "Revised Initial State"; args[0].Description = "The revised initialize state for the process."; args[0].DataType = DataTypeIds.UInt32; args[0].ValueRank = ValueRanks.Scalar; args[1] = new Argument(); args[1].Name = "Revised Final State"; args[1].Description = "The revised final state for the process."; args[1].DataType = DataTypeIds.UInt32; args[1].ValueRank = ValueRanks.Scalar; start.OutputArguments.Value = args; process.AddChild(start); // save in dictionary. AddPredefinedNode(SystemContext, process); // set up method handlers. start.OnCallMethod = new GenericMethodCalledEventHandler(OnStart); } }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case Opc.Ua.Fdi7.BrowseNames.MAC: { if (createOrReplace) { if (MAC == null) { if (replacement == null) { MAC = new PropertyState<byte[]>(this); } else { MAC = (PropertyState<byte[]>)replacement; } } } instance = MAC; break; } case Opc.Ua.Fdi7.BrowseNames.IPv4: { if (createOrReplace) { if (IPv4 == null) { if (replacement == null) { IPv4 = new PropertyState<byte[]>(this); } else { IPv4 = (PropertyState<byte[]>)replacement; } } } instance = IPv4; break; } case Opc.Ua.Fdi7.BrowseNames.DNSNAME: { if (createOrReplace) { if (DNSNAME == null) { if (replacement == null) { DNSNAME = new PropertyState<string>(this); } else { DNSNAME = (PropertyState<string>)replacement; } } } instance = DNSNAME; break; } case Opc.Ua.Fdi7.BrowseNames.VALID: { if (createOrReplace) { if (VALID == null) { if (replacement == null) { VALID = new PropertyState<bool>(this); } else { VALID = (PropertyState<bool>)replacement; } } } instance = VALID; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case DsatsDemo.BrowseNames.SessionId: { if (createOrReplace) { if (SessionId == null) { if (replacement == null) { SessionId = new PropertyState<NodeId>(this); } else { SessionId = (PropertyState<NodeId>)replacement; } } } instance = SessionId; break; } case DsatsDemo.BrowseNames.SubjectName: { if (createOrReplace) { if (SubjectName == null) { if (replacement == null) { SubjectName = new PropertyState<string>(this); } else { SubjectName = (PropertyState<string>)replacement; } } } instance = SubjectName; break; } case DsatsDemo.BrowseNames.LockState: { if (createOrReplace) { if (LockState == null) { if (replacement == null) { LockState = new LockStateMachineState(this); } else { LockState = (LockStateMachineState)replacement; } } } instance = LockState; break; } case DsatsDemo.BrowseNames.LockStateAsString: { if (createOrReplace) { if (LockStateAsString == null) { if (replacement == null) { LockStateAsString = new PropertyState<string>(this); } else { LockStateAsString = (PropertyState<string>)replacement; } } } instance = LockStateAsString; break; } case DsatsDemo.BrowseNames.Request: { if (createOrReplace) { if (Request == null) { if (replacement == null) { Request = new MethodState(this); } else { Request = (MethodState)replacement; } } } instance = Request; break; } case DsatsDemo.BrowseNames.Release: { if (createOrReplace) { if (Release == null) { if (replacement == null) { Release = new MethodState(this); } else { Release = (MethodState)replacement; } } } instance = Release; break; } case DsatsDemo.BrowseNames.Approve: { if (createOrReplace) { if (Approve == null) { if (replacement == null) { Approve = new MethodState(this); } else { Approve = (MethodState)replacement; } } } instance = Approve; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case Quickstarts.HistoricalEvents.BrowseNames.TestDuration: { if (createOrReplace) { if (TestDuration == null) { if (replacement == null) { TestDuration = new AnalogItemState<double>(this); } else { TestDuration = (AnalogItemState<double>)replacement; } } } instance = TestDuration; break; } case Quickstarts.HistoricalEvents.BrowseNames.InjectedFluid: { if (createOrReplace) { if (InjectedFluid == null) { if (replacement == null) { InjectedFluid = new PropertyState<string>(this); } else { InjectedFluid = (PropertyState<string>)replacement; } } } instance = InjectedFluid; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case BrowseNames.InputArguments: { if (createOrReplace) { if (InputArguments == null) { if (replacement == null) { InputArguments = new PropertyState<Argument[]>(this); } else { InputArguments = (PropertyState<Argument[]>)replacement; } } } instance = InputArguments; break; } case BrowseNames.OutputArguments: { if (createOrReplace) { if (OutputArguments == null) { if (replacement == null) { OutputArguments = new PropertyState<Argument[]>(this); } else { OutputArguments = (PropertyState<Argument[]>)replacement; } } } instance = OutputArguments; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case DsatsDemo.BrowseNames.Manufacturer: { if (createOrReplace) { if (Manufacturer == null) { if (replacement == null) { Manufacturer = new PropertyState<string>(this); } else { Manufacturer = (PropertyState<string>)replacement; } } } instance = Manufacturer; break; } case DsatsDemo.BrowseNames.ModelNumber: { if (createOrReplace) { if (ModelNumber == null) { if (replacement == null) { ModelNumber = new PropertyState<string>(this); } else { ModelNumber = (PropertyState<string>)replacement; } } } instance = ModelNumber; break; } case DsatsDemo.BrowseNames.SerialNumber: { if (createOrReplace) { if (SerialNumber == null) { if (replacement == null) { SerialNumber = new PropertyState<string>(this); } else { SerialNumber = (PropertyState<string>)replacement; } } } instance = SerialNumber; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case FileSystem.BrowseNames.Temperature: { if (createOrReplace) { if (Temperature == null) { if (replacement == null) { Temperature = new PropertyState<double>(this); } else { Temperature = (PropertyState<double>)replacement; } } } instance = Temperature; break; } case FileSystem.BrowseNames.State: { if (createOrReplace) { if (State == null) { if (replacement == null) { State = new PropertyState<int>(this); } else { State = (PropertyState<int>)replacement; } } } instance = State; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return null; } BaseInstanceState instance = null; switch (browseName.Name) { case Quickstarts.HistoricalEvents.BrowseNames.NameWell: { if (createOrReplace) { if (NameWell == null) { if (replacement == null) { NameWell = new PropertyState<string>(this); } else { NameWell = (PropertyState<string>)replacement; } } } instance = NameWell; break; } case Quickstarts.HistoricalEvents.BrowseNames.UidWell: { if (createOrReplace) { if (UidWell == null) { if (replacement == null) { UidWell = new PropertyState<string>(this); } else { UidWell = (PropertyState<string>)replacement; } } } instance = UidWell; break; } case Quickstarts.HistoricalEvents.BrowseNames.TestDate: { if (createOrReplace) { if (TestDate == null) { if (replacement == null) { TestDate = new PropertyState<DateTime>(this); } else { TestDate = (PropertyState<DateTime>)replacement; } } } instance = TestDate; break; } case Quickstarts.HistoricalEvents.BrowseNames.TestReason: { if (createOrReplace) { if (TestReason == null) { if (replacement == null) { TestReason = new PropertyState<string>(this); } else { TestReason = (PropertyState<string>)replacement; } } } instance = TestReason; break; } } if (instance != null) { return instance; } return base.FindChild(context, browseName, createOrReplace, replacement); }