Skip to content

Commit

Permalink
FT8 demod: implemented DXCC country decoding. Fixes f4exb#2008
Browse files Browse the repository at this point in the history
  • Loading branch information
f4exb committed Mar 8, 2024
1 parent 7881908 commit 76e8c70
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 1 deletion.
13 changes: 13 additions & 0 deletions plugins/channelrx/demodft8/ft8demodfilterproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions plugins/channelrx/demodft8/ft8demodfilterproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class FT8DemodFilterProxy : public QSortFilterProxyModel
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:
Expand All @@ -45,6 +46,7 @@ class FT8DemodFilterProxy : public QSortFilterProxyModel
FILTER_DF,
FILTER_CALL,
FILTER_LOC,
FILTER_COUNTRY,
FILTER_INFO
};

Expand All @@ -54,6 +56,7 @@ class FT8DemodFilterProxy : public QSortFilterProxyModel
int m_df;
QString m_call;
QString m_loc;
QString m_country;
QString m_info;
};

Expand Down
23 changes: 23 additions & 0 deletions plugins/channelrx/demodft8/ft8demodgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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,
Expand All @@ -201,13 +209,25 @@ void FT8MessagesTableModel::messagesReceived(const QList<FT8Message>& messages)
message.call1,
message.call2,
message.loc,
countryInfo.country,
message.decoderInfo
});
}

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) {
Expand All @@ -226,6 +246,7 @@ void FT8MessagesTableModel::setDefaultMessage()
"CQ PA900RAALTE",
"PA900RAALTE",
"JN000",
"Bosnia-Herzegovina",
"OSD-0-73"
});
endInsertRows();
Expand Down Expand Up @@ -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());
}
Expand Down
4 changes: 3 additions & 1 deletion plugins/channelrx/demodft8/ft8demodgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ struct FT8MesssageData
QString m_call1;
QString m_call2;
QString m_loc;
QString m_country;
QString m_info;
};

Expand All @@ -77,7 +78,8 @@ class FT8MessagesTableModel : public QAbstractTableModel

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 {
Expand Down
1 change: 1 addition & 0 deletions plugins/channelrx/demodft8/ft8demodsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct FT8DemodSettings
MESSAGE_COL_CALL1,
MESSAGE_COL_CALL2,
MESSAGE_COL_LOC,
MESSAGE_COL_COUNTRY,
MESSAGE_COL_INFO,
};

Expand Down
2 changes: 2 additions & 0 deletions plugins/channelrx/demodft8/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit 76e8c70

Please sign in to comment.