Auto: s7-c2 — TSAP / Connection Type selector

Closes #295
This commit is contained in:
Joseph Doherty
2026-04-26 00:49:10 -04:00
parent bcf83bf39b
commit 3b98e4d366
7 changed files with 513 additions and 1 deletions

View File

@@ -33,6 +33,23 @@ public abstract class S7CommandBase : DriverCommandBase
[CommandOption("timeout-ms", Description = "Per-operation timeout in ms (default 5000).")]
public int TimeoutMs { get; init; } = 5000;
[CommandOption("tsap-mode", Description =
"ISO-on-TCP / S7comm connection class: Auto (default — S7netplus picks the TSAP " +
"from --cpu), Pg, Op, S7Basic, or Other (requires --local-tsap and --remote-tsap). " +
"Hardened S7-1500 / ET 200SP CPUs may refuse PG and require Op or S7Basic. See " +
"docs/v2/s7.md \"TSAP / Connection Type\" for the byte table and motivation.")]
public TsapMode TsapMode { get; init; } = TsapMode.Auto;
[CommandOption("local-tsap", Description =
"Optional 16-bit local TSAP override (e.g. 0x4D57). Required when --tsap-mode is Other; " +
"wins over the class default under Pg/Op/S7Basic.")]
public ushort? LocalTsap { get; init; }
[CommandOption("remote-tsap", Description =
"Optional 16-bit remote TSAP override. Required when --tsap-mode is Other; wins over " +
"the class default under Pg/Op/S7Basic.")]
public ushort? RemoteTsap { get; init; }
/// <inheritdoc />
public override TimeSpan Timeout
{
@@ -55,6 +72,9 @@ public abstract class S7CommandBase : DriverCommandBase
Timeout = Timeout,
Tags = tags,
Probe = new S7ProbeOptions { Enabled = false },
TsapMode = TsapMode,
LocalTsap = LocalTsap,
RemoteTsap = RemoteTsap,
};
protected string DriverInstanceId => $"s7-cli-{Host}:{Port}";