Files
lmxopcua/src/Core/ZB.MOM.WW.OtOpcUa.Commons/OpcUa/AlarmConditionSnapshot.cs
T

46 lines
2.5 KiB
C#

namespace ZB.MOM.WW.OtOpcUa.Commons.OpcUa;
/// <summary>
/// Commons-level projection of an alarm's full OPC UA Part 9 condition state, carried from the
/// Runtime engine to the SDK sink. Commons cannot reference <c>Core.ScriptedAlarms</c> (its
/// domain enums live there), so this DTO is deliberately primitive: every field is a
/// <see cref="bool"/>, the Commons-local <see cref="AlarmShelvingKind"/> enum, a
/// <see cref="ushort"/> severity, or a <see cref="string"/>. The Runtime host maps its Core
/// <c>AlarmConditionState</c> + <c>AlarmSeverity</c> down to this shape; the SDK
/// <c>OtOpcUaNodeManager</c> projects it back up onto a real <c>AlarmConditionState</c> node.
/// </summary>
/// <param name="Active">Whether the alarm condition is currently active (ActiveState).</param>
/// <param name="Acknowledged">Whether the active transition has been acknowledged (AckedState).</param>
/// <param name="Confirmed">Whether the clear transition has been confirmed (ConfirmedState).</param>
/// <param name="Enabled">Whether the alarm is enabled (EnabledState); a disabled alarm reports no events.</param>
/// <param name="Shelving">The shelving mode (ShelvingState): unshelved, one-shot, or timed.</param>
/// <param name="Severity">OPC UA severity on the 1..1000 scale (the SDK <c>SetSeverity</c> input).</param>
/// <param name="Message">The human-readable condition message (LocalizedText payload).</param>
public sealed record AlarmConditionSnapshot(
bool Active,
bool Acknowledged,
bool Confirmed,
bool Enabled,
AlarmShelvingKind Shelving,
ushort Severity,
string Message);
/// <summary>
/// Commons-local mirror of the Core <c>ShelvingKind</c> enum so this assembly carries no
/// dependency on <c>Core.ScriptedAlarms</c>. <see cref="Unshelved"/> = no suppression,
/// <see cref="OneShot"/> = suppress the next active transition, <see cref="Timed"/> = suppress
/// until a configured expiry. The Runtime host maps the Core enum onto these members; the SDK
/// sink maps them onto the Part 9 <c>SetShelvingState(shelved, oneShot, shelvingTime)</c> flags.
/// </summary>
public enum AlarmShelvingKind
{
/// <summary>No shelving — the alarm behaves normally.</summary>
Unshelved,
/// <summary>One-shot shelve — suppresses the next active transition, then expires.</summary>
OneShot,
/// <summary>Timed shelve — suppresses until a configured expiry timestamp passes.</summary>
Timed,
}