Logging: Send WSJT-X 'Decode' message to indicate RX'd SNR. (#1248)

* Logging: Send WSJT-X 'Decode' message to indicate RX'd SNR.

* Add PR #1248 to changelog.
ms-doc-omnirig-troubleshoot
Mooneer Salem 2026-03-19 01:29:38 -07:00 committed by GitHub
parent 4c27fcb725
commit 2faef3784c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 55 additions and 7 deletions

View File

@ -890,6 +890,7 @@ LDPC | Low Density Parity Check Codes - a family of powerful FEC codes
2. Enhancements:
* FreeDV Reporter: Use ItemsAdded/ItemsDeleted instead of Cleared() for performance. (PR #1212)
* Optimize "From XXX" plot performance. (PR #1238, #1239)
* Logging: Send WSJT-X 'Decode' message to indicate RX'd SNR. (PR #1248)
* Remove Python from RADE implementation to improve performance. (PR #1251)
3. Build system:
* Update Python to 3.14.3. (PR #1221)

View File

@ -151,10 +151,11 @@ void LogEntryDialog::OnInitDialog(wxInitDialogEvent&)
// empty
}
void LogEntryDialog::ShowDialog(wxString const& dxCall, wxString const& dxGrid, wxDateTime const& logTime, int64_t freqHz)
void LogEntryDialog::ShowDialog(wxString const& dxCall, wxString const& dxGrid, wxDateTime const& logTime, int64_t freqHz, int snr)
{
logTime_ = logTime;
labelTimeVal_->SetLabel(logTime_.ToUTC().FormatISOTime());
snr_ = snr;
logger_ = wxGetApp().logger;
dxCall_->SetValue(dxCall);
@ -218,7 +219,8 @@ void LogEntryDialog::OnOK(wxCommandEvent&)
(const char*)rxReport_->GetValue().ToUTF8(),
(const char*)txReport_->GetValue().ToUTF8(),
(const char*)name_->GetValue().ToUTF8(),
(const char*)comments_->GetValue().ToUTF8());
(const char*)comments_->GetValue().ToUTF8(),
snr_);
this->EndModal(wxOK);
}
}

View File

@ -39,7 +39,7 @@ class LogEntryDialog : public wxDialog
long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
virtual ~LogEntryDialog();
void ShowDialog(wxString const& dxCall, wxString const& dxGrid, wxDateTime const& logTime, int64_t freqHz);
void ShowDialog(wxString const& dxCall, wxString const& dxGrid, wxDateTime const& logTime, int64_t freqHz, int snr);
protected:
@ -67,6 +67,7 @@ class LogEntryDialog : public wxDialog
private:
std::shared_ptr<ILogger> logger_;
wxDateTime logTime_;
int snr_;
};
#endif // LOG_ENTRY_DIALOG_H

View File

@ -29,7 +29,9 @@
class ILogger
{
public:
virtual void logContact(std::chrono::time_point<std::chrono::system_clock> logTime, std::string dxCall, std::string dxGrid, std::string myCall, std::string myGrid, uint64_t freqHz, std::string reportRx, std::string reportTx, std::string name, std::string comments) = 0;
static const int UNKNOWN_SNR = -99;
virtual void logContact(std::chrono::time_point<std::chrono::system_clock> logTime, std::string dxCall, std::string dxGrid, std::string myCall, std::string myGrid, uint64_t freqHz, std::string reportRx, std::string reportTx, std::string name, std::string comments, int snr) = 0;
};
#endif // I_LOGGER_H

View File

