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
77 lines
1.9 KiB
C#
77 lines
1.9 KiB
C#
using Nonemm.Session;
|
|
|
|
namespace Nonemm.Session.Tests;
|
|
|
|
/// The decoded text as the modem sends it, one character at a time.
|
|
public class DigitalReceiverTests
|
|
{
|
|
private static List<string> CallsIn(string text)
|
|
{
|
|
DigitalReceiver receiver = new();
|
|
List<string> heard = [];
|
|
receiver.CallHeard += (_, call) => heard.Add(call);
|
|
foreach (char c in text)
|
|
{
|
|
receiver.Receive(c.ToString());
|
|
}
|
|
return heard;
|
|
}
|
|
|
|
[Fact]
|
|
public void ACallsignIsReportedWhenTheWordEnds()
|
|
{
|
|
Assert.Equal(["OM5M"], CallsIn("CQ DE OM5M "));
|
|
}
|
|
|
|
[Fact]
|
|
public void AWordThatIsStillBeingSentIsNotReportedYet()
|
|
{
|
|
Assert.Empty(CallsIn("CQ DE OM5"));
|
|
}
|
|
|
|
[Fact]
|
|
public void ALineBreakEndsAWordTheSameWayASpaceDoes()
|
|
{
|
|
Assert.Equal(["OM5M"], CallsIn("DE OM5M\r\n"));
|
|
}
|
|
|
|
[Fact]
|
|
public void NoiseThatIsNotShapedLikeACallIsPassedOver()
|
|
{
|
|
Assert.Empty(CallsIn("RYRY ????? +.+. \r\n"));
|
|
}
|
|
|
|
[Fact]
|
|
public void TheTextIsKeptAsItArrived()
|
|
{
|
|
DigitalReceiver receiver = new();
|
|
|
|
receiver.Receive("CQ TEST ");
|
|
receiver.Receive("OM5M");
|
|
|
|
Assert.Equal("CQ TEST OM5M", receiver.Text);
|
|
}
|
|
|
|
/// A callsign has at most three characters after its number, so that is
|
|
/// where a word that ran into the next one is cut.
|
|
[Fact]
|
|
public void AWordRunTogetherWithTheNextIsCutBackToTheCall()
|
|
{
|
|
Assert.Equal("OM5MTE", DigitalReceiver.TrimToCall("OM5MTESTTEST"));
|
|
Assert.Equal("OM5M", DigitalReceiver.TrimToCall("OM5M"));
|
|
}
|
|
|
|
[Fact]
|
|
public void APortableCallIsLeftAlone()
|
|
{
|
|
Assert.Equal("OM5M/P", DigitalReceiver.TrimToCall("OM5M/P"));
|
|
}
|
|
|
|
[Fact]
|
|
public void TheWordUnderThePointerIsTheOneAroundIt()
|
|
{
|
|
Assert.Equal("OM5M", DigitalReceiver.WordAt("CQ DE OM5M K", 7));
|
|
Assert.Equal("", DigitalReceiver.WordAt("CQ DE OM5M K", 5));
|
|
}
|
|
}
|