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;
}