本文整理匯總了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;
}