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
4.2 KiB
C#
125 lines
4.2 KiB
C#
using Nonemm.Contests;
|
|
using Nonemm.Session;
|
|
|
|
namespace Nonemm.Session.Tests;
|
|
|
|
/// Where a word clicked in the receive pane goes.
|
|
public class DigitalElementTests
|
|
{
|
|
private static readonly ExchangeField[] SweepstakesLike =
|
|
[
|
|
new ExchangeField("Nr", ExchangeSlot.SerialNumber, ExchangeFieldKind.Number),
|
|
new ExchangeField("Prec", ExchangeSlot.Precedence, ExchangeFieldKind.Precedence),
|
|
new ExchangeField("Ck", ExchangeSlot.Check, ExchangeFieldKind.Check),
|
|
new ExchangeField("Sect", ExchangeSlot.Section, ExchangeFieldKind.ArrlSection),
|
|
];
|
|
|
|
private static readonly ExchangeField[] NameAndState =
|
|
[
|
|
new ExchangeField("RST", ExchangeSlot.ReceivedReport, ExchangeFieldKind.Report),
|
|
new ExchangeField("Name", ExchangeSlot.Name, ExchangeFieldKind.Text),
|
|
new ExchangeField("S/P", ExchangeSlot.Exchange1, ExchangeFieldKind.UsStateOrCanadianProvince),
|
|
];
|
|
|
|
[Fact]
|
|
public void EachKindOfValueFindsItsOwnBox()
|
|
{
|
|
EntryFields fields = new(SweepstakesLike);
|
|
|
|
Assert.Equal(1, DigitalElement.FieldFor(fields, "123"));
|
|
Assert.Equal(2, DigitalElement.FieldFor(fields, "A"));
|
|
Assert.Equal(3, DigitalElement.FieldFor(fields, "72"));
|
|
Assert.Equal(4, DigitalElement.FieldFor(fields, "STX"));
|
|
}
|
|
|
|
/// A state is not put in the name box just because that box comes first.
|
|
[Fact]
|
|
public void ABoxWithAListBehindItComesBeforeAPlainTextBox()
|
|
{
|
|
EntryFields fields = new(NameAndState);
|
|
|
|
Assert.Equal(3, DigitalElement.FieldFor(fields, "OH"));
|
|
Assert.Equal(2, DigitalElement.FieldFor(fields, "PETER"));
|
|
}
|
|
|
|
[Fact]
|
|
public void TheReportBoxIsNeverClickedInto()
|
|
{
|
|
EntryFields fields = new(NameAndState);
|
|
|
|
Assert.False(DigitalElement.Fits(NameAndState[0], "599"));
|
|
Assert.NotEqual(1, DigitalElement.FieldFor(fields, "599"));
|
|
}
|
|
|
|
[Fact]
|
|
public void AnEmptyBoxIsFilledBeforeOneThatAlreadyHasAValue()
|
|
{
|
|
EntryFields fields = new(NameAndState);
|
|
fields[2] = "JOE";
|
|
|
|
Assert.Equal(2, DigitalElement.FieldFor(fields, "MIKE"));
|
|
}
|
|
|
|
/// Every box that takes the word is full, so the first one is written over
|
|
/// rather than the click doing nothing.
|
|
[Fact]
|
|
public void AFullBoxIsWrittenOverWhenNoOtherBoxTakesIt()
|
|
{
|
|
EntryFields fields = new(SweepstakesLike);
|
|
fields[4] = "EMA";
|
|
|
|
Assert.Equal(4, DigitalElement.FieldFor(fields, "STX"));
|
|
}
|
|
|
|
/// N1MM puts a clicked word in the box the cursor is in, and so does this
|
|
/// where that box takes the word: a two-figure serial number typed into the
|
|
/// serial box is not moved to the check box behind the operator's back.
|
|
[Fact]
|
|
public void TheBoxWithTheCursorComesFirst()
|
|
{
|
|
EntryFields fields = new(SweepstakesLike);
|
|
fields.FocusOn(1);
|
|
|
|
Assert.Equal(1, DigitalElement.FieldFor(fields, "72"));
|
|
}
|
|
|
|
[Fact]
|
|
public void NothingTakesAWordTheContestDoesNotExchange()
|
|
{
|
|
EntryFields fields = new(SweepstakesLike);
|
|
|
|
Assert.Null(DigitalElement.FieldFor(fields, "TU"));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("599123", "123")]
|
|
[InlineData("599", "599")]
|
|
[InlineData("OH:", "OH")]
|
|
[InlineData("1234Z", "1234")]
|
|
[InlineData(" om5m ", "OM5M")]
|
|
public void WhatRttyCarriesAroundAValueIsCutOff(string clicked, string expected) =>
|
|
Assert.Equal(expected, DigitalElement.Trim(clicked));
|
|
|
|
[Fact]
|
|
public void APowerIsTakenWithOrWithoutItsUnit()
|
|
{
|
|
ExchangeField power = new("Pwr", ExchangeSlot.Section, ExchangeFieldKind.Power);
|
|
|
|
Assert.True(DigitalElement.Fits(power, "100"));
|
|
Assert.True(DigitalElement.Fits(power, "5W"));
|
|
Assert.True(DigitalElement.Fits(power, "1KW"));
|
|
Assert.False(DigitalElement.Fits(power, "KILOWATT"));
|
|
}
|
|
|
|
[Fact]
|
|
public void AGridIsFourOrSixCharacters()
|
|
{
|
|
ExchangeField grid = new("Grid", ExchangeSlot.GridSquare, ExchangeFieldKind.Grid);
|
|
|
|
Assert.True(DigitalElement.Fits(grid, "JN88"));
|
|
Assert.True(DigitalElement.Fits(grid, "JN88DS"));
|
|
Assert.False(DigitalElement.Fits(grid, "JN8"));
|
|
Assert.False(DigitalElement.Fits(grid, "8888"));
|
|
}
|
|
}
|