worker(alarms): advise ack-comment subtag so the ack write targets an active MXAccess item

This commit is contained in:
Joseph Doherty
2026-06-13 11:23:39 -04:00
parent 98e997b573
commit 1a9367b5de
2 changed files with 13 additions and 7 deletions
@@ -40,9 +40,9 @@ public sealed class SubtagAlarmConsumerTests
return new SubtagAlarmConsumer(source, new[] { BuildTarget() }); return new SubtagAlarmConsumer(source, new[] { BuildTarget() });
} }
/// <summary>Verifies Subscribe advises the active, acked, and priority subtags but not the ack-comment subtag.</summary> /// <summary>Verifies Subscribe advises the active, acked, priority, and ack-comment subtags (the ack-comment is advised so it is an active, writable MXAccess item).</summary>
[Fact] [Fact]
public void Subscribe_AdvisesActiveAndAckedSubtags() public void Subscribe_AdvisesAllSubtagsIncludingAckComment()
{ {
FakeSource source = new FakeSource(); FakeSource source = new FakeSource();
using SubtagAlarmConsumer consumer = BuildConsumer(source); using SubtagAlarmConsumer consumer = BuildConsumer(source);
@@ -52,7 +52,7 @@ public sealed class SubtagAlarmConsumerTests
Assert.Contains(ActiveSubtag, source.Advised); Assert.Contains(ActiveSubtag, source.Advised);
Assert.Contains(AckedSubtag, source.Advised); Assert.Contains(AckedSubtag, source.Advised);
Assert.Contains(PrioritySubtag, source.Advised); Assert.Contains(PrioritySubtag, source.Advised);
Assert.DoesNotContain(AckCommentSubtag, source.Advised); Assert.Contains(AckCommentSubtag, source.Advised);
} }
/// <summary>Verifies an active=true value change raises a degraded, GUID-stamped UNACK_ALM transition.</summary> /// <summary>Verifies an active=true value change raises a degraded, GUID-stamped UNACK_ALM transition.</summary>
@@ -78,10 +78,15 @@ public sealed class SubtagAlarmConsumer : IMxAccessAlarmConsumer
} }
/// <summary> /// <summary>
/// Advises every observable alarm subtag (active / acked / priority /// Advises every alarm subtag (active / acked / priority, plus the
/// the ack-comment subtag is a write-only target and is not advised) /// ack-comment subtag) and begins listening for value changes. The
/// and begins listening for value changes. The <paramref name="subscription"/> /// ack-comment subtag is advised so it is an active MXAccess item by the
/// expression is ignored: the subtag set is fixed by the watch list. /// time <see cref="AcknowledgeByName"/> writes it — MXAccess rejects a
/// write to an added-but-not-advised item with E_INVALIDARG (confirmed
/// against live MXAccess). Its value changes carry no transition (the
/// state machine ignores addresses it does not map to active/acked).
/// The <paramref name="subscription"/> expression is ignored: the subtag
/// set is fixed by the watch list.
/// </summary> /// </summary>
/// <param name="subscription">The subscription expression (unused in subtag mode).</param> /// <param name="subscription">The subscription expression (unused in subtag mode).</param>
public void Subscribe(string subscription) public void Subscribe(string subscription)
@@ -97,6 +102,7 @@ public sealed class SubtagAlarmConsumer : IMxAccessAlarmConsumer
AddIfNotEmpty(addresses, target.ActiveSubtag); AddIfNotEmpty(addresses, target.ActiveSubtag);
AddIfNotEmpty(addresses, target.AckedSubtag); AddIfNotEmpty(addresses, target.AckedSubtag);
AddIfNotEmpty(addresses, target.PrioritySubtag); AddIfNotEmpty(addresses, target.PrioritySubtag);
AddIfNotEmpty(addresses, target.AckCommentSubtag);
} }
source.Advise(addresses); source.Advise(addresses);