public DataValue ReadAttributeValue(
IOperationContext context,
ExpandedNodeId typeDefinitionId,
IList<QualifiedName> relativePath,
uint attributeId,
NumericRange indexRange)
{
lock (DataLock)
{
// check for match on the event type being searched.
if (!Server.TypeTree.IsTypeOf(TypeDefinitionId, typeDefinitionId))
{
return new DataValue(StatusCodes.BadNotSupported);
}
// find the target.
NodeSource target = this;
if (relativePath != null && relativePath.Count > 0)
{
target = Find(relativePath, 0);
if (target == null)
{
return new DataValue(StatusCodes.BadNotSupported);
}
}
// read the attribute value.
DataValue dataValue = new DataValue();
ServiceResult result = target.Read(context, attributeId, dataValue);
if (ServiceResult.IsBad(result))
{
return new DataValue(result.StatusCode);
}
// apply any index range.
object value = dataValue.Value;
result = indexRange.ApplyRange(ref value);
if (ServiceResult.IsBad(result))
{
return new DataValue(result.StatusCode);
}
dataValue.Value = value;
// return the value.
return dataValue;
}
}