[twincat] TwinCAT — ENUM and ALIAS at discovery #345

Merged
dohertj2 merged 1 commits from auto/twincat/1.5 into auto/driver-gaps 2026-04-25 17:51:10 -04:00
Owner

Summary

ENUM and ALIAS symbols now surface during discovery instead of being silently dropped.

  • Replaces name-only MapSymbolTypeName(string?) with new ResolveSymbolDataType(IDataType?) that inspects DataTypeCategory and walks the IAliasType.BaseType chain.
  • ENUM symbols surface as their underlying integer — IEnumType : IAliasType, same code path.
  • ALIAS chains recurse to the atomic primitive. Recursion bounded at 16 levels as cycle insurance.
  • POINTER / REFERENCE / INTERFACE / UNION / STRUCT / ARRAY / FB still return null and continue to be skipped (out of scope per issue body).
  • Discovery call site updated to pass symbol.DataType directly.

Test plan

  • dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.TwinCAT — clean (0 / 0)
  • dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.TwinCAT.Tests151 / 151 passed (8 new in TwinCATTypeResolutionTests: single alias, chained alias, alias to unrecognised primitive, primitive direct, null, self-referential cycle, INT-based enum, DINT-based enum)
  • Integration tests — hardware-gated (TWINCAT_TARGET_NETID)

🤖 Auto-generated by the Mode-B execution loop. Closes #309.

Closes #309

## Summary ENUM and ALIAS symbols now surface during discovery instead of being silently dropped. - Replaces name-only `MapSymbolTypeName(string?)` with new `ResolveSymbolDataType(IDataType?)` that inspects `DataTypeCategory` and walks the `IAliasType.BaseType` chain. - **ENUM** symbols surface as their underlying integer — `IEnumType : IAliasType`, same code path. - **ALIAS** chains recurse to the atomic primitive. Recursion bounded at **16 levels** as cycle insurance. - **POINTER / REFERENCE / INTERFACE / UNION / STRUCT / ARRAY / FB** still return null and continue to be skipped (out of scope per issue body). - Discovery call site updated to pass `symbol.DataType` directly. ## Test plan - [x] `dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.TwinCAT` — clean (0 / 0) - [x] `dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.TwinCAT.Tests` — **151 / 151 passed** (8 new in `TwinCATTypeResolutionTests`: single alias, chained alias, alias to unrecognised primitive, primitive direct, null, self-referential cycle, INT-based enum, DINT-based enum) - [ ] Integration tests — hardware-gated (TWINCAT_TARGET_NETID) 🤖 Auto-generated by the Mode-B execution loop. Closes #309. Closes #309
dohertj2 added 1 commit 2026-04-25 17:51:05 -04:00
Resolve TwinCAT symbol data types via the IDataType chain instead of a
flat name match. ALIAS chains walk BaseType recursively (depth-capped at
16 against pathological cycles); ENUM surfaces its underlying integer
base type. POINTER / REFERENCE / INTERFACE / UNION / STRUCT / ARRAY / FB
remain explicitly out of scope and surface as null.

Closes #309
dohertj2 merged commit 2266dd9ad5 into auto/driver-gaps 2026-04-25 17:51:10 -04:00
dohertj2 deleted branch auto/twincat/1.5 2026-04-25 17:51:10 -04:00
Sign in to join this conversation.