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
52 lines
1.5 KiB
C++
52 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <windows.h>
|
|
#include <ole2.h>
|
|
#include <ocidl.h>
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
|
|
#include "ControlSite.h"
|
|
#include "EventSink.h"
|
|
|
|
// The XMMR control out of XMMT.ocx, which is what N1MM drives MMTTY and 2Tone
|
|
// with. The control starts the engine, and the engine reports back through the
|
|
// control's events.
|
|
class XmmrControl {
|
|
public:
|
|
using EventHandler = SinkHandler;
|
|
|
|
explicit XmmrControl(EventHandler handler) : handler_(std::move(handler)) {}
|
|
~XmmrControl() { destroy(); }
|
|
|
|
bool create(HWND parent, std::string* error);
|
|
void destroy();
|
|
|
|
HRESULT put(const wchar_t* name, VARIANT value);
|
|
HRESULT putBool(const wchar_t* name, bool value);
|
|
HRESULT putLong(const wchar_t* name, long value);
|
|
HRESULT putString(const wchar_t* name, const std::string& value);
|
|
|
|
HRESULT call(const wchar_t* name, VARIANT* arguments, unsigned count);
|
|
HRESULT callLong(const wchar_t* name, long first, long second);
|
|
|
|
long getLong(const wchar_t* name);
|
|
std::string getString(const wchar_t* name);
|
|
|
|
private:
|
|
HRESULT invoke(const wchar_t* name, WORD flags, DISPPARAMS* arguments, VARIANT* result);
|
|
bool listen(std::string* error);
|
|
|
|
EventHandler handler_;
|
|
ControlSite* site_ = nullptr;
|
|
IOleObject* object_ = nullptr;
|
|
IDispatch* dispatch_ = nullptr;
|
|
IConnectionPoint* point_ = nullptr;
|
|
IUnknown* sink_ = nullptr;
|
|
DWORD cookie_ = 0;
|
|
};
|
|
|
|
std::string toUtf8(const wchar_t* text);
|
|
std::wstring toWide(const std::string& text);
|