TwinCAT symbol browser via SymbolLoaderFactory #127

Merged
dohertj2 merged 1 commits from twincat-symbol-browser into v2 2026-04-19 20:15:27 -04:00
Owner

Closes task #188. BrowseSymbolsAsync on ITwinCATClient, real impl via SymbolLoaderFactory.Create + Flat mode. TwinCATDriverOptions.EnableControllerBrowse (default false) gates the walk; Discovered/ folder under device folder carries controller-resident globals/locals. Type-name mapping + system-symbol filter (TwinCAT_, Constants., Mc_, __). Browse failure non-fatal. 8 new tests, 110/110 passing. Merges to v2.

Closes task #188. BrowseSymbolsAsync on ITwinCATClient, real impl via SymbolLoaderFactory.Create + Flat mode. TwinCATDriverOptions.EnableControllerBrowse (default false) gates the walk; Discovered/ folder under device folder carries controller-resident globals/locals. Type-name mapping + system-symbol filter (TwinCAT_*, Constants.*, Mc_*, __*). Browse failure non-fatal. 8 new tests, 110/110 passing. Merges to v2.
dohertj2 added 1 commit 2026-04-19 20:15:23 -04:00
TwinCAT follow-up — Symbol browser via AdsClient + SymbolLoaderFactory. Closes task #188. Adds ITwinCATClient.BrowseSymbolsAsync — IAsyncEnumerable yielding TwinCATDiscoveredSymbol (InstancePath + mapped TwinCATDataType + ReadOnly flag) from the target's flat symbol table. AdsTwinCATClient implementation uses SymbolLoaderFactory.Create(_client, new SymbolLoaderSettings(SymbolsLoadMode.Flat)) + iterates loader.Symbols, maps IEC 61131-3 type names (BOOL/SINT/INT/DINT/LINT/REAL/LREAL/STRING/WSTRING/TIME/DATE/DT/TOD + BYTE/WORD/DWORD/LWORD unsigned-word aliases) through MapSymbolTypeName, checks SymbolAccessRights.Write bit for writable vs read-only. Unsupported types (UDTs / function blocks / arrays / pointers) surface with DataType=null so callers can skip or recurse. TwinCATDriverOptions.EnableControllerBrowse — new bool, default false to preserve the strict-config path. When true, DiscoverAsync iterates each device's BrowseSymbolsAsync, filters via TwinCATSystemSymbolFilter (rejects TwinCAT_*, Constants.*, Mc_*, __*, Global_Version* prefixes + anything empty), skips null-DataType symbols, emits surviving symbols under a per-device Discovered/ sub-folder with InstancePath as both FullName + BrowseName + ReadOnly→ViewOnly/writable→Operate. Pre-declared tags from TwinCATDriverOptions.Tags always emit regardless. Browse failure is non-fatal — exception caught + swallowed, pre-declared tags stay in the address space, operators see the failure in driver health on next read. TwinCATSystemSymbolFilter static class mirrors AbCipSystemTagFilter's shape with TwinCAT-specific prefixes. Fake client updated — BrowseResults list for test setup + FireNotification-style single-invocation on each subscribe, ThrowOnBrowse flag for failure testing. 8 new unit tests — strict path emits only pre-declared when EnableControllerBrowse=false, browse enabled adds Discovered/ folder, filter rejects system prefixes, null-DataType symbols skipped, ReadOnly symbols surface ViewOnly, browse failure leaves pre-declared intact, SystemSymbolFilter theory (10 cases). Total TwinCAT unit tests now 110/110 passing (+17 from the native-notification merge's 93); full solution builds 0 errors; other drivers untouched. c95228391d
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dohertj2 merged commit d1ca0817e9 into v2 2026-04-19 20:15:27 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dohertj2/lmxopcua#127