Files
Nonemm/src/Nonemm.Digital/DigitalEngineSender.cs
ericek111 c8de74e24a 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
2026-08-31 21:35:45 +00:00

47 lines
1.4 KiB
C#

using Nonemm.Keying;
namespace Nonemm.Digital;
/// The digital engine as something that sends a message, so a macro goes out
/// through the same expander, the same `{END}` handling and the same ESM as a
/// CW message does.
public sealed class DigitalEngineSender : MessageSender
{
private readonly DigitalEngine engine;
public DigitalEngineSender(DigitalEngine engine)
{
this.engine = engine;
engine.TransmitChanged += WhenTransmitChanged;
}
public bool IsReady => engine.IsConnected;
/// The engine says when it has stopped transmitting, which is the same
/// thing a keyer reports.
public bool ReportsCompletion => true;
public event EventHandler? Finished;
public Task SendAsync(string text, CancellationToken cancellation = default) =>
engine.SendAsync(text, cancellation);
public Task AbortAsync(CancellationToken cancellation = default) =>
engine.AbortAsync(cancellation);
/// RTTY runs at the speed the engine is set to, so there is nothing to set
/// per message.
public Task SetSpeedAsync(int wordsPerMinute, CancellationToken cancellation = default) =>
Task.CompletedTask;
public void Dispose() => engine.TransmitChanged -= WhenTransmitChanged;
private void WhenTransmitChanged(object? sender, bool transmitting)
{
if (!transmitting)
{
Finished?.Invoke(this, EventArgs.Empty);
}
}
}