From 76e8c70716f61431e599285260c49a30492b8752 Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 8 Mar 2024 15:36:39 +0100 Subject: [PATCH] FT8 demod: implemented DXCC country decoding. Fixes #2008 --- .../demodft8/ft8demodfilterproxy.cpp | 13 +++++++++++ .../channelrx/demodft8/ft8demodfilterproxy.h | 3 +++ plugins/channelrx/demodft8/ft8demodgui.cpp | 23 +++++++++++++++++++ plugins/channelrx/demodft8/ft8demodgui.h | 4 +++- plugins/channelrx/demodft8/ft8demodsettings.h | 1 + plugins/channelrx/demodft8/readme.md | 2 ++ 6 files changed, 45 insertions(+), 1 deletion(-) diff --git a/plugins/channelrx/demodft8/ft8demodfilterproxy.cpp b/plugins/channelrx/demodft8/ft8demodfilterproxy.cpp index 343800dd4..bd26c56f2 100644 --- a/plugins/channelrx/demodft8/ft8demodfilterproxy.cpp +++ b/plugins/channelrx/demodft8/ft8demodfilterproxy.cpp @@ -57,6 +57,13 @@ void FT8DemodFilterProxy::setFilterLoc(const QString& locString) invalidateFilter(); } +void FT8DemodFilterProxy::setFilterCountry(const QString& countryString) +{ + m_filterActive = FILTER_COUNTRY; + m_country = countryString; + invalidateFilter(); +} + void FT8DemodFilterProxy::setFilterInfo(const QString& infoString) { m_filterActive = FILTER_INFO; @@ -97,6 +104,12 @@ bool FT8DemodFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sou return sourceModel()->data(index).toString() == m_loc; } + if (m_filterActive == FILTER_COUNTRY) + { + QModelIndex index = sourceModel()->index(sourceRow, FT8DemodSettings::MESSAGE_COL_COUNTRY, sourceParent); + return sourceModel()->data(index).toString() == m_country; + } + if (m_filterActive == FILTER_INFO) { QModelIndex index = sourceModel()->index(sourceRow, FT8DemodSettings::MESSAGE_COL_INFO, sourceParent); diff --git a/plugins/channelrx/demodft8/ft8demodfilterproxy.h b/plugins/channelrx/demodft8/ft8demodfilterproxy.h index 48bb0023b..4954741eb 100644 --- a/plugins/channelrx/demodft8/ft8demodfilterproxy.h +++ b/plugins/channelrx/demodft8/ft8demodfilterproxy.h @@ -32,6 +32,7 @@ public: void setFilterDf(int df); void setFilterCall(const QString& utcString); void setFilterLoc(const QString& utcString); + void setFilterCountry(const QString& countryString); void setFilterInfo(const QString& infoString); protected: @@ -45,6 +46,7 @@ private: FILTER_DF, FILTER_CALL, FILTER_LOC, + FILTER_COUNTRY, FILTER_INFO }; @@ -54,6 +56,7 @@ private: int m_df; QString m_call; QString m_loc; + QString m_country; QString m_info; }; diff --git a/plugins/channelrx/demodft8/ft8demodgui.cpp b/plugins/channelrx/demodft8/ft8demodgui.cpp index 0ead27144..bb66a4888 100644 --- a/plugins/channelrx/demodft8/ft8demodgui.cpp +++ b/plugins/channelrx/demodft8/ft8demodgui.cpp @@ -33,6 +33,7 @@ #include "gui/dialpopup.h" #include "gui/dialogpositioner.h" #include "util/db.h" +#include "util/callsign.h" #include "maincore.h" #include "ui_ft8demodgui.h" @@ -89,6 +90,8 @@ QVariant FT8MessagesTableModel::data(const QModelIndex &index, int role) const return ft8Message.m_call2; case FT8DemodSettings::MESSAGE_COL_LOC: return ft8Message.m_loc; + case FT8DemodSettings::MESSAGE_COL_COUNTRY: + return ft8Message.m_country; case FT8DemodSettings::MESSAGE_COL_INFO: return ft8Message.m_info; default: @@ -137,6 +140,8 @@ QVariant FT8MessagesTableModel::headerData(int section, Qt::Orientation orientat return tr("Call2"); case FT8DemodSettings::MESSAGE_COL_LOC: return tr("Loc"); + case FT8DemodSettings::MESSAGE_COL_COUNTRY: + return tr("Country"); case FT8DemodSettings::MESSAGE_COL_INFO: return tr("Info"); default: @@ -167,6 +172,8 @@ QVariant FT8MessagesTableModel::headerData(int section, Qt::Orientation orientat return tr("Second call area"); case FT8DemodSettings::MESSAGE_COL_LOC: return tr("Locator area"); + case FT8DemodSettings::MESSAGE_COL_COUNTRY: + return tr("DXCC country name"); case FT8DemodSettings::MESSAGE_COL_INFO: return tr("Decoder information"); default: @@ -190,6 +197,7 @@ void FT8MessagesTableModel::messagesReceived(const QList& messages) for (const auto& message : messages) { + CountryDat::CountryInfo countryInfo = Callsign::instance()->getCountryInfo(getCaller(message.call1, message.call2)); m_ft8Messages.push_back(FT8MesssageData{ message.ts.toString("HHmmss"), message.type, @@ -201,6 +209,7 @@ void FT8MessagesTableModel::messagesReceived(const QList& messages) message.call1, message.call2, message.loc, + countryInfo.country, message.decoderInfo }); } @@ -208,6 +217,17 @@ void FT8MessagesTableModel::messagesReceived(const QList& messages) endInsertRows(); } +QString FT8MessagesTableModel::getCaller(const QString& call1, const QString& call2) +{ + if (!call2.isEmpty()) { + return call2; + } + if (call1.startsWith("CQ ")) { + return call1.mid(3); + } + return ""; +} + void FT8MessagesTableModel::setDefaultMessage() { if (m_ft8Messages.size() != 0) { @@ -226,6 +246,7 @@ void FT8MessagesTableModel::setDefaultMessage() "CQ PA900RAALTE", "PA900RAALTE", "JN000", + "Bosnia-Herzegovina", "OSD-0-73" }); endInsertRows(); @@ -950,6 +971,8 @@ void FT8DemodGUI::filterMessages() m_messagesFilterProxy.setFilterUTC(m_selectedData.toString()); } else if (m_selectedColumn == FT8DemodSettings::MESSAGE_COL_DF) { m_messagesFilterProxy.setFilterDf(m_selectedData.toInt()); + } else if (m_selectedColumn == FT8DemodSettings::MESSAGE_COL_COUNTRY) { + m_messagesFilterProxy.setFilterCountry(m_selectedData.toString()); } else if (m_selectedColumn == FT8DemodSettings::MESSAGE_COL_INFO) { m_messagesFilterProxy.setFilterInfo(m_selectedData.toString()); } diff --git a/plugins/channelrx/demodft8/ft8demodgui.h b/plugins/channelrx/demodft8/ft8demodgui.h index 9a80cff29..5c2aabdfe 100644 --- a/plugins/channelrx/demodft8/ft8demodgui.h +++ b/plugins/channelrx/demodft8/ft8demodgui.h @@ -56,6 +56,7 @@ struct FT8MesssageData QString m_call1; QString m_call2; QString m_loc; + QString m_country; QString m_info; }; @@ -77,7 +78,8 @@ public: private: QVector m_ft8Messages; - static const int m_columnCount = 11; + static const int m_columnCount = 12; + static QString getCaller(const QString& call1, const QString& call2); }; class FT8DemodGUI : public ChannelGUI { diff --git a/plugins/channelrx/demodft8/ft8demodsettings.h b/plugins/channelrx/demodft8/ft8demodsettings.h index a1e4dc729..8e4146f30 100644 --- a/plugins/channelrx/demodft8/ft8demodsettings.h +++ b/plugins/channelrx/demodft8/ft8demodsettings.h @@ -64,6 +64,7 @@ struct FT8DemodSettings MESSAGE_COL_CALL1, MESSAGE_COL_CALL2, MESSAGE_COL_LOC, + MESSAGE_COL_COUNTRY, MESSAGE_COL_INFO, }; diff --git a/plugins/channelrx/demodft8/readme.md b/plugins/channelrx/demodft8/readme.md index 379afb082..b2069928c 100644 --- a/plugins/channelrx/demodft8/readme.md +++ b/plugins/channelrx/demodft8/readme.md @@ -124,6 +124,7 @@ Toggles the filtering of messages. Messages are filtered based on the selected c - **Call1**: will filter messages matching the call1 area value either in the call1 or call2 areas - **Call2**: same as above but taking the call2 value - **Loc**: will filter messages matching the value in the locator (loc) area + - **Country**: will filter messages matching the value in the country area - **Info**: will filter values starting with "OSD" or not starting with "OSD" thus filter messages decoded via OSD or not

C.5: Band preset selection

@@ -201,6 +202,7 @@ Displays the received messages in a table which columns are the following: - **Call1**: This is the first call area and may contain the caller callsign, a CQ or a custom 13 character message in which case the second call and locator areas are empty. It may be slightly different from the standard for message type 5 (see above). - **Call2**: This is the second call area and will contain the callsign of the responding station. This is always a callsign and this may differ slightly from the standard for messages type 5 (see above). - **Loc**: Locator area which contains the 4 character Maidenhead locator, a report, an acknowledgement (RRR) or a greetings (73 or RR73) + - **Country**: DXCC country name derived from the caller callsign - **Info**: FT8 decoder information if any. If OSD is active (see C.1.3) and OSD was activated it reports the OSD decoder status as `OSD-N-MM` where N is the OSD depth reached and MM is the number of correct LDPC bits.

C.1: More FT8 decoder settings