Use bracketless OPC UA node IDs for arrays
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user