Implement native MXAccess writes in the Rust worker

This commit is contained in:
Joseph Doherty
2026-11-21 09:15:32 -05:00
parent 00a597b08b
commit d1769f81ff
6 changed files with 1050 additions and 87 deletions
+28 -6
View File
@@ -6,8 +6,8 @@ schemas at build time.
The worker authenticates the launch nonce, negotiates a frame limit, activates
LMXProxy on a dedicated message-pumping STA, and reports readiness and heartbeats.
It supports Register, Unregister, AddItem, RemoveItem, Advise, UnAdvise, and the
worker diagnostic commands. The worker uses the base MXAccess COM connection
It supports Register, Unregister, AddItem, RemoveItem, Advise,
AdviseSupervisory, UnAdvise, and the worker diagnostic commands. The worker uses the base MXAccess COM connection
point for OnDataChange, OperationComplete, and OnWriteComplete notifications.
OnDataChange carries the value, quality, MXAccess status records, source
timestamp when available, and worker sequence and timestamp. The bounded queue
@@ -17,10 +17,20 @@ gateway default.
Event conversion supports standard Automation scalar values and homogeneous
arrays of those types. Other variant types are reported as unknown with the
Automation type in the diagnostic. Writes, buffered or supervisory advice,
bulk commands, and alarms remain to be implemented. Unsupported commands
return `InvalidRequest`. The worker serializes commands. If a COM call exceeds
the STA timeout, the worker faults the session and exits.
Automation type in the diagnostic. The worker serializes commands and faults
the session if a COM call exceeds the STA timeout. Buffered advice, bulk
subscriptions, snapshot reads, and alarm commands are outside the current
implementation.
The worker supports Write, Write2, WriteSecured, and WriteSecured2, including
their bulk forms. It converts scalar and typed array inputs to Automation
VARIANTs. For a timestamped write, a protobuf timestamp becomes local
wall-clock time for MXAccess. Single-item replies carry the matching
OnWriteComplete status rows when MXAccess responds within the configured wait
(default 1,500 ms). This correlation uses the server and item handles supplied
by MXAccess. The event also flows through StreamEvents. Bulk results report
per-item COM acceptance and clients can observe commit outcomes on the event
stream.
## Build and test
@@ -62,6 +72,16 @@ launches the configured Rust worker. It verifies that the client receives
distinct good-quality integer values in sequence and that the worker emits no
new data for the item after UnAdvise.
Run the write round-trip on a development host with a writable integer test
item. The test writes and reads back distinct values, checks OnWriteComplete
and unary status rows, exercises partial bulk failure, and restores the
original value through Write2.
```powershell
$env:MXGATEWAY_LIVE_MXACCESS_ITEM = 'TestChildObject.TestInt'
dotnet test src/ZB.MOM.WW.MxGateway.IntegrationTests --filter FullyQualifiedName~GatewayGrpc_WithRustWorker_WritesAndReceivesOnWriteComplete
```
## COM interface evidence
The native adapter uses the dual `ILMXProxyServer` interface from the installed
@@ -78,3 +98,5 @@ the corresponding native calls and event callbacks.
`ev_78053da509335e3e3749b8e6bb020f28c45255b54d910546659c6760eb52160b`
- REA event member evidence
`ev_97162abcd831b2d84b5b43fb72cd9876252bbe3bb0af5c4673a6954911500e54`
- REA write member evidence for `ILMXProxyServer` and `ILMXProxyServer4`
`ev_1b4fe7ab436437391b76f9fa3a300f45b58a4e1cff6aa84e30854f653c0a20df`