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:
@@ -4,6 +4,7 @@ using Nonemm.Contests;
|
||||
using Nonemm.Core;
|
||||
using Nonemm.Core.Calls;
|
||||
using Nonemm.Core.Country;
|
||||
using Nonemm.Digital;
|
||||
using Nonemm.Keying;
|
||||
using Nonemm.Network;
|
||||
using Nonemm.Rig;
|
||||
@@ -26,6 +27,8 @@ public sealed class AppSession : IDisposable
|
||||
private StationNetwork? network;
|
||||
private MessageSender? keyer;
|
||||
private AlternatingCq? alternating;
|
||||
private MmttyEngine? digital;
|
||||
private DigitalEngineSender? digitalSender;
|
||||
private So2rBox? box;
|
||||
|
||||
/// Which cluster spots reach the bandmap. Rebuilt whenever the settings or
|
||||
@@ -123,6 +126,14 @@ public sealed class AppSession : IDisposable
|
||||
|
||||
public MessageSender? Keyer => keyer;
|
||||
|
||||
/// The digital modem, started by the digital window rather than at startup:
|
||||
/// it runs an engine under Wine, which is not something to do to an
|
||||
/// operator who is working CW.
|
||||
public MmttyEngine? Digital => digital;
|
||||
|
||||
/// The same engine as something a macro can be sent through.
|
||||
public MessageSender? DigitalKeyer => digitalSender;
|
||||
|
||||
/// Alternating CQ, or null while there is no keyer. It needs two radios to
|
||||
/// do anything, and a keyer that reports when a message has gone out.
|
||||
public AlternatingCq? Alternating => alternating;
|
||||
@@ -291,6 +302,46 @@ public sealed class AppSession : IDisposable
|
||||
Changed?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
/// Starts the digital engine under Wine and returns it. The engine that is
|
||||
/// already running is handed back rather than started again.
|
||||
public async Task<MmttyEngine> StartDigitalAsync()
|
||||
{
|
||||
if (digital is { IsConnected: true } running)
|
||||
{
|
||||
return running;
|
||||
}
|
||||
StopDigital();
|
||||
MmttyOptions options = new()
|
||||
{
|
||||
EnginePath = Settings.DigitalEnginePath,
|
||||
Number = ActiveRadioNumber,
|
||||
Window = Enum.TryParse(Settings.DigitalEngineWindow, ignoreCase: true, out EngineWindow window)
|
||||
? window
|
||||
: EngineWindow.Normal,
|
||||
OnTop = Settings.DigitalEngineOnTop,
|
||||
PttPort = Settings.DigitalPttPort.Trim().Length > 0 ? Settings.DigitalPttPort : null,
|
||||
};
|
||||
WineBridgeChannel channel = new(
|
||||
Settings.DigitalBridgePath,
|
||||
Settings.DigitalWinePrefix.Trim().Length > 0 ? Settings.DigitalWinePrefix : null,
|
||||
Settings.DigitalWineCommand.Trim().Length > 0 ? Settings.DigitalWineCommand : "wine");
|
||||
MmttyEngine started = new(channel, options);
|
||||
await started.StartAsync();
|
||||
digital = started;
|
||||
digitalSender = new DigitalEngineSender(started);
|
||||
Changed?.Invoke(this, EventArgs.Empty);
|
||||
return started;
|
||||
}
|
||||
|
||||
public void StopDigital()
|
||||
{
|
||||
digitalSender?.Dispose();
|
||||
digitalSender = null;
|
||||
digital?.Dispose();
|
||||
digital = null;
|
||||
Changed?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
/// Opens a connection per enabled radio. A second one makes the station
|
||||
/// SO2R: both are read, but only the one the operator is on drives the
|
||||
/// entry window.
|
||||
@@ -534,6 +585,7 @@ public sealed class AppSession : IDisposable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
StopDigital();
|
||||
spotFlush.Dispose();
|
||||
DisposeRadios();
|
||||
cluster?.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user