Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/src/commands.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ Uint8List cmdGetHello(int seq) =>
buildCommand(seq, Cmd.getHelloHarvard, const [0x00]);
Uint8List cmdGetHelloModern(int seq) =>
buildCommand(seq, Cmd.getHello, const [0x01]);
Uint8List cmdAbortHistorical(int seq) =>
buildCommand(seq, Cmd.abortHistoricalTransmits, const [0x00]);
Uint8List cmdAbortHistorical(int seq, {BandProfile profile = BandProfile.gen4}) =>
buildCommand(seq, Cmd.abortHistoricalTransmits, const [0x00], profile);
Uint8List cmdSendHistorical(int seq) =>
buildCommand(seq, Cmd.sendHistoricalData, const [0x00]);
/// Read the strap RTC (GET_CLOCK = 0x0B = 11) with an EMPTY body.
Expand Down
21 changes: 21 additions & 0 deletions test/gen5_command_surface_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,27 @@ void main() {
}
});

test('ABORT_HISTORICAL_TRANSMITS (20) is profile-aware', () {
// The first step of the Labrador prepare/start sequence; must frame
// as gen5 (8-byte header, CRC16-Modbus) when the rest of that sequence
// does, not silently fall back to gen4 framing.
final gen5Frame = cmdAbortHistorical(1, profile: gen5);
final f = parseFrame(gen5Frame, profile: gen5)!;
expect(f.valid, isTrue, reason: 'must parse as a gen5 frame');
expect(f.opcode, Cmd.abortHistoricalTransmits);
// A gen4 parse of a gen5 frame must NOT also validate (wrong header
// length / CRC scheme) — otherwise this test can't tell them apart.
final asGen4 = parseFrame(gen5Frame, profile: BandProfile.gen4);
expect(asGen4 == null || !asGen4.valid, isTrue,
reason: 'a gen5 frame must not also parse as valid gen4');

// Default (no profile arg) stays gen4 — backward compatible.
final gen4Frame = cmdAbortHistorical(1);
final f4 = parseFrame(gen4Frame, profile: BandProfile.gen4)!;
expect(f4.valid, isTrue);
expect(f4.opcode, Cmd.abortHistoricalTransmits);
});

// Filtered reading ("Labrador", R17) — the three lifecycle toggles.
// Every body is [revision 01][operation]; 124's operation is
// NOT a boolean.
Expand Down
Loading