Read split from the radio, and read two of them

Split. RadioState carries a transmit frequency, zero meaning the radio
transmits where it listens, so split is not a second flag that can disagree
with it. The contact stores it in N1MM's QSX column, the entry window shows
14008.00 followed by the transmit frequency, and the bandmap draws a red bar
there. SetSplitAsync sets the frequency before turning split on, or a radio
last split somewhere else transmits there.

Every command now goes out with a + in front, asking rigctld for its extended
answer: named fields ended by an RPRT line. The raw answer is bare values with
no terminator, so the client had to know how many lines each command returns —
there was a `command == "m"` special case for the one that returns two. Add a
third such command and get the count wrong once, and every later answer is read
against the wrong command for the rest of the session. RigctldReply parses the
extended form and is tested on its own.

A radio that cannot do split answers RPRT -11. That is an answer, not a broken
connection, so the frequency and mode it did report still count.

Two radios. Settings hold a list rather than one host and port, with the single
radio an older settings file holds carried into it. Both radios are read and
both show on the bandmap, the active one green and the other orange, but only
the active one drives the entry window: the second radio moving must not drag
the operator off the station being worked. Ctrl+Tab swaps, and a contact
records which radio made it.

This is not a full two-radio operating position — no second entry window, no
alternating CQ, no audio switching. It is two radios read and logged correctly.

Tested against a stand-in for rigctld over a real socket, and looked at under
Xvfb with two fake radios, one of them split.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-27 16:40:42 +00:00
parent da9884ebf5
commit 43be3816c3
19 changed files with 706 additions and 98 deletions

View File

@@ -21,9 +21,15 @@ public sealed record Settings
public IReadOnlyList<string> ClusterCommands { get; init; } = [];
public string RigctldHost { get; init; } = "127.0.0.1";
/// One entry per radio, in radio-number order. A second radio makes the
/// station SO2R.
public IReadOnlyList<StoredRadio> Radios { get; init; } = [];
public int RigctldPort { get; init; } = 4532;
/// Written by versions that only knew one radio. Read once, to fill
/// `Radios` in, and never written again.
public string RigctldHost { get; init; } = "";
public int RigctldPort { get; init; }
public bool RadioEnabled { get; init; }
@@ -66,7 +72,8 @@ public sealed record Settings
}
try
{
return JsonSerializer.Deserialize<Settings>(File.ReadAllText(path), Json) ?? new Settings();
return Migrated(
JsonSerializer.Deserialize<Settings>(File.ReadAllText(path), Json) ?? new Settings());
}
catch (JsonException)
{
@@ -78,6 +85,33 @@ public sealed record Settings
public void Save(string path) =>
File.WriteAllText(path, JsonSerializer.Serialize(this, Json));
/// Carries the single radio an older settings file holds into the list.
private static Settings Migrated(Settings settings) =>
settings.Radios.Count > 0 || settings.RigctldHost.Length == 0
? settings
: settings with
{
Radios = [new StoredRadio
{
Host = settings.RigctldHost,
Port = settings.RigctldPort,
IsEnabled = settings.RadioEnabled,
}],
RigctldHost = "",
RigctldPort = 0,
RadioEnabled = false,
};
}
/// One radio's `rigctld`.
public sealed record StoredRadio
{
public string Host { get; init; } = "127.0.0.1";
public int Port { get; init; } = 4532;
public bool IsEnabled { get; init; }
}
/// The operator's station as it is stored, kept separate from `StationInfo` so