Auto: ablegacy-4 — indirect/indexed addressing parser

Closes #247
This commit is contained in:
Joseph Doherty
2026-04-25 13:51:03 -04:00
parent b95eaacc05
commit 4ff4cc5899
3 changed files with 246 additions and 14 deletions

View File

@@ -438,6 +438,15 @@ public sealed class AbLegacyDriver : IDriver, IReadable, IWritable, ITagDiscover
?? throw new InvalidOperationException(
$"AbLegacy tag '{def.Name}' has malformed Address '{def.Address}'.");
// TODO(#247): libplctag's PCCC text decoder does not natively accept the bracket-form
// indirect address. Resolving N7:[N7:0] requires reading the inner address first, then
// rewriting the tag name with the resolved word number, then issuing the actual read.
// For now we surface a clear runtime error rather than letting libplctag fail with an
// opaque parser error.
if (parsed.IsIndirect)
throw new NotSupportedException(
$"AbLegacy tag '{def.Name}' uses indirect addressing ('{def.Address}'); runtime resolution is not yet implemented.");
var runtime = _tagFactory.Create(new AbLegacyTagCreateParams(
Gateway: device.ParsedAddress.Gateway,
Port: device.ParsedAddress.Port,