fix(aprs): do not tell a mistyped passcode it is in receive-only mode
The previous commit derived "wants receive-only" from AprsPasscode.canTransmit, which is a boolean over four cases. Both a deliberate -1 and a mistyped passcode return false, so fixing the mis-diagnosis in one direction introduced it in the other: measured against the shipped algorithm, three entries - a passcode off by one digit, an arbitrary number, and a non-numeric entry - were all told they were connected in receive-only mode, when what they needed to hear was that the passcode does not match the callsign. classify already distinguishes these; only its ReceiveOnly case counts as a deliberate choice. A test now pins the distinction, including the fact that all four entries are equally unable to transmit - which is exactly why the boolean was not enough. Found by probe before review, not by the suite, which had no test for the reporter's use of this and still does not.
This commit is contained in:
1 parent
eb66a77cae
commit
0208a577c4
2 files changed
+32
-4
No files matched your search
@@ -127,10 +127,13 @@ class AprsReporter(
|
||||
}
|
||||
val packetLine = (beacon as AprsBeacon.Result.Line).text
|
||||
|
||||
// Receive-only is a deliberate choice, not a mistake, and has to be carried through:
|
||||
// it logs in with -1 exactly as a wrong passcode does, and the server answers
|
||||
// "unverified" to both.
|
||||
val wantsReceiveOnly = !AprsPasscode.canTransmit(cfg.callsign, cfg.passcode)
|
||||
// Receive-only is a deliberate choice and has to be told apart from a typo, because
|
||||
// both log in with -1 and the server answers "unverified" to each. Classifying rather
|
||||
// than asking canTransmit: that collapses ReceiveOnly and Mismatch into one boolean,
|
||||
// so a mistyped passcode would be told it is in receive-only mode - the same
|
||||
// mis-diagnosis as before, pointing the other way.
|
||||
val wantsReceiveOnly =
|
||||
AprsPasscode.classify(cfg.callsign, cfg.passcode) is AprsPasscode.Entry.ReceiveOnly
|
||||
val c = client ?: AprsIsClient(
|
||||
host = cfg.server,
|
||||
port = cfg.port,
|
||||
|
||||
Reference in new issue
Block a user