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
102 lines
2.9 KiB
C#
102 lines
2.9 KiB
C#
namespace Nonemm.Session;
|
|
|
|
/// The order stacked calls come off, which is what N1MM's digital window calls
|
|
/// its call stacking modes.
|
|
public enum StackOrder
|
|
{
|
|
/// Multipliers first, then the order they arrived in.
|
|
MultipliersFirst,
|
|
|
|
/// The order they arrived in.
|
|
FirstIn,
|
|
|
|
/// Newest first.
|
|
LastIn,
|
|
|
|
/// Nothing is stacked.
|
|
Disabled,
|
|
}
|
|
|
|
/// The calls waiting to be worked while running. A station calling CQ hears
|
|
/// more than one answer, and this holds the ones it has not got to yet, so the
|
|
/// operator takes them one at a time instead of asking each to call again.
|
|
/// N1MM's single-operator call stacking.
|
|
///
|
|
/// The order calls come off is `Order`: multipliers first is what N1MM uses on
|
|
/// CW and phone, and the digital window offers the other three.
|
|
public sealed class CallStack
|
|
{
|
|
/// N1MM stacks nothing shorter than this.
|
|
public const int ShortestCall = 2;
|
|
|
|
private readonly List<string> calls = [];
|
|
|
|
/// How calls come off. The digital window sets this from its call stacking
|
|
/// menu; everything else leaves it alone.
|
|
public StackOrder Order { get; set; } = StackOrder.MultipliersFirst;
|
|
|
|
/// The calls in the order they come off, so the front is next.
|
|
public IReadOnlyList<string> Calls => calls;
|
|
|
|
public int Count => calls.Count;
|
|
|
|
public bool IsEmpty => calls.Count == 0;
|
|
|
|
/// The call that comes off next, or empty when the stack is.
|
|
public string Top => calls.Count > 0 ? calls[0] : "";
|
|
|
|
/// Puts a call on the stack. A call already there is moved rather than
|
|
/// repeated, and where it goes is up to `Order`.
|
|
public void Add(string call, bool isMultiplier)
|
|
{
|
|
string wanted = call.Trim().ToUpperInvariant();
|
|
if (wanted.Length < ShortestCall || Order == StackOrder.Disabled)
|
|
{
|
|
return;
|
|
}
|
|
Remove(wanted);
|
|
bool toFront = Order switch
|
|
{
|
|
StackOrder.LastIn => true,
|
|
StackOrder.MultipliersFirst => isMultiplier,
|
|
_ => false,
|
|
};
|
|
if (toFront)
|
|
{
|
|
calls.Insert(0, wanted);
|
|
}
|
|
else
|
|
{
|
|
calls.Add(wanted);
|
|
}
|
|
}
|
|
|
|
/// Takes the next call off, or returns empty when there is nothing on the
|
|
/// stack.
|
|
public string Next()
|
|
{
|
|
if (calls.Count == 0)
|
|
{
|
|
return "";
|
|
}
|
|
string call = calls[0];
|
|
calls.RemoveAt(0);
|
|
return call;
|
|
}
|
|
|
|
public bool Remove(string call) =>
|
|
calls.RemoveAll(c => string.Equals(c, call.Trim(), StringComparison.OrdinalIgnoreCase)) > 0;
|
|
|
|
/// Puts a call already on the stack at the front, which is what
|
|
/// double-clicking it in N1MM's window does.
|
|
public void MoveToTop(string call)
|
|
{
|
|
if (Remove(call))
|
|
{
|
|
calls.Insert(0, call.Trim().ToUpperInvariant());
|
|
}
|
|
}
|
|
|
|
public void Clear() => calls.Clear();
|
|
}
|