Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle status code Uncertain according to the specification #2898

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Libraries/Opc.Ua.Server/Diagnostics/CustomNodeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3021,16 +3021,16 @@ protected virtual ServiceResult Call(
List<ServiceResult> argumentErrors = new List<ServiceResult>();
VariantCollection outputArguments = new VariantCollection();

ServiceResult error = method.Call(
ServiceResult callResult = method.Call(
context,
methodToCall.ObjectId,
methodToCall.InputArguments,
argumentErrors,
outputArguments);

if (ServiceResult.IsBad(error))
if (ServiceResult.IsBad(callResult))
{
return error;
return callResult;
}

// check for argument errors.
Expand Down Expand Up @@ -3085,7 +3085,8 @@ protected virtual ServiceResult Call(
// return output arguments.
result.OutputArguments = outputArguments;

return ServiceResult.Good;
// return the actual result of the original call
return callResult;
}


Expand Down
2 changes: 1 addition & 1 deletion Stack/Opc.Ua.Core/Stack/State/MethodState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ public virtual ServiceResult Call(
}

// copy out arguments.
if (ServiceResult.IsGood(result))
if (ServiceResult.IsGoodOrUncertain(result))
{
for (int ii = 0; ii < outputs.Count; ii++)
{
Expand Down
13 changes: 13 additions & 0 deletions Stack/Opc.Ua.Core/Types/Utils/ServiceResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,19 @@
return false;
}

/// <summary>
/// Returns true if the status code is good or uncertain.
/// </summary>
public static bool IsGoodOrUncertain(ServiceResult status)
{
if (status != null)
{
return StatusCode.IsGood(status.m_code) || StatusCode.IsUncertain(status.m_code);
}

return false;

Check warning on line 537 in Stack/Opc.Ua.Core/Types/Utils/ServiceResult.cs

View check run for this annotation

Codecov / codecov/patch

Stack/Opc.Ua.Core/Types/Utils/ServiceResult.cs#L537

Added line #L537 was not covered by tests
}

/// <summary>
/// Returns true if the status is good or uncertain.
/// </summary>
Expand Down
Loading