1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Merge pull request #1954 from srcejon/freq_scanner

Sat Tracker: Update default TLEs to latest URLs.
This commit is contained in:
Edouard Griffiths 2024-01-17 16:08:56 +01:00 committed by GitHub
commit 9bfeddfea5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 38 additions and 3 deletions

View File

@ -42,6 +42,7 @@ MESSAGE_CLASS_DEFINITION(SatelliteTracker::MsgConfigureSatelliteTracker, Message
MESSAGE_CLASS_DEFINITION(SatelliteTracker::MsgStartStop, Message)
MESSAGE_CLASS_DEFINITION(SatelliteTracker::MsgUpdateSatData, Message)
MESSAGE_CLASS_DEFINITION(SatelliteTracker::MsgSatData, Message)
MESSAGE_CLASS_DEFINITION(SatelliteTracker::MsgError, Message)
const char* const SatelliteTracker::m_featureIdURI = "sdrangel.feature.satellitetracker";
const char* const SatelliteTracker::m_featureId = "SatelliteTracker";
@ -881,7 +882,7 @@ QString SatelliteTracker::tleURLToFilename(const QString& string)
return fileName;
}
void SatelliteTracker::downloadFinished(const QString& filename, bool success)
void SatelliteTracker::downloadFinished(const QString& filename, bool success, const QString& url, const QString& error)
{
if (success)
{
@ -912,7 +913,11 @@ void SatelliteTracker::downloadFinished(const QString& filename, bool success)
qDebug() << "SatelliteTracker::downloadFinished: Unexpected filename: " << filename;
}
else
{
m_updatingSatData = false;
if (m_guiMessageQueue)
m_guiMessageQueue->push(MsgError::create(QString("Failed to download: %1\n\n%2").arg(url).arg(error)));
}
}
bool SatelliteTracker::readSatData()
@ -940,7 +945,11 @@ bool SatelliteTracker::readSatData()
else
ok = parseTxtTLEs(tlesFile.readAll());
if (!ok)
{
qDebug() << "SatelliteTracker::readSatData - failed to parse: " << tlesFile.fileName();
if (m_guiMessageQueue)
m_guiMessageQueue->push(MsgError::create(QString("Failed to parse: %1").arg(tlesFile.fileName())));
}
}
else
qDebug() << "SatelliteTracker::readSatData - failed to open: " << tlesFile.fileName();

View File

@ -124,6 +124,25 @@ public:
{ }
};
class MsgError : public Message {
MESSAGE_CLASS_DECLARATION
public:
QString getError() { return m_error; }
static MsgError* create(const QString& error) {
return new MsgError(error);
}
private:
QString m_error;
MsgError(const QString& error) :
Message(),
m_error(error)
{ }
};
SatelliteTracker(WebAPIAdapterInterface *webAPIAdapterInterface);
virtual ~SatelliteTracker();
virtual void destroy() { delete this; }
@ -220,7 +239,7 @@ private:
private slots:
void networkManagerFinished(QNetworkReply *reply);
void downloadFinished(const QString& filename, bool success);
void downloadFinished(const QString& filename, bool success, const QString& url, const QString& error);
};
#endif // INCLUDE_FEATURE_SATELLITETRACKER_H_

View File

@ -199,6 +199,13 @@ bool SatelliteTrackerGUI::handleMessage(const Message& message)
return true;
}
else if (SatelliteTracker::MsgError::match(message))
{
SatelliteTracker::MsgError& errorMsg = (SatelliteTracker::MsgError&) message;
QString error = errorMsg.getError();
QMessageBox::critical(this, "Satellite Tracker", error);
return true;
}
return false;
}

View File

@ -26,7 +26,7 @@
#include "satellitetrackersettings.h"
#define DEAFULT_TARGET "ISS"
#define DEFAULT_TLES {"https://db.satnogs.org/api/tle/", "https://www.amsat.org/tle/current/nasabare.txt", "https://www.celestrak.com/NORAD/elements/goes.txt", "https://celestrak.org/NORAD/elements/gp.php?GROUP=gps-ops&FORMAT=tle"}
#define DEFAULT_TLES {"https://db.satnogs.org/api/tle/", "https://www.amsat.org/tle/current/nasabare.txt", "http://celestrak.org/NORAD/elements/gp.php?GROUP=weather&FORMAT=tle", "https://celestrak.org/NORAD/elements/gp.php?GROUP=gps-ops&FORMAT=tle"}
#define DEFAULT_DATE_FORMAT "yyyy/MM/dd"
#define DEFAULT_AOS_SPEECH "${name} is visible for ${duration} minutes. Max elevation, ${elevation} degrees."
#define DEFAULT_LOS_SPEECH "${name} is no longer visible."