private void UpdateAggregateDescriptions(Session session, List<HdaAggregate> aggregates)
{
ReadValueIdCollection nodesToRead = new ReadValueIdCollection(); ;
for (int ii = 0; ii < aggregates.Count; ii++)
{
HdaAggregate aggregate = aggregates[ii];
ReadValueId nodeToRead = new ReadValueId();
nodeToRead.NodeId = aggregate.RemoteId;
nodeToRead.AttributeId = Attributes.Description;
nodesToRead.Add(nodeToRead);
}
DataValueCollection values = null;
DiagnosticInfoCollection diagnosticInfos = null;
// read values from the UA server.
ResponseHeader responseHeader = session.Read(
null,
0,
TimestampsToReturn.Neither,
nodesToRead,
out values,
out diagnosticInfos);
// validate response from the UA server.
ClientBase.ValidateResponse(values, nodesToRead);
ClientBase.ValidateDiagnosticInfos(diagnosticInfos, nodesToRead);
for (int ii = 0; ii < aggregates.Count; ii++)
{
HdaAggregate aggregate = aggregates[ii];
if (StatusCode.IsBad(values[ii].StatusCode))
{
aggregate.Description = null;
continue;
}
aggregate.Description = values[ii].WrappedValue.ToString();
}
}
#endregion