namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
///
/// Event data for an alarm or condition notification from the OPC UA server.
///
public sealed class AlarmEventArgs : EventArgs
{
/// Initializes a new instance of the class.
/// The name of the source object that raised the alarm.
/// The condition type name.
/// The alarm severity (0-1000).
/// Human-readable alarm message.
/// Whether the alarm should be retained in the display.
/// Whether the alarm condition is currently active.
/// Whether the alarm has been acknowledged.
/// The time the event occurred.
/// The EventId used for alarm acknowledgment.
/// The NodeId of the condition instance.
/// Operator-supplied comment on acknowledgment transitions.
/// When the alarm originally entered the active state.
/// Upstream alarm taxonomy bucket (e.g. Process, Safety, Diagnostics).
public AlarmEventArgs(
string sourceName,
string conditionName,
ushort severity,
string message,
bool retain,
bool activeState,
bool ackedState,
DateTime time,
byte[]? eventId = null,
string? conditionNodeId = null,
string? operatorComment = null,
DateTime? originalRaiseTimestampUtc = null,
string? alarmCategory = null)
{
SourceName = sourceName;
ConditionName = conditionName;
Severity = severity;
Message = message;
Retain = retain;
ActiveState = activeState;
AckedState = ackedState;
Time = time;
EventId = eventId;
ConditionNodeId = conditionNodeId;
OperatorComment = operatorComment;
OriginalRaiseTimestampUtc = originalRaiseTimestampUtc;
AlarmCategory = alarmCategory;
}
/// The name of the source object that raised the alarm.
public string SourceName { get; }
/// The condition type name.
public string ConditionName { get; }
/// The alarm severity (0-1000).
public ushort Severity { get; }
/// Human-readable alarm message.
public string Message { get; }
/// Whether the alarm should be retained in the display.
public bool Retain { get; }
/// Whether the alarm condition is currently active.
public bool ActiveState { get; }
/// Whether the alarm has been acknowledged.
public bool AckedState { get; }
/// The time the event occurred.
public DateTime Time { get; }
/// The EventId used for alarm acknowledgment.
public byte[]? EventId { get; }
/// The NodeId of the condition instance (SourceNode), used for acknowledgment.
public string? ConditionNodeId { get; }
///
/// PR E.7 — Operator-supplied comment recorded by the upstream alarm system on
/// Acknowledge transitions. Null on raise / clear events, and intentionally null
/// on the Galaxy OPC UA sub-attribute fallback path for two unrecoverable reasons:
/// (a) Galaxy's AckMsg attribute is WRITE-ONLY — no readable attribute
/// exposes the last operator comment — and (b) the OPC UA event SelectClause
/// carries no comment field. The operator comment is only available via the
/// gateway's native alarm feed (GalaxyAlarmTransition.OperatorComment
/// in the Galaxy driver path).
///
public string? OperatorComment { get; }
///
/// PR E.7 — When the alarm originally entered the active state. Preserved
/// across Acknowledge transitions so OPC UA Part 9 conditions keep the
/// original raise time. Null when the upstream path doesn't surface it.
///
public DateTime? OriginalRaiseTimestampUtc { get; }
///
/// PR E.7 — Upstream alarm taxonomy bucket (e.g. Process /
/// Safety / Diagnostics). Null when not surfaced.
///
public string? AlarmCategory { get; }
}