Opc.Ua.Com.Server.ComHdaItemManager.GetAttributeHistoryNodeIds C# (CSharp) Method

GetAttributeHistoryNodeIds() public method

Reads the node ids used to fetch the history of the specified attributes.
public GetAttributeHistoryNodeIds ( Session session, HdaItemHandle itemHandle, uint attributeIds, NodeId &nodeIds ) : int[]
session Opc.Ua.Client.Session The session.
itemHandle HdaItemHandle The item handle.
attributeIds uint The attribute ids.
nodeIds NodeId The node ids.
return int[]
        public int[] GetAttributeHistoryNodeIds(Session session, HdaItemHandle itemHandle, uint[] attributeIds, out NodeId[] nodeIds)
        {
            nodeIds = new NodeId[attributeIds.Length];
            int[] results = new int[attributeIds.Length];

            // check handle.
            InternalHandle handle = itemHandle as InternalHandle;

            if (handle == null)
            {
                for (int ii = 0; ii < results.Length; ii++)
                {
                    results[ii] = ResultIds.E_INVALIDHANDLE;
                }

                return results;
            }

            // look up the supported attributes for an item.
            ReadValueIdCollection supportedAttributes = handle.Item.SupportedAttributes;

            if (supportedAttributes == null)
            {
                handle.Item.SupportedAttributes = supportedAttributes = GetAvailableAttributes(session, handle.NodeId);
            }

            // build list of values to read.
            ReadValueIdCollection valuesToRead = new ReadValueIdCollection();

            for (int ii = 0; ii < attributeIds.Length; ii++)
            {
                ReadValueId valueToRead = GetReadValueId(supportedAttributes, attributeIds[ii]);

                if (valueToRead == null)
                {
                    results[ii] = ResultIds.E_INVALIDATTRID;
                    continue;
                }

                if (valueToRead.AttributeId == Attributes.Value)
                {
                    nodeIds[ii] = valueToRead.NodeId;
                    results[ii] = ResultIds.S_OK;
                }
                else
                {
                    results[ii] = ResultIds.S_NODATA;
                }
            }

            return results;
        }