namespace ZB.MOM.WW.OtOpcUa.Core.Abstractions;
///
/// Driver capability for alarm events. Optional — only drivers whose backends expose
/// alarm conditions implement this. Currently: Galaxy (MxAccess alarms), FOCAS
/// (CNC alarms), OPC UA Client (A&C events from upstream server).
///
public interface IAlarmSource
{
///
/// Subscribe to alarm events for a node-set (typically: a folder or equipment subtree).
/// The driver fires for every alarm transition.
///
/// The driver node IDs to subscribe to.
/// Cancellation token for the operation.
Task SubscribeAlarmsAsync(
IReadOnlyList sourceNodeIds,
CancellationToken cancellationToken);
/// Cancel an alarm subscription returned by .
/// The subscription handle returned from .
/// Cancellation token for the operation.
Task UnsubscribeAlarmsAsync(IAlarmSubscriptionHandle handle, CancellationToken cancellationToken);
/// Acknowledge one or more active alarms by source node ID + condition ID.
/// The batch of alarm acknowledgement requests.
/// Cancellation token for the operation.
Task AcknowledgeAsync(
IReadOnlyList acknowledgements,
CancellationToken cancellationToken);
/// Server-pushed alarm transition (raise / clear / change).
event EventHandler? OnAlarmEvent;
}
/// Opaque alarm-subscription identity returned by .
public interface IAlarmSubscriptionHandle
{
/// Driver-internal subscription identifier (for diagnostics + post-mortem).
string DiagnosticId { get; }
}
/// One alarm acknowledgement in a batch.
public sealed record AlarmAcknowledgeRequest(
string SourceNodeId,
string ConditionId,
string? Comment);
/// Event payload for .
/// Subscription this event belongs to.
/// Driver-side identifier for the alarm source.
/// Stable id correlating raise / ack / clear of the same condition.
/// Driver-defined alarm type name (e.g. AnalogLimitAlarm.HiHi).
/// Human-readable alarm description.
/// Four-bucket severity ladder.
/// When this transition occurred.
///
/// Operator-supplied comment recorded by the upstream alarm system on Acknowledge
/// transitions. Null on raise / clear, or when the upstream path can't surface
/// the comment (the Galaxy sub-attribute fallback path collapses comments into a
/// single string write — null on that path; the driver-native gateway path
/// populates this).
///
///
/// When the alarm originally entered the active state. Preserved across
/// Acknowledge transitions so OPC UA Part 9 conditions keep the original raise
/// time in Time. Null when the upstream path doesn't surface it.
///
///
/// Upstream alarm taxonomy bucket (e.g. Process / Safety /
/// Diagnostics). Maps to OPC UA ConditionClassName downstream when
/// a class mapping is configured. Null when the upstream path doesn't carry it.
///
public sealed record AlarmEventArgs(
IAlarmSubscriptionHandle SubscriptionHandle,
string SourceNodeId,
string ConditionId,
string AlarmType,
string Message,
AlarmSeverity Severity,
DateTime SourceTimestampUtc,
string? OperatorComment = null,
DateTime? OriginalRaiseTimestampUtc = null,
string? AlarmCategory = null);
/// Mirrors the NodePermissions alarm-severity enum in docs/v2/acl-design.md.
public enum AlarmSeverity { Low, Medium, High, Critical }