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
125 lines
3.7 KiB
C#
125 lines
3.7 KiB
C#
using Nonemm.Contests;
|
|
using Nonemm.Contests.Rules;
|
|
using Nonemm.Core;
|
|
using Nonemm.Storage;
|
|
|
|
namespace Nonemm.Session.Tests;
|
|
|
|
public class MessagePlanTests
|
|
{
|
|
private static OperatingPosition Session()
|
|
{
|
|
FakeLogStore store = new();
|
|
ContestInstance instance = store.AddContest(new ContestInstance
|
|
{
|
|
ContestNumber = 0,
|
|
ContestName = "CQWW",
|
|
SentExchange = "14",
|
|
});
|
|
return new OperatingPosition(new ContestSession(
|
|
store,
|
|
new CqWorldWide(ModeCategory.Cw),
|
|
instance,
|
|
new StationInfo { Callsign = "DL1ABC", CqZone = 14 },
|
|
null));
|
|
}
|
|
|
|
[Fact]
|
|
public void AMessageWithNoMacrosIsJustText()
|
|
{
|
|
MessagePlan plan = MessagePlan.Read("TEST DE DL1ABC", Session());
|
|
|
|
Assert.Equal("TEST DE DL1ABC", plan.Text);
|
|
Assert.Empty(plan.Before);
|
|
Assert.Empty(plan.After);
|
|
}
|
|
|
|
[Fact]
|
|
public void AnActionMacroRunsBeforeTheMessageAndDoesNotGoOnTheAir()
|
|
{
|
|
MessagePlan plan = MessagePlan.Read("{RUN}CQ TEST *", Session());
|
|
|
|
Assert.Equal("CQ TEST DL1ABC", plan.Text);
|
|
Assert.Equal([new MessageAction(MessageCommand.Run)], plan.Before);
|
|
}
|
|
|
|
[Fact]
|
|
public void WhatFollowsEndRunsAfterTheMessage()
|
|
{
|
|
MessagePlan plan = MessagePlan.Read("TU {LOG}{END}{WIPE}", Session());
|
|
|
|
Assert.Equal("TU ", plan.Text);
|
|
Assert.Equal([new MessageAction(MessageCommand.Log)], plan.Before);
|
|
Assert.Equal([new MessageAction(MessageCommand.Wipe)], plan.After);
|
|
}
|
|
|
|
[Fact]
|
|
public void TextAfterEndIsDropped()
|
|
{
|
|
MessagePlan plan = MessagePlan.Read("TU{END} 5NN {MYCALL}", Session());
|
|
|
|
Assert.Equal("TU", plan.Text);
|
|
}
|
|
|
|
[Fact]
|
|
public void AMacroWithACommandAfterItKeepsTheCommandAsTyped()
|
|
{
|
|
MessagePlan plan = MessagePlan.Read("{Telnet sh/dx 20}{OTRSP TX2}", Session());
|
|
|
|
Assert.Equal(
|
|
[
|
|
new MessageAction(MessageCommand.Telnet, "sh/dx 20"),
|
|
new MessageAction(MessageCommand.Otrsp, "TX2"),
|
|
],
|
|
plan.Before);
|
|
Assert.Equal("", plan.Text);
|
|
}
|
|
|
|
[Fact]
|
|
public void CtrlFSendsThatKeyOnTheOtherRadio()
|
|
{
|
|
MessagePlan plan = MessagePlan.Read("TU {CTRLF9}", Session());
|
|
|
|
Assert.Equal([new MessageAction(MessageCommand.SendOnOtherRadio, "9")], plan.Before);
|
|
}
|
|
|
|
[Fact]
|
|
public void TheCallStackingMacrosAreRead()
|
|
{
|
|
MessagePlan plan = MessagePlan.Read(
|
|
"{STACKANOTHER}{SOCALLSTACK}{LOGTHENPOP}{LOGTHENNEXT}{CLRSTACK}", Session());
|
|
|
|
Assert.Equal(
|
|
[
|
|
new MessageAction(MessageCommand.StackAnother),
|
|
new MessageAction(MessageCommand.SwapWithStack),
|
|
new MessageAction(MessageCommand.LogThenPop),
|
|
new MessageAction(MessageCommand.LogThenPop),
|
|
new MessageAction(MessageCommand.ClearStack),
|
|
],
|
|
plan.Before);
|
|
Assert.Equal("", plan.Text);
|
|
}
|
|
|
|
[Fact]
|
|
public void AMacroThisProgramDoesNotActOnIsPassedOver()
|
|
{
|
|
MessagePlan plan = MessagePlan.Read("CQ {STEREOOFF}TEST", Session());
|
|
|
|
Assert.Equal("CQ TEST", plan.Text);
|
|
Assert.Empty(plan.Before);
|
|
}
|
|
|
|
/// The digital window's transmit macros, and the carriage return that
|
|
/// starts a new line on the other station's screen.
|
|
[Fact]
|
|
public void TheDigitalMacrosAreReadAsActionsAndText()
|
|
{
|
|
MessagePlan plan = MessagePlan.Read("{TX}CQ DE {MYCALL}{ENTER}{RX}", Session());
|
|
|
|
Assert.Equal([MessageCommand.StartTransmit, MessageCommand.ReturnToReceive],
|
|
plan.Before.Select(a => a.Command));
|
|
Assert.Equal("CQ DE DL1ABC\r", plan.Text);
|
|
}
|
|
}
|