using ArchestrA.MxAccess;
namespace ZB.MOM.WW.OtOpcUa.Host.Domain
{
///
/// Delegate matching LMXProxyServer.OnDataChange COM event signature.
///
/// The runtime connection handle that raised the change.
/// The runtime item handle for the attribute that changed.
/// The new raw runtime value for the attribute.
/// The OPC DA quality code supplied by the runtime.
/// The timestamp object supplied by the runtime for the value.
/// The MXAccess status payload associated with the callback.
public delegate void MxDataChangeHandler(
int hLMXServerHandle,
int phItemHandle,
object pvItemValue,
int pwItemQuality,
object pftItemTimeStamp,
ref MXSTATUS_PROXY[] ItemStatus);
///
/// Delegate matching LMXProxyServer.OnWriteComplete COM event signature.
///
/// The runtime connection handle that processed the write.
/// The runtime item handle that was written.
/// The MXAccess status payload describing the write outcome.
public delegate void MxWriteCompleteHandler(
int hLMXServerHandle,
int phItemHandle,
ref MXSTATUS_PROXY[] ItemStatus);
///
/// Abstraction over LMXProxyServer COM object to enable testing without the COM runtime. (MXA-001)
///
public interface IMxProxy
{
///
/// Registers the bridge as an MXAccess client with the runtime proxy.
///
/// The client identity reported to the runtime for diagnostics and session tracking.
/// The runtime connection handle assigned to the client session.
int Register(string clientName);
///
/// Unregisters the bridge from the runtime proxy and releases the connection handle.
///
/// The connection handle returned by .
void Unregister(int handle);
///
/// Adds a Galaxy attribute reference to the active runtime session.
///
/// The runtime connection handle.
/// The fully qualified attribute reference to resolve.
/// The runtime item handle assigned to the attribute.
int AddItem(int handle, string address);
///
/// Removes a previously registered attribute from the runtime session.
///
/// The runtime connection handle.
/// The item handle returned by .
void RemoveItem(int handle, int itemHandle);
///
/// Starts supervisory updates for an attribute so runtime changes are pushed to the bridge.
///
/// The runtime connection handle.
/// The item handle to monitor.
void AdviseSupervisory(int handle, int itemHandle);
///
/// Stops supervisory updates for an attribute.
///
/// The runtime connection handle.
/// The item handle to stop monitoring.
void UnAdviseSupervisory(int handle, int itemHandle);
///
/// Writes a new value to a runtime attribute through the COM proxy.
///
/// The runtime connection handle.
/// The item handle to write.
/// The new value to push into the runtime.
/// The Wonderware security classification applied to the write.
void Write(int handle, int itemHandle, object value, int securityClassification);
///
/// Occurs when the runtime pushes a data-change callback for a subscribed attribute.
///
event MxDataChangeHandler? OnDataChange;
///
/// Occurs when the runtime acknowledges completion of a write request.
///
event MxWriteCompleteHandler? OnWriteComplete;
}
}