/// <summary> /// Tag constructor /// </summary> /// <param name="myDSC">parameters from Tags table</param> /// <param name="myStation">pointer to interface that allow to change priority of the station</param> internal Tag(ComunicationNet.TagsRow myDSC, IStationState myStation) : base(myDSC.Name, null, qualityBits.badNotConnected, (ItemAccessRights)myDSC.AccessRights, GetDataTypeFromConfig(myDSC)) { switch ((StateTrigger)myDSC.StateTrigger) { case StateTrigger.StateHigh: stateHihgTriger = true; break; case StateTrigger.StateLow: stateLowTriger = true; break; default: break; } stateMask = (int)myDSC.StateMask; this.myStation = myStation; this.EuType = Opc.Da.euType.noEnum; ItemPropertyCollection itemPropertyCollection = new ItemPropertyCollection(); foreach (ComunicationNet.ItemPropertiesTableRow row_property in myDSC.GetItemPropertiesTableRows()) { try { PropertyDescription prop_dsc = PropertyDescription.Find( new PropertyID( new XmlQualifiedName(row_property.ID_Name_Name, row_property.ID_Name_Namespace) )); ItemProperty _itemProperty = new ItemProperty { ID = prop_dsc.ID, Value = row_property.Value }; if (prop_dsc.ID != Opc.Da.Property.DATATYPE) //this property is managed differently // as GetDataTypeFromConfig( myDSC ) // at the constructor { if (prop_dsc.ID == Opc.Da.Property.HI_LIMIT || prop_dsc.ID == Opc.Da.Property.LO_LIMIT || prop_dsc.ID == Opc.Da.Property.HIHI_LIMIT || prop_dsc.ID == Opc.Da.Property.LOLO_LIMIT || prop_dsc.ID == Opc.Da.Property.LOWEU || prop_dsc.ID == Opc.Da.Property.HIGHEU || prop_dsc.ID == Opc.Da.Property.SCANRATE ) { // this property contains double value if (double.TryParse(row_property.Value, out double prop_value)) _itemProperty.Value = prop_value; } if (prop_dsc.ID == Opc.Da.Property.EUTYPE) { _itemProperty.Value = Opc.Da.euType.noEnum; // this property contains vale from enum: Opc.Da.euType foreach (Opc.Da.euType NEWeuType in Enum.GetValues(typeof(Opc.Da.euType))) { if (NEWeuType.ToString() == row_property.Value) _itemProperty.Value = NEWeuType; } } if (prop_dsc.ID == Opc.Da.Property.EUINFO) { //I assume that this is table of strings spited by ; _itemProperty.Value = row_property.Value.Split(';'); } itemPropertyCollection.Add(_itemProperty); } } catch (Exception ex) { CommServerComponent.Tracer.TraceInformation(290, "DataBlock.Tag", "Problem with property for item : " + myDSC.Name + ": " + TraceEvent.GetMessageWithExceptionNameFromExceptionIncludingInnerException(ex)); } } try { this.AddProperties(itemPropertyCollection); } catch (Exception ex) { CommServerComponent.Tracer.TraceInformation(290, "DataBlock.Tag", "Problem with many properties for item : " + myDSC.Name + ": " + TraceEvent.GetMessageWithExceptionNameFromExceptionIncludingInnerException(ex)); } }