harden(modbus-rtu): factory throws on unknown transport + document RTU FC-shape assumption

Claude-Session: https://claude.ai/code/session_01GASWkNEi68FSCtvr6rLoEW
This commit is contained in:
Joseph Doherty
2026-07-24 15:33:49 -04:00
parent 4a8c9badce
commit fcc7ed698e
3 changed files with 16 additions and 4 deletions
@@ -105,8 +105,9 @@ public static class ModbusRtuFraming
}
else
{
// Write-echo response (FC 05/06/15/16) or any other length-less fixed shape:
// fixed 4 payload bytes + CRC(2).
// Fixed 4-byte echo: correct for the write FCs this driver emits (05/06/0F/10). A future
// variable-length response FC outside 01-04 (e.g. FC23) would be mis-sized here and
// surface as a desync — revisit the FC-shape table if the driver starts emitting one.
trailing = 4 + 2;
}