Add OPC UA array element write integration test
This commit is contained in:
@@ -114,6 +114,27 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Helpers
|
||||
return Session.ReadValue(nodeId);
|
||||
}
|
||||
|
||||
/// <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.
|
||||
/// </summary>
|
||||
public StatusCode Write(NodeId nodeId, object value, string? indexRange = null)
|
||||
{
|
||||
var nodesToWrite = new WriteValueCollection
|
||||
{
|
||||
new WriteValue
|
||||
{
|
||||
NodeId = nodeId,
|
||||
AttributeId = Attributes.Value,
|
||||
IndexRange = indexRange,
|
||||
Value = new DataValue(new Variant(value))
|
||||
}
|
||||
};
|
||||
|
||||
Session.Write(null, nodesToWrite, out var results, out _);
|
||||
return results[0];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a subscription with a monitored item on the given node.
|
||||
/// Returns the subscription and monitored item for inspection.
|
||||
|
||||
Reference in New Issue
Block a user