protected override DataBlock.Tag newTag(ComunicationNet.TagsRow currRow, IStationState myStationState, int myAddress, short myDataType, IDataWrite myWriteInt) { #if COMMSERVER Opc.Da.ItemPropertyCollection prop_coll = ItemDescriber2OpcDA.GetItemPropertiesCollection(currRow.Name, Initialization.m_ds_dsc); #else Opc.Da.ItemPropertyCollection prop_coll=null; #endif return new TagDataDescription(currRow, myStationState, myAddress, myDataType, myWriteInt, prop_coll); }
/// <summary> /// Tag constructor /// </summary> /// <param name="myDSC">params from Tags table</param> /// <param name="myStation">pointer to interface that allow to change priority of the station</param> /// <param name="myAddress">address</param> /// <param name="myDataType">Data type</param> /// <param name="writeToStation">pointer to interface that allow to write to station</param> /// <param name="property_colllection">collection of properties for this tag see: <see cref="Opc.Da.ItemPropertyCollection"/></param> internal TagDataDescription ( NetConfig.TagsRow myDSC, IStationState myStation, int myAddress, short myDataType, IDataWrite writeToStation, Opc.Da.ItemPropertyCollection property_colllection ) : base(myDSC, myStation) { if (property_colllection != null) this.AddProperties(property_colllection); writableTag = (myDSC.AccessRights == (sbyte)ItemAccessRights.ReadWrite || myDSC.AccessRights == (sbyte)ItemAccessRights.WriteOnly); myDWD = new DataWriteDescription(myAddress, myDataType, writeToStation); ComunicationNet.TagBitRow[] tagbitsDsc = myDSC.GetTagBitRows(); if (tagbitsDsc.Length != 0) { this.TagBitList = new ArrayList(); foreach (ComunicationNet.TagBitRow curr in tagbitsDsc) { TagBit newTagBit = new TagBit(myDSC.Name + "_" + curr.Name, (int)curr.BitNumber); this.TagBitList.Add(newTagBit); } } else this.TagBitList = null; }
/// <summary> /// Function used for initialization the properties of the item /// </summary> /// <param name="PropertiesCollection">properties to add or write</param> protected void AddProperties(Opc.Da.ItemPropertyCollection PropertiesCollection) { // if(PropertiesCollection.Count==0) // { //#if DEBUG // //tutaj chyba wyswietla wlasnie te co dodal // System.Console.WriteLine( // "|property for: " // +this.ToString()+":" // +" not defined"); //#endif // } foreach (ItemProperty itemProperty in PropertiesCollection) { ItemValue itemval = new ItemValue(ItemID) { Value = itemProperty.Value }; if (!Write(itemProperty.ID, itemval, false).ResultID.Succeeded()) { m_properties.Add(itemProperty.ID, itemProperty.Value); } } }