namespace ZB.MOM.WW.OtOpcUa.Core.Abstractions; /// /// Driver capability for data-change subscriptions — covers both native subscriptions /// (Galaxy MXAccess advisory, OPC UA monitored items, TwinCAT ADS notifications) and /// driver-internal polled subscriptions (Modbus, AB CIP, S7, FOCAS). The driver owns /// its polling loop where applicable; the Core just sees /// callbacks regardless of mechanism. /// public interface ISubscribable { /// /// Subscribe to data changes for a batch of attributes. /// The driver MAY fire immediately with the current value /// (initial-data callback per OPC UA convention) and again on every change. /// /// An opaque subscription handle the caller passes to . Task SubscribeAsync( IReadOnlyList fullReferences, TimeSpan publishingInterval, CancellationToken cancellationToken); /// Cancel a subscription returned by . Task UnsubscribeAsync(ISubscriptionHandle handle, CancellationToken cancellationToken); /// /// Server-pushed data-change notification. Fires whenever a subscribed attribute changes, /// and (per OPC UA convention) on subscription establishment for current values. /// event EventHandler? OnDataChange; } /// Opaque subscription identity returned by . public interface ISubscriptionHandle { /// Driver-internal subscription identifier (for diagnostics + post-mortem). string DiagnosticId { get; } } /// Event payload for . /// The handle returned by the original call. /// Driver-side full reference of the changed attribute. /// New value + quality + timestamps. public sealed record DataChangeEventArgs( ISubscriptionHandle SubscriptionHandle, string FullReference, DataValueSnapshot Snapshot);