mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-22 17:45:48 -05:00
Sat Tracker: Update default TLEs to latest URLs. Add GUI error if TLEs not downloaded.
This commit is contained in:
parent
9ce5653beb
commit
86f1024733
@ -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();
|
||||
|
@ -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_
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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."
|
||||
|
Loading…
Reference in New Issue
Block a user