1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

Merge pull request #1569 from srcejon/ft8_map

FT8 Demod: Display caller on Map feature
This commit is contained in:
Edouard Griffiths 2023-01-23 17:52:41 +01:00 committed by GitHub
commit 13da8f2b22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 0 deletions

View File

@ -31,7 +31,9 @@
#include "gui/dialpopup.h"
#include "gui/dialogpositioner.h"
#include "util/db.h"
#include "util/maidenhead.h"
#include "maincore.h"
#include "SWGMapItem.h"
#include "ui_ft8demodgui.h"
#include "ft8demodgui.h"
@ -733,6 +735,19 @@ void FT8DemodGUI::messagesReceived(const QList<FT8Message>& messages)
locItem->setText(message.loc);
infoItem->setText(message.decoderInfo);
// If message contains a Maidenhead locator, display caller on Map feature
float latitude, longitude;
if ((message.loc.size() == 4) && Maidenhead::fromMaidenhead(message.loc, latitude, longitude))
{
QString text = QString("%1\nMode: FT8\nFrequency: %2 Hz\nLocator: %3\nSNR: %4\nLast heard: %5")
.arg(message.call2)
.arg(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset)
.arg(message.loc)
.arg(message.snr)
.arg(QDateTime::currentDateTime().toString("dd MMM yyyy HH:mm:ss"));
sendToMap(message.call2, text, latitude, longitude);
}
filterMessageRow(row);
row++;
@ -745,6 +760,36 @@ void FT8DemodGUI::messagesReceived(const QList<FT8Message>& messages)
}
}
void FT8DemodGUI::sendToMap(const QString& caller, const QString& text, float latitude, float longitude)
{
QList<ObjectPipe*> mapPipes;
MainCore::instance()->getMessagePipes().getMessagePipes(m_ft8Demod, "mapitems", mapPipes);
for (const auto& pipe : mapPipes)
{
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
swgMapItem->setName(new QString(caller));
swgMapItem->setLatitude(latitude);
swgMapItem->setLongitude(longitude);
swgMapItem->setAltitude(0);
swgMapItem->setAltitudeReference(1); // CLAMP_TO_GROUND
swgMapItem->setPositionDateTime(new QString(QDateTime::currentDateTime().toString(Qt::ISODateWithMs)));
swgMapItem->setImageRotation(0);
swgMapItem->setText(new QString(text));
swgMapItem->setImage(new QString("antenna.png"));
swgMapItem->setModel(new QString("antenna.glb"));
swgMapItem->setModelAltitudeOffset(0.0);
swgMapItem->setLabel(new QString(caller));
swgMapItem->setLabelAltitudeOffset(4.5);
swgMapItem->setFixedPosition(false);
swgMapItem->setOrientation(0);
swgMapItem->setHeading(0);
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_ft8Demod, swgMapItem);
messageQueue->push(msg);
}
}
void FT8DemodGUI::populateBandPresets()
{
ui->bandPreset->blockSignals(true);

View File

@ -108,6 +108,7 @@ private:
void messagesReceived(const QList<FT8Message>& messages);
void populateBandPresets();
void filterMessageRow(int row);
void sendToMap(const QString& call2, const QString& text, float latitude, float longitude);
enum MessageCol {
MESSAGE_COL_UTC,

View File

@ -30,6 +30,7 @@ const QStringList MapSettings::m_pipeTypes = {
QStringLiteral("AIS"),
QStringLiteral("APRS"),
QStringLiteral("APTDemod"),
QStringLiteral("FT8Demod"),
QStringLiteral("Radiosonde"),
QStringLiteral("StarTracker"),
QStringLiteral("SatelliteTracker")
@ -40,6 +41,7 @@ const QStringList MapSettings::m_pipeURIs = {
QStringLiteral("sdrangel.feature.ais"),
QStringLiteral("sdrangel.feature.aprs"),
QStringLiteral("sdrangel.channel.aptdemod"),
QStringLiteral("sdrangel.channel.ft8demod"),
QStringLiteral("sdrangel.feature.radiosonde"),
QStringLiteral("sdrangel.feature.startracker"),
QStringLiteral("sdrangel.feature.satellitetracker")
@ -69,6 +71,7 @@ MapSettings::MapSettings() :
m_itemSettings.insert("Radiosonde", new MapItemSettings("Radiosonde", QColor(102, 0, 102), false, 11, modelMinPixelSize));
m_itemSettings.insert("Radio Time Transmitters", new MapItemSettings("Radio Time Transmitters", QColor(255, 0, 0), true, 8));
m_itemSettings.insert("Radar", new MapItemSettings("Radar", QColor(255, 0, 0), true, 8));
m_itemSettings.insert("FT8Demod", new MapItemSettings("FT8Demod", QColor(0, 192, 255), true, 8));
MapItemSettings *ionosondeItemSettings = new MapItemSettings("Ionosonde Stations", QColor(255, 255, 0), true, 4);
ionosondeItemSettings->m_display2DIcon = false;