Add the digital interface, running MMTTY under Wine

MMTTY and 2Tone have no socket or pipe interface: N1MM hosts XMMT.ocx and
exchanges window messages with the engine. A Linux process cannot load that
control, so bridge/nonemm-mmtty-bridge.exe hosts it under Wine and passes
lines over its standard input and output. docs/digital-bridge.md states the
protocol and what the control needs.

The window is N1MM's: receive pane with coloured callsigns, grab list, call
stacking, twenty-four macro buttons and the engine controls. One left click
copies what is under it — a callsign to the callsign box, anything else to the
exchange box the contest keeps for that kind of value.

Config > Digital registers XMMT.ocx in the Wine prefix on its own, making the
prefix first if it is not there. The engine, the bridge and the control start
at the copies shipped beside the program.

The bridge reads the control's own events. OnTranslateMessage carries only the
messages the control has no event for, so nothing was ever decoded through it.

hamlib's data mode names read as digital modes now, and a mode typed into the
callsign box changes mode the way a frequency changes band, so a station with
no radio can reach RTTY at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RoGtneMQaz4M9w7Kk49AVD
This commit is contained in:
2026-08-31 21:35:45 +00:00
co-authored by Claude Opus 5
parent 76b57cee1d
commit c8de74e24a
70 changed files with 4560 additions and 27 deletions
+59 -4
View File
@@ -355,7 +355,7 @@ public sealed partial class EntryWindow : Window
// N1MM's Escape holds alternating CQ where it is rather than
// switching it off; the next CQ carries it on
session.Alternating?.Hold();
_ = session.Keyer?.AbortAsync();
_ = Sender?.AbortAsync();
Logging.Wipe();
ResetEsm();
SyncBoxes();
@@ -480,6 +480,18 @@ public sealed partial class EntryWindow : Window
boxes[0].Focus();
return;
}
if (Logging.PendingMode() is { } mode)
{
Logging.Tune(Logging.Frequency, mode);
// a radio that is connected is moved as well, or its next answer
// would put the mode back
_ = session.Radio?.SetModeAsync(mode);
Logging.Entry.Call = "";
SyncBoxes();
boxes[0].Focus();
Status($"mode {mode.Name}");
return;
}
if (IsEsmOn)
{
_ = RunEsmAsync();
@@ -531,6 +543,49 @@ public sealed partial class EntryWindow : Window
/// What space does: the callsign box and the exchange boxes, stepping over
/// the reports and over a box this station is not asked for, and round to
/// the callsign again. This is N1MM's NextTab.
/// The digital window hands a callsign over: the boxes are wiped and the
/// call typed in, which is what double-clicking one in N1MM's receive pane
/// does. With `space` the focus moves on to the exchange as though the
/// operator had pressed space, so the reports and the call history fill in.
internal void GrabCall(string call, bool space)
{
if (Logging is null || call.Trim().Length == 0)
{
return;
}
Logging.Wipe();
ResetEsm();
Logging.Entry.Call = call.Trim().ToUpperInvariant();
SyncBoxes();
if (space)
{
MoveFocus(forward: true);
}
boxes[Logging.Entry.Focus].Focus();
Refresh();
}
/// The digital window's click on something that is not a callsign: it goes
/// in the exchange box the contest keeps for that kind of value, and the
/// cursor follows it. False when the contest has no box that takes it.
internal bool GrabExchange(string text)
{
if (Logging is null || DigitalElement.FieldFor(Logging.Entry, text) is not { } field)
{
return false;
}
Logging.Entry[field] = text;
Logging.Entry.FocusOn(field);
SyncBoxes();
boxes[field].Focus();
Refresh();
return true;
}
/// The digital window's right click, which N1MM makes the same as pressing
/// Enter here.
internal void PressEnter() => OnEnter();
private void MoveFocus(bool forward)
{
if (Logging is null || boxes.Count == 0)
@@ -621,7 +676,7 @@ public sealed partial class EntryWindow : Window
{
sending = false;
session.Alternating?.Hold();
_ = session.Keyer?.AbortAsync();
_ = Sender?.AbortAsync();
Status("stopped sending");
}
@@ -708,7 +763,7 @@ public sealed partial class EntryWindow : Window
updating = false;
}
private void Refresh()
internal void Refresh()
{
ShowFunctionKeys();
ShowBandButtons();
@@ -1042,7 +1097,7 @@ public sealed partial class EntryWindow : Window
Status("nothing left to report to " + station.Text);
return;
}
QtcWindow window = new(session, Logging, station, direction, SendTextAsync);
QtcWindow window = new(session, Logging, station, direction, text => SendTextAsync(text));
bool saved = await window.ShowDialog<bool>(this);
Logging.Wipe();
SyncBoxes();