Auto: ablegacy-9 — per-device timeout / retry overrides

Closes #252
This commit is contained in:
Joseph Doherty
2026-04-26 03:32:45 -04:00
parent 4ff1537d8a
commit c292dcc1db
9 changed files with 585 additions and 51 deletions

View File

@@ -13,13 +13,35 @@ public sealed class AbLegacyDriverOptions
public IReadOnlyList<AbLegacyDeviceOptions> Devices { get; init; } = [];
public IReadOnlyList<AbLegacyTagDefinition> Tags { get; init; } = [];
public AbLegacyProbeOptions Probe { get; init; } = new();
/// <summary>
/// Driver-wide default per-operation timeout. Applies to every device unless that device
/// overrides it via <see cref="AbLegacyDeviceOptions.Timeout"/> (PR 9).
/// </summary>
public TimeSpan Timeout { get; init; } = TimeSpan.FromSeconds(2);
/// <summary>
/// PR 9 — driver-wide default retry count for transient
/// <c>BadCommunicationError</c> reads. <c>null</c> ≡ <c>0</c> (single attempt). Applies
/// to every device unless that device overrides it via
/// <see cref="AbLegacyDeviceOptions.Retries"/>.
/// </summary>
public int? Retries { get; init; }
}
/// <summary>
/// Per-device options for the AB Legacy driver. PR 9 added optional <see cref="Timeout"/>
/// and <see cref="Retries"/> overrides — chassis families have very different per-operation
/// latency floors (SLC 5/01 RS-232 ~5 s; SLC 5/05 ~2 s; ML1100 ~3 s) so a single driver-wide
/// timeout always misfires on at least one device. Both fields are optional and fall back
/// to the driver-wide default on <see cref="AbLegacyDriverOptions"/>.
/// </summary>
public sealed record AbLegacyDeviceOptions(
string HostAddress,
AbLegacyPlcFamily PlcFamily = AbLegacyPlcFamily.Slc500,
string? DeviceName = null);
string? DeviceName = null,
TimeSpan? Timeout = null,
int? Retries = null);
/// <summary>
/// One PCCC-backed OPC UA variable. <c>Address</c> is the canonical PCCC file-address