feat(grpc-data): A1 — Heidenhain signals per control after each Good alarm walk
This commit is contained in:
@@ -161,7 +161,8 @@ internal static class HeidenhainAlarmRules
|
||||
/// is <c>DriverInstanceActor</c>'s non-blocking <c>Tell</c>.</para>
|
||||
/// </remarks>
|
||||
internal sealed class HeidenhainAlarmProjection(
|
||||
object sender, Func<EventHandler<AlarmEventArgs>?> handlers, ILogger logger, string driverInstanceId = "")
|
||||
object sender, Func<EventHandler<AlarmEventArgs>?> handlers, ILogger logger, string driverInstanceId = "",
|
||||
Func<EventHandler<AlarmInitialStateEventArgs>?>? initialState = null)
|
||||
{
|
||||
/// <summary>The shortest gap between two "unclaimed alarms" log lines for one control (lmxopcua#839).</summary>
|
||||
internal static readonly TimeSpan DefaultUnmatchedLogInterval = TimeSpan.FromMinutes(1);
|
||||
@@ -266,6 +267,22 @@ internal sealed class HeidenhainAlarmProjection(
|
||||
_told[tag.RawPath] = nowTold;
|
||||
if (evt is not null) Deliver(h, evt);
|
||||
}
|
||||
|
||||
// grpc-data A1 (§5.1 Heidenhain row, G1): a Good walk applied this control's alarms — its subscribed
|
||||
// conditions are established. Per host, under the same lock and handler gate (G5), after the events (F2).
|
||||
// A non-Good walk returned above and raises nothing.
|
||||
if (initialState?.Invoke() is { } signal)
|
||||
{
|
||||
var args = new AlarmInitialStateEventArgs(subscribed.Select(t => t.RawPath).ToList());
|
||||
foreach (var registration in signal.GetInvocationList())
|
||||
{
|
||||
try { ((EventHandler<AlarmInitialStateEventArgs>)registration).Invoke(sender, args); }
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogWarning(ex, "Heidenhain {Host}: an initial-alarm-state subscriber threw; delivery continues", hostName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.Heidenhain;
|
||||
/// dedup (subscriptions dedup on value AND status).</para>
|
||||
/// </remarks>
|
||||
public sealed class HeidenhainDriver : IDriver, IReadable, ISubscribable, ITagDiscovery, IHostConnectivityProbe,
|
||||
IPerCallHostResolver, ISkippedTagReporter, IDriverDiagnostics, IAlarmSource, IRediscoverable, IAsyncDisposable
|
||||
IPerCallHostResolver, ISkippedTagReporter, IDriverDiagnostics, IAlarmSource, IAlarmInitialStateSignal, IRediscoverable, IAsyncDisposable
|
||||
{
|
||||
/// <summary>Most custom (PLC/DATA) bindings one control may carry (reference limit).</summary>
|
||||
public const int MaxCustomBindingsPerDevice = 256;
|
||||
@@ -87,7 +87,7 @@ public sealed class HeidenhainDriver : IDriver, IReadable, ISubscribable, ITagDi
|
||||
_credentials = credentials;
|
||||
_clientFactory = clientFactory ?? ((h, p, t) => new Lsv2Client(h, p, t));
|
||||
_time = time ?? TimeProvider.System;
|
||||
_alarms = new HeidenhainAlarmProjection(this, () => OnAlarmEvent, _logger, driverInstanceId);
|
||||
_alarms = new HeidenhainAlarmProjection(this, () => OnAlarmEvent, _logger, driverInstanceId, () => InitialAlarmStateDelivered);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -105,6 +105,11 @@ public sealed class HeidenhainDriver : IDriver, IReadable, ISubscribable, ITagDi
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<AlarmEventArgs>? OnAlarmEvent;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <remarks>grpc-data A1 (§5.1 Heidenhain row): raised per control after each Good alarm walk applied its alarms,
|
||||
/// covering that control's subscribed <c>ALARM:</c> conditions. A non-Good walk raises nothing.</remarks>
|
||||
public event EventHandler<AlarmInitialStateEventArgs>? InitialAlarmStateDelivered;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <remarks>
|
||||
/// Raised (advisory — the host shows a "re-browse" chip; nothing is re-materialised) when a control reconnects
|
||||
|
||||
Reference in New Issue
Block a user