Use bracketless OPC UA node IDs for arrays

This commit is contained in:
Joseph Doherty
2026-03-25 12:57:05 -04:00
parent 4833765606
commit ed42b33512
6 changed files with 216 additions and 6 deletions

View File

@@ -130,6 +130,34 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Helpers
return Session.ReadValue(nodeId);
}
/// <summary>
/// Read a specific OPC UA attribute from a node.
/// </summary>
/// <param name="nodeId">The node whose attribute should be read.</param>
/// <param name="attributeId">The OPC UA attribute identifier to read.</param>
/// <returns>The attribute value returned by the server.</returns>
public DataValue ReadAttribute(NodeId nodeId, uint attributeId)
{
var nodesToRead = new ReadValueIdCollection
{
new ReadValueId
{
NodeId = nodeId,
AttributeId = attributeId
}
};
Session.Read(
null,
0,
TimestampsToReturn.Neither,
nodesToRead,
out var results,
out _);
return results[0];
}
/// <summary>
/// Write a node's value, optionally using an OPC UA index range for array element writes.
/// Returns the server status code for the write.