feat(worker): implement 6 MXAccess COM commands in executor

Wire up the previously-unimplemented Suspend, Activate, AuthenticateUser,
ArchestrAUserToId, AddBufferedItem, and SetBufferedUpdateInterval command
kinds in MxAccessCommandExecutor. These are real COM calls and run on the
STA via the executor.

- IMxAccessServer gains the 6 methods; MxAccessComServer routes them to the
  right interface version (Suspend/Activate -> ILMXProxyServer4 out MxStatus,
  AuthenticateUser -> base ILMXProxyServer, ArchestrAUserToId ->
  ILMXProxyServer2, AddBufferedItem/SetBufferedUpdateInterval ->
  ILMXProxyServer5).
- Suspend/Activate surface the native MxStatus, converted to MxStatusProxy
  via the existing MxStatusProxyConverter.
- AuthenticateUser hands the credential straight to MXAccess and never logs
  it; native HResult failures propagate via the dispatcher.
- MxAccessSession gains matching pass-throughs; AddBufferedItem registers
  the item handle in the handle registry.
- Unit tests (fake IMxAccessServer / fake COM object) cover each arm plus a
  password-non-leak assertion; existing IMxAccessServer fakes updated.

No proto changes (all request/reply messages already exist).
This commit is contained in:
Joseph Doherty
2026-06-15 10:41:22 -04:00
parent f94c206489
commit 29399325d5
8 changed files with 948 additions and 8 deletions
@@ -57,6 +57,68 @@ public interface IMxAccessServer
int serverHandle,
int itemHandle);
/// <summary>Suspends data acquisition for an advised item (ILMXProxyServer4).</summary>
/// <param name="serverHandle">Server handle identifying the registration.</param>
/// <param name="itemHandle">Item handle to suspend.</param>
/// <returns>
/// The native MXAccess <c>MxStatus</c> value (boxed) produced by the call.
/// Callers convert it to a protobuf <c>MxStatusProxy</c> via the worker's
/// status converter; the underlying type is reflected over, not cast.
/// </returns>
object Suspend(
int serverHandle,
int itemHandle);
/// <summary>Reactivates data acquisition for a suspended item (ILMXProxyServer4).</summary>
/// <param name="serverHandle">Server handle identifying the registration.</param>
/// <param name="itemHandle">Item handle to activate.</param>
/// <returns>
/// The native MXAccess <c>MxStatus</c> value (boxed) produced by the call.
/// Callers convert it to a protobuf <c>MxStatusProxy</c> via the worker's
/// status converter; the underlying type is reflected over, not cast.
/// </returns>
object Activate(
int serverHandle,
int itemHandle);
/// <summary>Authenticates an MXAccess user and returns its user id (base ILMXProxyServer).</summary>
/// <param name="serverHandle">Server handle identifying the registration.</param>
/// <param name="verifyUser">MXAccess user name to authenticate.</param>
/// <param name="verifyUserPassword">
/// Raw MXAccess credential. Implementations must keep this value out of
/// logs, metrics, command lines, and diagnostics.
/// </param>
/// <returns>The MXAccess user id for the authenticated user.</returns>
int AuthenticateUser(
int serverHandle,
string verifyUser,
string verifyUserPassword);
/// <summary>Resolves an ArchestrA user GUID to an MXAccess user id (ILMXProxyServer2).</summary>
/// <param name="serverHandle">Server handle identifying the registration.</param>
/// <param name="userIdGuid">ArchestrA user GUID to resolve.</param>
/// <returns>The MXAccess user id for the resolved user.</returns>
int ArchestrAUserToId(
int serverHandle,
string userIdGuid);
/// <summary>Adds a buffered item to a server and returns an item handle (ILMXProxyServer5).</summary>
/// <param name="serverHandle">Server handle identifying the registration.</param>
/// <param name="itemDefinition">Item definition string.</param>
/// <param name="itemContext">Item context string.</param>
/// <returns>Item handle for the added buffered item.</returns>
int AddBufferedItem(
int serverHandle,
string itemDefinition,
string itemContext);
/// <summary>Sets the buffered-update interval for a server (ILMXProxyServer5).</summary>
/// <param name="serverHandle">Server handle identifying the registration.</param>
/// <param name="updateIntervalMilliseconds">Buffered update interval in milliseconds.</param>
void SetBufferedUpdateInterval(
int serverHandle,
int updateIntervalMilliseconds);
/// <summary>Writes a value to an item.</summary>
/// <param name="serverHandle">Server handle identifying the registration.</param>
/// <param name="itemHandle">Item handle to write to.</param>