docs(xmldoc): fill missing XML docs + strip tracking-ID comments across src
v2-ci / build (push) Failing after 41s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests) (push) Has been skipped
v2-ci / build (push) Failing after 41s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests) (push) Has been skipped
Adds <summary>/<param>/<returns>/<inheritdoc> where missing and removes project bookkeeping IDs (task/tracking refs) from shipped code comments, so the docs read cleanly and CommentChecker is quiet except for known false positives (PLC/protocol terms, event/IEqualityComparer inheritdoc). Doc/comment-only; no logic changed; solution builds clean.
This commit is contained in:
@@ -22,10 +22,6 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.TwinCAT;
|
||||
/// </remarks>
|
||||
internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
{
|
||||
// Bounded so a slow downstream consumer cannot back the AMS router thread up — the
|
||||
// router thread enqueues and returns immediately (Driver.TwinCAT-008). 50k matches the
|
||||
// Galaxy EventPump default; ~500 notifications/connection is the ADS ceiling so this is
|
||||
// generous headroom against bursty change storms.
|
||||
private const int NotificationQueueCapacity = 50_000;
|
||||
|
||||
private readonly AdsClient _client = new();
|
||||
@@ -57,9 +53,7 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
|
||||
private readonly record struct PendingNotification(NotificationRegistration Registration, object? Value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the client is connected.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public bool IsConnected => _client.IsConnected;
|
||||
|
||||
/// <summary>
|
||||
@@ -75,13 +69,7 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
return TwinCATStatusMapper.MapAdsError(adsError);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Connects to the specified ADS target asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="address">The AMS address to connect to.</param>
|
||||
/// <param name="timeout">The connection timeout.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>A task representing the asynchronous connection operation.</returns>
|
||||
/// <inheritdoc />
|
||||
public Task ConnectAsync(TwinCATAmsAddress address, TimeSpan timeout, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_client.IsConnected) return Task.CompletedTask;
|
||||
@@ -91,16 +79,7 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a value from the specified symbol path asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="symbolPath">The ADS symbol path to read from.</param>
|
||||
/// <param name="type">The TwinCAT data type.</param>
|
||||
/// <param name="bitIndex">Optional bit index for BOOL values within larger containers.</param>
|
||||
/// <param name="arrayCount">When non-null, read a 1-D array of this many <paramref name="type"/>
|
||||
/// elements; the boxed value is the element-typed CLR array (e.g. <c>int[]</c>). Phase 4c.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>A tuple containing the value and OPC UA status code.</returns>
|
||||
/// <inheritdoc />
|
||||
public async Task<(object? value, uint status)> ReadValueAsync(
|
||||
string symbolPath,
|
||||
TwinCATDataType type,
|
||||
@@ -170,17 +149,7 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
: symbolPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes a value to the specified symbol path asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="symbolPath">The ADS symbol path to write to.</param>
|
||||
/// <param name="type">The TwinCAT data type.</param>
|
||||
/// <param name="bitIndex">Optional bit index for BOOL values. BOOL-within-word writes are handled
|
||||
/// upstream by <see cref="TwinCATDriver.WriteAsync"/> as a parent-word read-modify-write, so a
|
||||
/// bit index does not reach this method on the write path.</param>
|
||||
/// <param name="value">The value to write.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The OPC UA status code of the write operation.</returns>
|
||||
/// <inheritdoc />
|
||||
public async Task<uint> WriteValueAsync(
|
||||
string symbolPath,
|
||||
TwinCATDataType type,
|
||||
@@ -203,11 +172,7 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Probes the connection to verify the ADS target is reachable.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>True if the probe succeeds; otherwise false.</returns>
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> ProbeAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
@@ -221,17 +186,7 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a notification (subscription) for changes to the specified symbol.
|
||||
/// </summary>
|
||||
/// <param name="symbolPath">The ADS symbol path to monitor.</param>
|
||||
/// <param name="type">The TwinCAT data type.</param>
|
||||
/// <param name="bitIndex">Optional bit index for BOOL values.</param>
|
||||
/// <param name="cycleTime">The minimum cycle time between notifications.</param>
|
||||
/// <param name="maxDelayMs">The maximum delay before delivering a batched notification.</param>
|
||||
/// <param name="onChange">The callback to invoke when the value changes.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>A handle to manage the notification subscription.</returns>
|
||||
/// <inheritdoc />
|
||||
public async Task<ITwinCATNotificationHandle> AddNotificationAsync(
|
||||
string symbolPath,
|
||||
TwinCATDataType type,
|
||||
@@ -242,13 +197,6 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var clrType = MapToClrType(type);
|
||||
// NotificationSettings takes cycle + max-delay in milliseconds (Beckhoff InfoSys
|
||||
// tcadsnetref/7313319051 — "The unit is 1ms"). AdsTransMode.OnChange fires when
|
||||
// the value differs; OnCycle fires every cycle. OnChange is the right default for
|
||||
// OPC UA data-change semantics — the PLC already has the best view of "has this
|
||||
// changed" so we let it decide. maxDelayMs > 0 lets TwinCAT batch notifications up
|
||||
// to that delay before pushing them — exposed via TwinCATDriverOptions
|
||||
// (Driver.TwinCAT-014).
|
||||
var cycleMs = (int)Math.Max(1, cycleTime.TotalMilliseconds);
|
||||
var settings = new NotificationSettings(AdsTransMode.OnChange, cycleMs, Math.Max(0, maxDelayMs));
|
||||
|
||||
@@ -270,8 +218,8 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
/// <summary>
|
||||
/// Runs on the <see cref="AdsClient"/> AMS router thread. Does the cheap bit-extraction
|
||||
/// decode then enqueues — no driver logic, no consumer callbacks — so a slow consumer
|
||||
/// can never stall ADS notification delivery for the rest of the process
|
||||
/// (Driver.TwinCAT-008). Drops the notification (DropWrite) if the queue is saturated.
|
||||
/// can never stall ADS notification delivery for the rest of the process.
|
||||
/// Drops the notification (DropWrite) if the queue is saturated.
|
||||
/// </summary>
|
||||
private void OnAdsNotificationEx(object? sender, AdsNotificationExEventArgs args)
|
||||
{
|
||||
@@ -311,11 +259,7 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
catch { /* best-effort tear-down; target may already be gone */ }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Browses all available symbols on the connected ADS target asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>An async enumerable of discovered symbols.</returns>
|
||||
/// <inheritdoc />
|
||||
public async IAsyncEnumerable<TwinCATDiscoveredSymbol> BrowseSymbolsAsync(
|
||||
[EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
@@ -341,11 +285,6 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
foreach (var ds in TwinCATSymbolExpander.ExpandLeaves(
|
||||
loader.Symbols.Select(s => new AdsSymbolNode(s))))
|
||||
{
|
||||
// ThrowIfCancellationRequested — not yield break — so a cancelled browse propagates
|
||||
// as OperationCanceledException rather than a silent clean completion. DiscoverAsync
|
||||
// has an explicit catch(OperationCanceledException){ throw; } to surface this
|
||||
// distinctly from a genuine browse failure; a yield break would let a partial
|
||||
// symbol set appear as a fully successful discovery (Driver.TwinCAT-010).
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
yield return ds;
|
||||
}
|
||||
@@ -368,6 +307,11 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
private readonly IReadOnlyList<ITwinCATSymbolNode> _children;
|
||||
private readonly bool _readOnly;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AdsSymbolNode"/> class, computing its
|
||||
/// struct/mapped-type/children/read-only state eagerly from the wrapped <paramref name="symbol"/>.
|
||||
/// </summary>
|
||||
/// <param name="symbol">The Beckhoff ADS symbol to adapt.</param>
|
||||
public AdsSymbolNode(ISymbol symbol)
|
||||
{
|
||||
_symbol = symbol;
|
||||
@@ -379,14 +323,19 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
_readOnly = !IsSymbolWritable(symbol);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string InstancePath => _symbol.InstancePath;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsStruct => _isStruct;
|
||||
|
||||
/// <inheritdoc />
|
||||
public (TwinCATDataType? Type, int? ArrayLength) Mapped => _mapped;
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<ITwinCATSymbolNode> Children => _children;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool ReadOnly => _readOnly;
|
||||
}
|
||||
|
||||
@@ -577,9 +526,6 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
/// <summary>Default <see cref="ITwinCATClientFactory"/> — one <see cref="AdsTwinCATClient"/> per call.</summary>
|
||||
internal sealed class AdsTwinCATClientFactory : ITwinCATClientFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="AdsTwinCATClient"/> instance.
|
||||
/// </summary>
|
||||
/// <returns>A new <see cref="AdsTwinCATClient"/> instance.</returns>
|
||||
/// <inheritdoc />
|
||||
public ITwinCATClient Create() => new AdsTwinCATClient();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user