namespace ZB.MOM.WW.MxGateway.Worker.MxAccess;
public interface IMxAccessServer
{
/// Registers a client and returns a server handle.
/// Name of the client requesting registration.
/// Server handle for subsequent operations.
int Register(string clientName);
/// Unregisters a server handle.
/// Server handle to unregister.
void Unregister(int serverHandle);
/// Adds an item to a server and returns an item handle.
/// Server handle identifying the registration.
/// Item definition string.
/// Item handle for the added item.
int AddItem(
int serverHandle,
string itemDefinition);
/// Adds an item with context to a server and returns an item handle.
/// Server handle identifying the registration.
/// Item definition string.
/// Item context string.
/// Item handle for the added item.
int AddItem2(
int serverHandle,
string itemDefinition,
string itemContext);
/// Removes an item from a server.
/// Server handle identifying the registration.
/// Item handle to remove.
void RemoveItem(
int serverHandle,
int itemHandle);
/// Subscribes to change notifications for an item.
/// Server handle identifying the registration.
/// Item handle to subscribe to.
void Advise(
int serverHandle,
int itemHandle);
/// Unsubscribes from change notifications for an item.
/// Server handle identifying the registration.
/// Item handle to unsubscribe from.
void UnAdvise(
int serverHandle,
int itemHandle);
/// Subscribes to supervisory change notifications for an item.
/// Server handle identifying the registration.
/// Item handle to subscribe to.
void AdviseSupervisory(
int serverHandle,
int itemHandle);
/// Suspends data acquisition for an advised item (ILMXProxyServer4).
/// Server handle identifying the registration.
/// Item handle to suspend.
///
/// The native MXAccess MxStatus value (boxed) produced by the call.
/// Callers convert it to a protobuf MxStatusProxy via the worker's
/// status converter; the underlying type is reflected over, not cast.
///
object Suspend(
int serverHandle,
int itemHandle);
/// Reactivates data acquisition for a suspended item (ILMXProxyServer4).
/// Server handle identifying the registration.
/// Item handle to activate.
///
/// The native MXAccess MxStatus value (boxed) produced by the call.
/// Callers convert it to a protobuf MxStatusProxy via the worker's
/// status converter; the underlying type is reflected over, not cast.
///
object Activate(
int serverHandle,
int itemHandle);
/// Authenticates an MXAccess user and returns its user id (base ILMXProxyServer).
/// Server handle identifying the registration.
/// MXAccess user name to authenticate.
///
/// Raw MXAccess credential. Implementations must keep this value out of
/// logs, metrics, command lines, and diagnostics.
///
/// The MXAccess user id for the authenticated user.
int AuthenticateUser(
int serverHandle,
string verifyUser,
string verifyUserPassword);
/// Resolves an ArchestrA user GUID to an MXAccess user id (ILMXProxyServer2).
/// Server handle identifying the registration.
/// ArchestrA user GUID to resolve.
/// The MXAccess user id for the resolved user.
int ArchestrAUserToId(
int serverHandle,
string userIdGuid);
/// Adds a buffered item to a server and returns an item handle (ILMXProxyServer5).
/// Server handle identifying the registration.
/// Item definition string.
/// Item context string.
/// Item handle for the added buffered item.
int AddBufferedItem(
int serverHandle,
string itemDefinition,
string itemContext);
/// Sets the buffered-update interval for a server (ILMXProxyServer5).
/// Server handle identifying the registration.
/// Buffered update interval in milliseconds.
void SetBufferedUpdateInterval(
int serverHandle,
int updateIntervalMilliseconds);
/// Writes a value to an item.
/// Server handle identifying the registration.
/// Item handle to write to.
/// COM-marshalable value to write; writes an MXAccess null.
/// MXAccess user id (security classification) for the write.
void Write(
int serverHandle,
int itemHandle,
object? value,
int userId);
/// Writes a value with an explicit source timestamp to an item.
/// Server handle identifying the registration.
/// Item handle to write to.
/// COM-marshalable value to write; writes an MXAccess null.
/// COM-marshalable source timestamp for the write.
/// MXAccess user id (security classification) for the write.
void Write2(
int serverHandle,
int itemHandle,
object? value,
object? timestamp,
int userId);
/// Performs a secured/verified write to an item.
/// Server handle identifying the registration.
/// Item handle to write to.
/// MXAccess user id of the operator performing the write.
/// MXAccess user id of the verifier authorizing the write.
/// COM-marshalable value to write; writes an MXAccess null.
void WriteSecured(
int serverHandle,
int itemHandle,
int currentUserId,
int verifierUserId,
object? value);
/// Performs a secured/verified write with an explicit source timestamp.
/// Server handle identifying the registration.
/// Item handle to write to.
/// MXAccess user id of the operator performing the write.
/// MXAccess user id of the verifier authorizing the write.
/// COM-marshalable value to write; writes an MXAccess null.
/// COM-marshalable source timestamp for the write.
void WriteSecured2(
int serverHandle,
int itemHandle,
int currentUserId,
int verifierUserId,
object? value,
object? timestamp);
}