docs: backfill XML documentation across 756 files
v2-ci / build (push) Failing after 1m43s
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 1m43s
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>, <typeparam>, and <inheritdoc/> tags to public members surfaced by commentchecker — resolves 5,847 of 5,869 issues (99.6%) across three /fixdocs passes.
This commit is contained in:
@@ -46,6 +46,9 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
private readonly Task _dispatchLoop;
|
||||
private int _disposed;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AdsTwinCATClient"/> class.
|
||||
/// </summary>
|
||||
public AdsTwinCATClient()
|
||||
{
|
||||
_client.AdsNotificationEx += OnAdsNotificationEx;
|
||||
@@ -54,8 +57,14 @@ 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>
|
||||
public bool IsConnected => _client.IsConnected;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the symbol version changes on the connected ADS target.
|
||||
/// </summary>
|
||||
public event EventHandler? OnSymbolVersionChanged;
|
||||
|
||||
/// <summary>Raise <see cref="OnSymbolVersionChanged"/> when <paramref name="adsError"/> is <c>DeviceSymbolVersionInvalid</c> (1809 / 0x0711).</summary>
|
||||
@@ -66,6 +75,13 @@ 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>
|
||||
public Task ConnectAsync(TwinCATAmsAddress address, TimeSpan timeout, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_client.IsConnected) return Task.CompletedTask;
|
||||
@@ -75,6 +91,14 @@ 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="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>A tuple containing the value and OPC UA status code.</returns>
|
||||
public async Task<(object? value, uint status)> ReadValueAsync(
|
||||
string symbolPath,
|
||||
TwinCATDataType type,
|
||||
@@ -123,6 +147,15 @@ 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 (not supported for writes).</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>
|
||||
public async Task<uint> WriteValueAsync(
|
||||
string symbolPath,
|
||||
TwinCATDataType type,
|
||||
@@ -149,6 +182,11 @@ 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>
|
||||
public async Task<bool> ProbeAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
@@ -162,6 +200,17 @@ 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>
|
||||
public async Task<ITwinCATNotificationHandle> AddNotificationAsync(
|
||||
string symbolPath,
|
||||
TwinCATDataType type,
|
||||
@@ -228,6 +277,12 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a notification subscription by handle.
|
||||
/// </summary>
|
||||
/// <param name="handle">The notification handle to delete.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>A task representing the asynchronous delete operation.</returns>
|
||||
internal async Task DeleteNotificationAsync(uint handle, CancellationToken cancellationToken)
|
||||
{
|
||||
_notifications.TryRemove(handle, out _);
|
||||
@@ -235,6 +290,11 @@ 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>
|
||||
public async IAsyncEnumerable<TwinCATDiscoveredSymbol> BrowseSymbolsAsync(
|
||||
[EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
@@ -299,6 +359,9 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the client and releases all resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (Interlocked.Exchange(ref _disposed, 1) != 0) return;
|
||||
@@ -323,11 +386,29 @@ internal sealed class AdsTwinCATClient : ITwinCATClient
|
||||
AdsTwinCATClient owner,
|
||||
uint handle) : ITwinCATNotificationHandle
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the symbol path being monitored.
|
||||
/// </summary>
|
||||
public string SymbolPath { get; } = symbolPath;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the TwinCAT data type of the symbol.
|
||||
/// </summary>
|
||||
public TwinCATDataType Type { get; } = type;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional bit index for BOOL values.
|
||||
/// </summary>
|
||||
public int? BitIndex { get; } = bitIndex;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the callback to invoke when the value changes.
|
||||
/// </summary>
|
||||
public Action<string, object?> OnChange { get; } = onChange;
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the notification subscription.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
// Fire-and-forget AMS call — caller has already committed to the tear-down.
|
||||
@@ -388,5 +469,9 @@ 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>
|
||||
public ITwinCATClient Create() => new AdsTwinCATClient();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user