ESM is how most people run N1MM, and it was not here at all — not in the code,
not even in the list of what is missing. Config ▸ ESM turns it on and it stays
on between runs.
The decision is a table in N1MM's function-key documentation, and it is written
here as one: the state of the callsign and exchange boxes, whether the station
is running or searching, and whether the call and the exchange have gone out
already, give the function keys Enter sends and whether the contact is logged
after them. Esm.Decide is that table and nothing else, so it is tested against
every row rather than by clicking.
Searching: type a call, Enter sends your call, space moves to the exchange, and
once the exchange is filled in Enter sends yours and logs. Running: Enter calls
CQ, a call in the box makes Enter send his call and the exchange, and the next
Enter ends the contact and logs it. A dupe gets QSO B4 while running and nothing
while searching, unless dupes are worked, which is what N1MM recommends and what
this does out of the box. F1 puts a searching station into run mode.
The entry window highlights the keys Enter would send next, so what is about to
happen is on the screen rather than in the operator's head. `=` sends whatever
Enter last sent. Escape and F12 put ESM back to the start of a contact.
Send Corrected Call is in as well: copy SM3AB, send it, fix it to SM3ABC, and
the message that ends the contact goes out as "SM3ABC TU DL1ABC". That is why
N1MM's documentation says to put ! in F5 rather than {CALL}, so the default F5
message is now ! . F6 is QSO B4, which is the message ESM sends a dupe; it used
to repeat the exchange, which no part of the table asks for.
{EXCHSENT} means something again, now that there is an ESM state for it to set.
Worked end to end against a fake cwdaemon: a search-and-pounce contact logged in
four keystrokes, a run contact in three, both with the right text on the keyer
in the right order, and the corrected call in front of the last message.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
96 lines
2.8 KiB
C#
96 lines
2.8 KiB
C#
namespace Nonemm.Session.Tests;
|
|
|
|
/// The cases are the rows of N1MM's ESM table, both columns.
|
|
public class EsmTests
|
|
{
|
|
private static EsmSituation Running(EsmSituation now) => now with { IsRunning = true };
|
|
|
|
[Fact]
|
|
public void AnEmptyWindowCallsCqOrSendsMyCall()
|
|
{
|
|
Assert.Equal([0], Esm.Decide(Running(new EsmSituation())).Keys);
|
|
Assert.Equal([3], Esm.Decide(new EsmSituation()).Keys);
|
|
}
|
|
|
|
[Fact]
|
|
public void ANewCallGetsHisCallAndTheExchangeWhileRunning()
|
|
{
|
|
EsmAction action = Esm.Decide(Running(new EsmSituation { HasCall = true }));
|
|
|
|
Assert.Equal([4, 1], action.Keys);
|
|
Assert.False(action.Logs);
|
|
}
|
|
|
|
[Fact]
|
|
public void CallingAgainWhileRunningAsksForARepeat()
|
|
{
|
|
EsmSituation now = Running(new EsmSituation { HasCall = true, CallSent = true });
|
|
|
|
Assert.Equal([7], Esm.Decide(now).Keys);
|
|
}
|
|
|
|
[Fact]
|
|
public void SearchingSendsMyCallAgainUnlessTheBigGunSwitchIsOn()
|
|
{
|
|
EsmSituation now = new() { HasCall = true, CallSent = true };
|
|
|
|
Assert.Equal([3], Esm.Decide(now).Keys);
|
|
Assert.Equal([7], Esm.Decide(now with { SendsCallOnce = true }).Keys);
|
|
}
|
|
|
|
[Fact]
|
|
public void AnExchangeInTheBoxesEndsTheContact()
|
|
{
|
|
EsmSituation now = new() { HasCall = true, HasExchange = true, ExchangeSent = false };
|
|
|
|
EsmAction running = Esm.Decide(Running(now));
|
|
Assert.Equal([4, 1], running.Keys);
|
|
Assert.False(running.Logs);
|
|
|
|
EsmAction searching = Esm.Decide(now);
|
|
Assert.Equal([1], searching.Keys);
|
|
Assert.True(searching.Logs);
|
|
}
|
|
|
|
[Fact]
|
|
public void OnceTheExchangeHasGoneOutEnterLogsTheContact()
|
|
{
|
|
EsmSituation now = new() { HasCall = true, HasExchange = true, ExchangeSent = true };
|
|
|
|
EsmAction running = Esm.Decide(Running(now));
|
|
Assert.Equal([2], running.Keys);
|
|
Assert.True(running.Logs);
|
|
|
|
EsmAction searching = Esm.Decide(now);
|
|
Assert.Empty(searching.Keys);
|
|
Assert.True(searching.Logs);
|
|
}
|
|
|
|
[Fact]
|
|
public void ADupeIsToldItIsInTheLogUnlessDupesAreWorked()
|
|
{
|
|
EsmSituation now = Running(new EsmSituation { HasCall = true, IsDupe = true });
|
|
|
|
Assert.Equal([5], Esm.Decide(now).Keys);
|
|
Assert.Equal([4, 1], Esm.Decide(now with { WorksDupes = true }).Keys);
|
|
}
|
|
|
|
[Fact]
|
|
public void ADupeWhileSearchingIsLeftAlone()
|
|
{
|
|
EsmAction action = Esm.Decide(new EsmSituation { HasCall = true, IsDupe = true });
|
|
|
|
Assert.True(action.IsNothing);
|
|
}
|
|
|
|
[Fact]
|
|
public void ADupeWithAnExchangeIsWorkedLikeAnyOtherStation()
|
|
{
|
|
EsmSituation now = new() { HasCall = true, IsDupe = true, HasExchange = true };
|
|
|
|
Assert.Equal([4, 1], Esm.Decide(Running(now)).Keys);
|
|
Assert.Equal([1], Esm.Decide(now).Keys);
|
|
Assert.True(Esm.Decide(now).Logs);
|
|
}
|
|
}
|