worker: AlarmClientConsumer + transition mapper (PR A.5) #116
Reference in New Issue
Block a user
Delete Branch "track-a5-alarm-consumer-wiring"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Wires the worker-side consumer for AVEVA alarm transitions over the
aaAlarmManagedClientAPI discovered in the foundation PR.IAlarmMgrDataProvider.dllreferenced — exposesAlarmRecord+eAlmTransitions/eQueryType/eSortFlags/eAlarmFilterState. Both DLLs load in the worker's existing net48 x86 process; no new bitness boundary.IMxAccessAlarmConsumerabstraction —Subscribe/AcknowledgeByGuid/SnapshotActiveAlarms/AlarmRecordReceivedevent. Test seam.AlarmClientConsumerproduction wrapper —RegisterConsumer+Subscribe+AlarmAckByGUID+GetStatistics-based active-alarm walk, all delegated toAlarmClient. Uses AVEVA's managed event surface (GetAlarmChangesCompletedonIAlarmMgrDataProvider) so no Windows message pump is required.AlarmRecordTransitionMapper— pure-function helpers:MapTransitionKind(eAlmTransitions): ALM→Raise, ACK→Acknowledge, RTN→Clear, others (SUB/ENB/DIS/SUP/REL/REMOVE)→Unspecified.ComposeFullReference(provider, group, name):Provider!Group.Nameformat matching AVEVA's standard syntax.Pinned during dev-rig validation
RegisterConsumeracceptshWnd=0— if it requires a real hwnd, the worker creates a hidden message-only window. The managed event surface should make this irrelevant.AlarmClientConsumer.AlarmRecordReceived: the AVEVAIAlarmMgrDataProvider.GetAlarmChangesCompletedevent needs to be hooked from inside theAlarmClient— find the proper accessor.MxAccessAlarmEventSink.EnqueueTransition(existing plumbing). Field names (ar_OrigTime, AlarmName, AckOperatorFullName, AckComment) pinned in the preserved discovery dump.Test plan
ComposeFullReferencecases + 1 Skip-gated discovery probe)Private=falseand isn't copied to the test bin directory.Wires the worker-side consumer for AVEVA alarm transitions over the aaAlarmManagedClient API discovered in the prior foundation PR. - IAlarmMgrDataProvider.dll referenced — exposes AlarmRecord + eAlmTransitions / eQueryType / eSortFlags / eAlarmFilterState. Both DLLs (aaAlarmManagedClient + IAlarmMgrDataProvider) load in the worker's existing net48 x86 process; no new bitness boundary. - IMxAccessAlarmConsumer abstraction — Subscribe / AcknowledgeByGuid / SnapshotActiveAlarms / AlarmRecordReceived event. Test seam. - AlarmClientConsumer production wrapper — RegisterConsumer + Subscribe + AlarmAckByGUID + GetStatistics-based active-alarm walk, all delegated to AlarmClient. Uses AVEVA's managed event surface (GetAlarmChangesCompleted on IAlarmMgrDataProvider) so no Windows message pump is required — plain .NET events arrive on the alarm-client's internal callback thread. - AlarmRecordTransitionMapper — pure-function helpers: MapTransitionKind(eAlmTransitions): ALM→Raise, ACK→Acknowledge, RTN→Clear, others (SUB/ENB/DIS/SUP/REL/REMOVE)→Unspecified so EventPump's decoding-failure counter records them. ComposeFullReference(provider, group, name): Provider!Group.Name format matching AVEVA's standard alarm-reference syntax. Pinned during dev-rig validation (subsequent commits): 1. Confirm RegisterConsumer accepts hWnd=0 — if it requires a real hwnd, the worker creates a hidden message-only window and passes that handle. The managed event surface should make this irrelevant but the AVEVA API is older than its managed wrapper. 2. Wire AlarmClientConsumer.AlarmRecordReceived: the AVEVA IAlarmMgrDataProvider.GetAlarmChangesCompleted event needs to be hooked from inside the AlarmClient — find the proper accessor (likely a property exposing the inner provider). 3. AlarmRecord field-by-field translation into the proto event uses MxAccessAlarmEventSink.EnqueueTransition (existing plumbing). The AlarmRecord field names (ar_OrigTime, AlarmName, AckOperatorFullName, AckComment, etc.) are pinned in the discovery dump preserved in AlarmClientDiscoveryTests. Tests: 127 pass (4 new ComposeFullReference cases + 1 Skip-gated discovery probe). Transition-kind enum mapping is dev-rig-validated rather than unit-tested because the AVEVA assembly is Private=false on the reference and isn't copied to the test bin directory. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>