@ -58,6 +58,17 @@ WSJTXNetworkLogger::PacketBuilder& WSJTXNetworkLogger::PacketBuilder::serialize_
return *this;
}
template<>
WSJTXNetworkLogger::PacketBuilder& WSJTXNetworkLogger::PacketBuilder::serialize_<double>(const double& obj)
{
char* ptr = reallocPacket_(sizeof(double));
assert(ptr != nullptr);
memcpy(ptr, &obj, sizeof(double));
return *this;
}
template<>
WSJTXNetworkLogger::PacketBuilder& WSJTXNetworkLogger::PacketBuilder::serialize_<char>(const char& obj)
{
@ -203,7 +214,7 @@ WSJTXNetworkLogger::~WSJTXNetworkLogger()
close();
}
void WSJTXNetworkLogger::logContact(std::chrono::time_point<std::chrono::system_clock> logTime, std::string dxCall, std::string dxGrid, std::string myCall, std::string myGrid, uint64_t freqHz, std::string reportRx, std::string reportTx, std::string name, std::string comments)
void WSJTXNetworkLogger::logContact(std::chrono::time_point<std::chrono::system_clock> logTime, std::string dxCall, std::string dxGrid, std::string myCall, std::string myGrid, uint64_t freqHz, std::string reportRx, std::string reportTx, std::string name, std::string comments, int snr)
{
auto currentTimeAsJulian = sys_to_jdate(logTime);
@ -235,6 +246,33 @@ void WSJTXNetworkLogger::logContact(std::chrono::time_point<std::chrono::system_
;
send(reportHostname_.c_str(), reportPort_, statusBuilder.getPacket(), statusBuilder.getPacketSize()).wait();
// Not using C++20, so we need to manually define this.
using day_duration = std::chrono::duration<int64_t, std::ratio<86400>>;
auto julianEpoch = currentTimeAsJulian.time_since_epoch();
auto julianDays = std::chrono::floor<day_duration>(julianEpoch);
auto julianFracDay = julianEpoch - julianDays;
auto msSinceMidnight = std::chrono::duration_cast<std::chrono::milliseconds>(julianFracDay).count();
// Send decode message for SNR
if (snr > UNKNOWN_SNR)
{
PacketBuilder decodeBuilder;
decodeBuilder << (uint32_t)2
<< UNIQUE_ID
<< false
<< (uint32_t)msSinceMidnight // time
<< (int32_t)snr
<< (double)0.0 // delta time
<< (uint32_t)0 // delta freq
<< LOG_MODE
<< std::string("") // message
<< false // low confidence
<< false // off air
;
send(reportHostname_.c_str(), reportPort_, decodeBuilder.getPacket(), decodeBuilder.getPacketSize()).wait();
}
// Send actual log request
PacketBuilder builder;
builder << (uint32_t)5

View File

@ -57,7 +57,7 @@ public:
WSJTXNetworkLogger(std::string hostname, int port);
virtual ~WSJTXNetworkLogger();
virtual void logContact(std::chrono::time_point<std::chrono::system_clock> logTime, std::string dxCall, std::string dxGrid, std::string myCall, std::string myGrid, uint64_t freqHz, std::string reportRx, std::string reportTx, std::string name, std::string comments) override;
virtual void logContact(std::chrono::time_point<std::chrono::system_clock> logTime, std::string dxCall, std::string dxGrid, std::string myCall, std::string myGrid, uint64_t freqHz, std::string reportRx, std::string reportTx, std::string name, std::string comments, int snr) override;
protected:
virtual void onReceive_(const char*, int, char*, int) override { /* not used */ }

View File

@ -1276,9 +1276,11 @@ void MainFrame::OnLogQSO(wxCommandEvent&)
wxString dxGrid;
wxString dxFreq;
wxString logTime;
wxString snrString;
wxDateTime logTimeObj = wxDateTime::Now();
double dxFreqDouble = 0;
uint64_t dxFreqHz = 0;
double snr = ILogger::UNKNOWN_SNR;
auto selected = m_lastReportedCallsignListView->GetFirstSelected();
if (wxGetApp().lastSelectedLoggingRow == MainApp::MAIN_WINDOW && selected != -1)
@ -1287,8 +1289,10 @@ void MainFrame::OnLogQSO(wxCommandEvent&)
dxCall = m_lastReportedCallsignListView->GetItemText(selected, 0);
dxFreq = m_lastReportedCallsignListView->GetItemText(selected, 1);
logTime = m_lastReportedCallsignListView->GetItemText(selected, 2);
snrString = m_lastReportedCallsignListView->GetItemText(selected, 3);
wxNumberFormatter::FromString(dxFreq, &dxFreqDouble);
wxNumberFormatter::FromString(snrString, &snr);
wxString::const_iterator end;
logTimeObj.ParseDateTime(logTime, &end);
@ -1340,7 +1344,7 @@ void MainFrame::OnLogQSO(wxCommandEvent&)
// Show log contact dialog
auto logDialog = new LogEntryDialog(this);
logDialog->ShowDialog(dxCall.ToUTF8(), dxGrid.ToUTF8(), logTimeObj, (int64_t)dxFreqHz);
logDialog->ShowDialog(dxCall.ToUTF8(), dxGrid.ToUTF8(), logTimeObj, (int64_t)dxFreqHz, (int)snr);
}
// Force manual resync, just in case demod gets stuck on false sync