Ejemplo n.º 1
0
        /// <summary>
        /// Fetches the specified properties for an item.
        /// </summary>
        private Opc.Da.ItemProperty[] GetProperties(
            CacheItem item,
            PropertyID[] propertyIDs,
            bool returnValues)
        {
            // check for trivial case.
            if (item == null)
            {
                return(null);
            }

            // fetch properties.
            ItemPropertyCollection properties = null;

            if (propertyIDs == null)
            {
                properties = item.GetAvailableProperties(returnValues);
            }
            else
            {
                properties = item.GetAvailableProperties(propertyIDs, returnValues);
            }

            // convert collection to array.
            return((Opc.Da.ItemProperty[])properties.ToArray(typeof(Opc.Da.ItemProperty)));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Fetches the specified properties for an item.
        /// </summary>
        public ItemPropertyCollection GetProperties(
            ItemIdentifier itemID,
            PropertyID[]   propertyIDs,
            bool returnValues)
        {
            if (itemID == null)
            {
                throw new ArgumentNullException("itemID");
            }

            lock (this)
            {
                if (m_disposed)
                {
                    throw new ObjectDisposedException("Opc.Da.Cache");
                }

                ItemPropertyCollection properties = new ItemPropertyCollection();

                properties.ItemName       = itemID.ItemName;
                properties.ItemPath       = itemID.ItemPath;
                properties.ResultID       = ResultID.S_OK;
                properties.DiagnosticInfo = null;

                if (itemID.ItemName == null || itemID.ItemName.Length == 0)
                {
                    properties.ResultID = ResultID.Da.E_INVALID_ITEM_NAME;
                    return(properties);
                }

                // find the item.
                CacheItem item = (CacheItem)m_items[itemID.ItemName];

                if (item == null)
                {
                    properties.ResultID = ResultID.Da.E_UNKNOWN_ITEM_NAME;
                    return(properties);
                }

                // get the properties.
                if (propertyIDs == null)
                {
                    properties = item.GetAvailableProperties(returnValues);
                }
                else
                {
                    properties = item.GetAvailableProperties(propertyIDs, returnValues);
                }

                // return result.
                return(properties);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Fetches the specified properties for an item.
        /// </summary>
        private Opc.Da.ItemProperty[] GetProperties(
            CacheItem    item,
            PropertyID[] propertyIDs,
            bool         returnValues)
        {
            // check for trivial case.
            if (item == null)
            {
                return null;
            }

            // fetch properties.
            ItemPropertyCollection properties = null;

            if (propertyIDs == null)
            {
                properties = item.GetAvailableProperties(returnValues);
            }
            else
            {
                properties = item.GetAvailableProperties(propertyIDs, returnValues);
            }

            // convert collection to array.
            return (Opc.Da.ItemProperty[])properties.ToArray(typeof(Opc.Da.ItemProperty));
        }