fix(ab-transport): PCCC review r1 - UA bit, bit limits, stricter ParseReply, non-const verified flags
This commit is contained in:
@@ -40,6 +40,7 @@ public sealed record PcccAddress(string FileLetter, int? FileNumber, int Element
|
||||
("C", "DN") => (0, 13),
|
||||
("C", "OV") => (0, 12),
|
||||
("C", "UN") => (0, 11),
|
||||
("C", "UA") => (0, 10),
|
||||
("R", "EN") => (0, 15),
|
||||
("R", "EU") => (0, 14),
|
||||
("R", "DN") => (0, 13),
|
||||
@@ -94,6 +95,12 @@ public sealed record PcccAddress(string FileLetter, int? FileNumber, int Element
|
||||
if (implicitFile is not null && file is not null) return null;
|
||||
if (implicitFile is null && file is null) return null;
|
||||
if (sub is not null && bit is not null) return null;
|
||||
if (bit is int bb)
|
||||
{
|
||||
// Same limits as AbLegacyAddress: 16-bit words N/B/I/O/S/A 0-15, L 0-31; no bits on F/T/C/R/ST.
|
||||
var max = letter switch { "L" => 31, "N" or "B" or "I" or "O" or "S" or "A" => 15, _ => -1 };
|
||||
if (bb > max) return null;
|
||||
}
|
||||
if (sub is null) return new PcccAddress(letter, file, element, null, bit);
|
||||
try { return WithSubElementName(letter, file, element, sub); }
|
||||
catch (AbTransportException) { return null; }
|
||||
|
||||
Reference in New Issue
Block a user