本文整理汇总了C#中Opc.Ua.Client.Session.HistoryRead方法的典型用法代码示例。如果您正苦于以下问题:C# Session.HistoryRead方法的具体用法?C# Session.HistoryRead怎么用?C# Session.HistoryRead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Opc.Ua.Client.Session
的用法示例。
在下文中一共展示了Session.HistoryRead方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadNext
/// <summary>
/// Reads the next batch of values from the server.
/// </summary>
private bool ReadNext(
Session session,
ExtensionObject details,
List<HdaReadRequest> requests,
bool releaseContinuationPoints)
{
// get the value.
HistoryReadValueIdCollection nodesToRead = new HistoryReadValueIdCollection();
for (int ii = 0; ii < requests.Count; ii++)
{
HdaReadRequest request = requests[ii];
if (request.IsComplete || request.Error < 0)
{
continue;
}
if (NodeId.IsNull(request.NodeId))
{
request.Error = ResultIds.S_NODATA;
continue;
}
HistoryReadValueId nodeToRead = new HistoryReadValueId();
nodeToRead.NodeId = request.NodeId;
nodeToRead.ContinuationPoint = request.ContinuationPoint;
nodeToRead.Handle = request;
nodesToRead.Add(nodeToRead);
}
// check if something to do.
if (nodesToRead.Count == 0)
{
return false;
}
HistoryReadResultCollection results = null;
DiagnosticInfoCollection diagnosticInfos = null;
session.HistoryRead(
null,
details,
TimestampsToReturn.Source,
releaseContinuationPoints,
nodesToRead,
out results,
out diagnosticInfos);
Session.ValidateResponse(results, nodesToRead);
Session.ValidateDiagnosticInfos(diagnosticInfos, nodesToRead);
// check if nothing more to do.
if (releaseContinuationPoints)
{
return false;
}
// process results.
bool continuationPoints = false;
for (int ii = 0; ii < nodesToRead.Count; ii++)
{
HdaReadRequest request = (HdaReadRequest)nodesToRead[ii].Handle;
if (request.Values == null)
{
request.Values = new List<DaValue>();
}
request.Error = ProcessReadResults(
session,
results[ii],
request.AttributeId,
request.Values,
request.ModificationInfos);
request.ContinuationPoint = results[ii].ContinuationPoint;
// check if continuation point provided.
if (request.ContinuationPoint != null && request.ContinuationPoint.Length > 0)
{
request.Error = ResultIds.S_MOREDATA;
continuationPoints = true;
}
else
{
request.IsComplete = true;
}
}
return continuationPoints;
}