本文整理汇总了C#中Opc.Ua.MethodState.Call方法的典型用法代码示例。如果您正苦于以下问题:C# MethodState.Call方法的具体用法?C# MethodState.Call怎么用?C# MethodState.Call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Opc.Ua.MethodState
的用法示例。
在下文中一共展示了MethodState.Call方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Call
/// <summary>
/// Calls a method on an object.
/// </summary>
protected virtual ServiceResult Call(
ISystemContext context,
CallMethodRequest methodToCall,
MethodState method,
CallMethodResult result)
{
ServerSystemContext systemContext = context as ServerSystemContext;
List<ServiceResult> argumentErrors = new List<ServiceResult>();
VariantCollection outputArguments = new VariantCollection();
ServiceResult error = method.Call(
context,
methodToCall.ObjectId,
methodToCall.InputArguments,
argumentErrors,
outputArguments);
if (ServiceResult.IsBad(error))
{
return error;
}
// check for argument errors.
bool argumentsValid = true;
for (int jj = 0; jj < argumentErrors.Count; jj++)
{
ServiceResult argumentError = argumentErrors[jj];
if (argumentError != null)
{
result.InputArgumentResults.Add(argumentError.StatusCode);
if (ServiceResult.IsBad(argumentError))
{
argumentsValid = false;
}
}
else
{
result.InputArgumentResults.Add(StatusCodes.Good);
}
// only fill in diagnostic info if it is requested.
if (systemContext.OperationContext != null)
{
if ((systemContext.OperationContext.DiagnosticsMask & DiagnosticsMasks.OperationAll) != 0)
{
if (ServiceResult.IsBad(argumentError))
{
argumentsValid = false;
result.InputArgumentDiagnosticInfos.Add(new DiagnosticInfo(argumentError, systemContext.OperationContext.DiagnosticsMask, false, systemContext.OperationContext.StringTable));
}
else
{
result.InputArgumentDiagnosticInfos.Add(null);
}
}
}
}
// check for validation errors.
if (!argumentsValid)
{
result.StatusCode = StatusCodes.BadInvalidArgument;
return result.StatusCode;
}
// do not return diagnostics if there are no errors.
result.InputArgumentDiagnosticInfos.Clear();
// return output arguments.
result.OutputArguments = outputArguments;
return ServiceResult.Good;
}