FT8 demod: implemented DXCC country decoding. Fixes #2008

This commit is contained in:
f4exb 2024-03-08 15:36:39 +01:00
parent 788190872b
commit 76e8c70716
6 changed files with 45 additions and 1 deletions

View File

@ -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);

View File

@ -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;
};

View File

@ -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<FT8Message>& 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<FT8Message>& messages)
message.call1,
message.call2,
message.loc,
countryInfo.country,
message.decoderInfo
});
}
@ -208,6 +217,17 @@ void FT8MessagesTableModel::messagesReceived(const QList<FT8Message>& 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());
}

View File

@ -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<FT8MesssageData> 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 {

View File

@ -64,6 +64,7 @@ struct FT8DemodSettings
MESSAGE_COL_CALL1,
MESSAGE_COL_CALL2,
MESSAGE_COL_LOC,
MESSAGE_COL_COUNTRY,
MESSAGE_COL_INFO,
};

View File

@ -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
<h3>C.5: Band preset selection</h3>
@ -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.
<h3>C.1: More FT8 decoder settings</h2>