Take serial numbers from a pool the whole entry shares

Each station worked out its next number as the highest in its log plus one,
so two operators typing at the same moment both sent the same number and
one of the two contacts was wrong in the sponsor's log.

SerialNumberPool holds the highest number taken per band, which is N1MM's
QSONumbers array. A number is taken at the first character of the callsign,
as N1MM takes it, and ReserveNr tells the other stations before the contact
is worked. A number at or below one this station has used is answered with
the whole pool, N1MM's QSONRS, and the station that is behind counts on from
there. The pool also goes out when a contest is opened and when the numbers
are started again.

Contest.NumbersByBand says whether the numbers run per band or as one
sequence for the station. CQ WPX runs one per band for a multi-two and a
multi-multi; every other contest here runs one sequence. The band index in
the message is N1MM's, so the array lines up with theirs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015NZkFxHde1iifAQemFTHxf
This commit is contained in:
2026-09-10 11:56:49 +00:00
co-authored by Claude Opus 5
parent 33c7631e17
commit 7ba0b44fc1
21 changed files with 677 additions and 40 deletions
+38 -1
View File
@@ -21,6 +21,8 @@ public sealed class OperatingPosition
// contact is logged, so the other radio is not left showing the number
// that has just gone
Session.Logged += (_, _) => FillSentExchange();
Session.NumbersRestarted += (_, _) => LetTheNumberGo();
Entry.CallStarted += (_, _) => ReserveNumber();
}
public ContestSession Session { get; }
@@ -33,6 +35,10 @@ public sealed class OperatingPosition
/// With no radio connected this stays where it was last typed.
public Frequency Frequency { get; private set; } = Bands.Band20M.Low;
/// The band this position is on. A contest that numbers per band takes the
/// serial number against it.
public Band? Band => Bands.ForFrequency(Frequency);
/// Where the radio transmits when working split, and zero when it is not.
public Frequency TransmitFrequency { get; private set; } = Frequency.Zero;
@@ -64,7 +70,35 @@ public sealed class OperatingPosition
public QsoEditor Editor => Session.Editor;
public int SentNumber => Session.SentNumber;
/// The serial number this position sends. It is taken from the pool at the
/// first character of the callsign and held until the contact is logged;
/// before that it is what the next contact on this band would carry.
public int SentNumber => reserved ?? Session.NextNumberOn(Band);
private int? reserved;
/// Takes this position's number, unless it has one already. N1MM takes it
/// at the first character of the callsign rather than at logging, so the
/// number is on the network while the contact is still being worked and
/// the other operator's next number goes above it.
private void ReserveNumber()
{
if (reserved is not null || !Contest.HasSerialNumbers)
{
return;
}
reserved = Session.ReserveNumberOn(Band);
FillSentExchange();
Session.NotifyChanged();
}
/// Gives up the number this position holds, so the next contact takes a
/// fresh one. A wipe keeps it, as N1MM does: the contact is still to come.
private void LetTheNumberGo()
{
reserved = null;
FillSentExchange();
}
public void Tune(Frequency frequency, Mode? mode = null, Frequency? transmitFrequency = null)
{
@@ -229,6 +263,9 @@ public sealed class OperatingPosition
}
StampSentTime();
Qso stored = Session.Add(Noted(BuildQso(Entry.Call.Trim())));
// the number went with the contact, so the next one starts again from
// the pool
reserved = null;
Entry.Clear();
FillSentExchange();
OtherName = "";