feat(opcua): EnsureVariable array params (ValueRank=OneDimension + ArrayDimensions)
This commit is contained in:
@@ -62,8 +62,10 @@ public sealed class DeferredAddressSpaceSink : IOpcUaAddressSpaceSink
|
||||
/// <param name="writable">When true the node is created read/write; otherwise read-only.</param>
|
||||
/// <param name="historianTagname">null ⇒ not historized; non-null ⇒ create Historizing with the
|
||||
/// HistoryRead access bit and register the historian tagname.</param>
|
||||
public void EnsureVariable(string variableNodeId, string? parentFolderNodeId, string displayName, string dataType, bool writable, string? historianTagname = null)
|
||||
=> _inner.EnsureVariable(variableNodeId, parentFolderNodeId, displayName, dataType, writable, historianTagname);
|
||||
/// <param name="isArray">When true the node is created as a 1-D array; when false (default) scalar.</param>
|
||||
/// <param name="arrayLength">The declared length of the 1-D array when <paramref name="isArray"/> is true.</param>
|
||||
public void EnsureVariable(string variableNodeId, string? parentFolderNodeId, string displayName, string dataType, bool writable, string? historianTagname = null, bool isArray = false, uint? arrayLength = null)
|
||||
=> _inner.EnsureVariable(variableNodeId, parentFolderNodeId, displayName, dataType, writable, historianTagname, isArray, arrayLength);
|
||||
|
||||
/// <summary>Rebuilds the address space through the inner sink.</summary>
|
||||
public void RebuildAddressSpace() => _inner.RebuildAddressSpace();
|
||||
|
||||
@@ -71,7 +71,13 @@ public interface IOpcUaAddressSpaceSink
|
||||
/// <param name="historianTagname">null ⇒ the variable is not historized; non-null ⇒ create it
|
||||
/// Historizing with the HistoryRead access bit and register the (already default-resolved)
|
||||
/// historian tagname.</param>
|
||||
void EnsureVariable(string variableNodeId, string? parentFolderNodeId, string displayName, string dataType, bool writable, string? historianTagname = null);
|
||||
/// <param name="isArray">When true the node is created as a 1-D array (<c>ValueRank=OneDimension</c>
|
||||
/// with <c>ArrayDimensions=[arrayLength]</c>); when false (default) it stays scalar
|
||||
/// (<c>ValueRank=Scalar</c>). Array elements share the scalar's base <paramref name="dataType"/> —
|
||||
/// rank + dimensions carry the array-ness.</param>
|
||||
/// <param name="arrayLength">The declared length of the 1-D array when <paramref name="isArray"/> is
|
||||
/// true; ignored for scalars. Null ⇒ length 0 (unbounded).</param>
|
||||
void EnsureVariable(string variableNodeId, string? parentFolderNodeId, string displayName, string dataType, bool writable, string? historianTagname = null, bool isArray = false, uint? arrayLength = null);
|
||||
|
||||
/// <summary>
|
||||
/// Tear down + repopulate the address space. Called by <c>OpcUaPublishActor</c> after a
|
||||
@@ -104,7 +110,7 @@ public sealed class NullOpcUaAddressSpaceSink : IOpcUaAddressSpaceSink
|
||||
public void EnsureFolder(string folderNodeId, string? parentNodeId, string displayName) { }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void EnsureVariable(string variableNodeId, string? parentFolderNodeId, string displayName, string dataType, bool writable, string? historianTagname = null) { }
|
||||
public void EnsureVariable(string variableNodeId, string? parentFolderNodeId, string displayName, string dataType, bool writable, string? historianTagname = null, bool isArray = false, uint? arrayLength = null) { }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void RebuildAddressSpace() { }
|
||||
|
||||
@@ -1296,7 +1296,13 @@ public sealed class OtOpcUaNodeManager : CustomNodeManager2
|
||||
/// <c>HistoryRead</c> access bit OR-ed into both <c>AccessLevel</c> and <c>UserAccessLevel</c>, and the
|
||||
/// (already default-resolved) tagname is registered in the NodeId→tagname map the HistoryRead override
|
||||
/// resolves against.</param>
|
||||
public void EnsureVariable(string variableNodeId, string? parentFolderNodeId, string displayName, string dataType, bool writable, string? historianTagname = null)
|
||||
/// <param name="isArray">Phase 4c: when true the node is materialised as a 1-D array
|
||||
/// (<c>ValueRank=OneDimension</c> with <c>ArrayDimensions=[arrayLength]</c>); when false (default) it
|
||||
/// stays scalar (<c>ValueRank=Scalar</c>). Array elements share the scalar's base
|
||||
/// <paramref name="dataType"/> — rank + dimensions carry the array-ness.</param>
|
||||
/// <param name="arrayLength">Phase 4c: the declared length of the 1-D array when
|
||||
/// <paramref name="isArray"/> is true; ignored for scalars. Null ⇒ length 0.</param>
|
||||
public void EnsureVariable(string variableNodeId, string? parentFolderNodeId, string displayName, string dataType, bool writable, string? historianTagname = null, bool isArray = false, uint? arrayLength = null)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrEmpty(variableNodeId);
|
||||
ArgumentException.ThrowIfNullOrEmpty(displayName);
|
||||
@@ -1324,7 +1330,8 @@ public sealed class OtOpcUaNodeManager : CustomNodeManager2
|
||||
TypeDefinitionId = VariableTypeIds.BaseDataVariableType,
|
||||
ReferenceTypeId = ReferenceTypeIds.Organizes,
|
||||
DataType = ResolveBuiltInDataType(dataType),
|
||||
ValueRank = ValueRanks.Scalar,
|
||||
ValueRank = isArray ? ValueRanks.OneDimension : ValueRanks.Scalar,
|
||||
ArrayDimensions = isArray ? new ReadOnlyList<uint>(new UInt32Collection(new[] { arrayLength ?? 0u })) : null,
|
||||
AccessLevel = access,
|
||||
UserAccessLevel = access,
|
||||
Historizing = historized,
|
||||
@@ -2046,7 +2053,11 @@ public sealed class OtOpcUaNodeManager : CustomNodeManager2
|
||||
TypeDefinitionId = VariableTypeIds.BaseDataVariableType,
|
||||
ReferenceTypeId = ReferenceTypeIds.Organizes,
|
||||
DataType = DataTypeIds.BaseDataType,
|
||||
ValueRank = ValueRanks.Scalar,
|
||||
// Lazy-created nodes (a WriteValue for a node never declared via EnsureVariable) carry no
|
||||
// array intent, so they stay scalar with no ArrayDimensions — mirrors EnsureVariable's
|
||||
// scalar branch. Array nodes are always pre-declared via EnsureVariable(isArray:true).
|
||||
ValueRank = ValueRanks.Scalar,
|
||||
ArrayDimensions = null,
|
||||
AccessLevel = AccessLevels.CurrentRead,
|
||||
UserAccessLevel = AccessLevels.CurrentRead,
|
||||
Historizing = false,
|
||||
|
||||
@@ -60,8 +60,10 @@ public sealed class SdkAddressSpaceSink : IOpcUaAddressSpaceSink
|
||||
/// <param name="writable">When true the node is created read/write; otherwise read-only.</param>
|
||||
/// <param name="historianTagname">null ⇒ not historized; non-null ⇒ create Historizing with the
|
||||
/// HistoryRead access bit and register the historian tagname.</param>
|
||||
public void EnsureVariable(string variableNodeId, string? parentFolderNodeId, string displayName, string dataType, bool writable, string? historianTagname = null)
|
||||
=> _nodeManager.EnsureVariable(variableNodeId, parentFolderNodeId, displayName, dataType, writable, historianTagname);
|
||||
/// <param name="isArray">When true the node is created as a 1-D array; when false (default) scalar.</param>
|
||||
/// <param name="arrayLength">The declared length of the 1-D array when <paramref name="isArray"/> is true.</param>
|
||||
public void EnsureVariable(string variableNodeId, string? parentFolderNodeId, string displayName, string dataType, bool writable, string? historianTagname = null, bool isArray = false, uint? arrayLength = null)
|
||||
=> _nodeManager.EnsureVariable(variableNodeId, parentFolderNodeId, displayName, dataType, writable, historianTagname, isArray, arrayLength);
|
||||
|
||||
/// <summary>Rebuilds the entire OPC UA address space.</summary>
|
||||
public void RebuildAddressSpace() => _nodeManager.RebuildAddressSpace();
|
||||
|
||||
Reference in New Issue
Block a user