Auto: twincat-3.1 — per-tag MaxDelay tuning

Closes #313
This commit is contained in:
Joseph Doherty
2026-04-26 01:45:12 -04:00
parent 621de94126
commit fb57717f6f
11 changed files with 261 additions and 9 deletions

View File

@@ -315,12 +315,13 @@ internal class FakeTwinCATClient : ITwinCATClient
public virtual Task<ITwinCATNotificationHandle> AddNotificationAsync(
string symbolPath, TwinCATDataType type, int? bitIndex, TimeSpan cycleTime,
int maxDelayMs,
Action<string, object?> onChange, CancellationToken cancellationToken)
{
if (ThrowOnAddNotification)
throw Exception ?? new InvalidOperationException("fake AddNotification failure");
var reg = new FakeNotification(symbolPath, type, bitIndex, onChange, this);
var reg = new FakeNotification(symbolPath, type, bitIndex, cycleTime, maxDelayMs, onChange, this);
Notifications.Add(reg);
return Task.FromResult<ITwinCATNotificationHandle>(reg);
}
@@ -352,11 +353,16 @@ internal class FakeTwinCATClient : ITwinCATClient
public sealed class FakeNotification(
string symbolPath, TwinCATDataType type, int? bitIndex,
TimeSpan cycleTime, int maxDelayMs,
Action<string, object?> onChange, FakeTwinCATClient owner) : ITwinCATNotificationHandle
{
public string SymbolPath { get; } = symbolPath;
public TwinCATDataType Type { get; } = type;
public int? BitIndex { get; } = bitIndex;
/// <summary>Cycle time the driver requested (PR 3.1 — captured for tests).</summary>
public TimeSpan CycleTime { get; } = cycleTime;
/// <summary>Per-tag MaxDelay in ms (PR 3.1 / #313). 0 = no coalescing.</summary>
public int MaxDelayMs { get; } = maxDelayMs;
public Action<string, object?> OnChange { get; } = onChange;
public bool Disposed { get; private set; }