本文整理汇总了C#中Opc.Ua.Client.Session.HistoryUpdate方法的典型用法代码示例。如果您正苦于以下问题:C# Session.HistoryUpdate方法的具体用法?C# Session.HistoryUpdate怎么用?C# Session.HistoryUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Opc.Ua.Client.Session
的用法示例。
在下文中一共展示了Session.HistoryUpdate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateHistory
/// <summary>
/// Calls the server and updates the history.
/// </summary>
private int[] UpdateHistory(
Session session,
List<HdaUpdateRequest> requests,
bool checkOperationError)
{
int[] errors = new int[requests.Count];
// build list of nodes to update.
ExtensionObjectCollection nodesToUpdate = new ExtensionObjectCollection();
List<int> indexes = new List<int>();
for (int ii = 0; ii < requests.Count; ii++)
{
if (requests[ii].Error < 0)
{
errors[ii] = requests[ii].Error;
continue;
}
// check if nothing to do.
if (requests[ii].Details == null)
{
continue;
}
nodesToUpdate.Add(requests[ii].Details);
indexes.Add(ii);
}
if (nodesToUpdate.Count == 0)
{
return errors;
}
// call the server.
HistoryUpdateResultCollection results = null;
DiagnosticInfoCollection diagnosticInfos = null;
session.HistoryUpdate(
null,
nodesToUpdate,
out results,
out diagnosticInfos);
Session.ValidateResponse(results, nodesToUpdate);
Session.ValidateDiagnosticInfos(diagnosticInfos, nodesToUpdate);
// process results.
for (int ii = 0; ii < nodesToUpdate.Count; ii++)
{
HdaUpdateRequest request = requests[indexes[ii]];
request.Error = MapUpdateStatusToErrorCode(results[ii].StatusCode);
if (checkOperationError)
{
if (StatusCode.IsGood(results[ii].StatusCode))
{
request.Error = MapUpdateStatusToErrorCode(results[ii].OperationResults[0]);
}
}
errors[indexes[ii]] = request.Error;
}
return errors;
}