public SubscriptionItems(SubscriptionTreeNodeSession node) { foreach (TagTreeNode item in node.Nodes) { myChildren.Add((Guid)item.Tag.ClientHandle, item.Tag); } srcItems = new OpcDa.Item[myChildren.Count]; for (int ii = 0; ii < srcItems.Length; ii++) { srcItems[ii] = myChildren.Values[ii].GetItem; myChildren.Values[ii].Invalidate(); } }
private OPC_Interface.OPC_Interface_Tag[] Tags ( OPCCliConfiguration.ItemsRow[] items, OPC_Interface server, OPC_Interface.OPCGroup oPCGroup ) { OPCClientTag[] tags = new OPCClientTag[ items.Length ]; int idx = 0; #region foreach ( OPCCliConfiguration.ItemsRow row in items ) foreach ( OPCCliConfiguration.ItemsRow row in items ) { OpcDa.Item item = row.Item; double measurement_low = double.NaN; double measurement_hi = double.NaN; double engineer_low = double.NaN; double engineer_hi = double.NaN; OPCCliConfiguration.ConversionsRow[] conversions = row.GetConversionsRows(); if ( conversions.Length > 0 ) { if ( conversions.Length != 1 ) throw new Exception( "Too many ConversionsRows for item " + row.Name ); //musimy konwersje uruchomic measurement_low = conversions[ 0 ].MeasuredValue1; measurement_hi = conversions[ 0 ].MeasuredValue2; engineer_low = conversions[ 0 ].EngineeringValue1; engineer_hi = conversions[ 0 ].EngineeringValue2; } //odczytanie odpowiednich property z pliku opisów global::Opc.Da.ItemPropertyCollection properties = BaseStation.ItemDescriber.ItemDescriber2OpcDA.GetItemPropertiesCollection( row.Name, Main.m_ds_dsc ); if ( properties.Count == 0 ) { //nalezy sprawdzic jeszcze - czy moze nie ma nazewnictwa path/ tagname: properties = BaseStation.ItemDescriber.ItemDescriber2OpcDA.GetItemPropertiesCollection ( server.Name + "/" + oPCGroup.Name + "/" + row.Name, Main.m_ds_dsc ); } OPCTag tagStatistics = new OPCTag( (uint)row.ID, row.Item, measurement_low, measurement_hi, engineer_low, engineer_hi ); string path = server.Name + "/" + oPCGroup.Name + "/"; OPCClientTag tag = new OPCClientTag ( tagStatistics, oPCGroup, null, OpcDa.qualityBits.badNotConnected, properties, path, row.Item ); tag.ClientHandle = idx; tags[ idx++ ] = tag; } #endregion foreach ( OPCCliConfiguration.ItemsRow row in items ) return tags; }