using System; using System.Threading; using System.Threading.Tasks; namespace ZB.MOM.WW.OtOpcUa.Host.Domain { /// /// Abstraction over MXAccess COM client for tag read/write/subscribe operations. /// (MXA-001 through MXA-009, OPC-007, OPC-008, OPC-009) /// public interface IMxAccessClient : IDisposable { /// /// Gets the current runtime connectivity state for the bridge. /// ConnectionState State { get; } /// /// Gets the number of active runtime subscriptions currently being mirrored into OPC UA. /// int ActiveSubscriptionCount { get; } /// /// Gets the number of reconnect cycles attempted since the client was created. /// int ReconnectCount { get; } /// /// Occurs when the MXAccess session changes state so the host can update diagnostics and retry logic. /// event EventHandler? ConnectionStateChanged; /// /// Occurs when a subscribed Galaxy attribute publishes a new runtime value. /// event Action? OnTagValueChanged; /// /// Opens the MXAccess session required for runtime reads, writes, and subscriptions. /// /// A token that cancels the connection attempt. Task ConnectAsync(CancellationToken ct = default); /// /// Closes the MXAccess session and releases runtime resources. /// Task DisconnectAsync(); /// /// Starts monitoring a Galaxy attribute so value changes can be pushed to OPC UA subscribers. /// /// The fully qualified MXAccess reference for the target attribute. /// The callback to invoke when the runtime publishes a new value for the attribute. Task SubscribeAsync(string fullTagReference, Action callback); /// /// Stops monitoring a Galaxy attribute when it is no longer needed by the OPC UA layer. /// /// The fully qualified MXAccess reference for the target attribute. Task UnsubscribeAsync(string fullTagReference); /// /// Reads the current runtime value for a Galaxy attribute. /// /// The fully qualified MXAccess reference for the target attribute. /// A token that cancels the read. /// The value, timestamp, and quality returned by the runtime. Task ReadAsync(string fullTagReference, CancellationToken ct = default); /// /// Writes a new runtime value to a writable Galaxy attribute. /// /// The fully qualified MXAccess reference for the target attribute. /// The value to write to the runtime. /// A token that cancels the write. /// when the write is accepted by the runtime; otherwise, . Task WriteAsync(string fullTagReference, object value, CancellationToken ct = default); } }