Skip to content

Commit

Permalink
Merge pull request #1954 from srcejon/freq_scanner
Browse files Browse the repository at this point in the history
Sat Tracker: Update default TLEs to latest URLs.
  • Loading branch information
f4exb authored Jan 17, 2024
2 parents 9ce5653 + 86f1024 commit 9bfeddf
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
11 changes: 10 additions & 1 deletion plugins/feature/satellitetracker/satellitetracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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();
Expand Down
21 changes: 20 additions & 1 deletion plugins/feature/satellitetracker/satellitetracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,25 @@ class SatelliteTracker : public Feature
{ }
};

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; }
Expand Down Expand Up @@ -220,7 +239,7 @@ class SatelliteTracker : public Feature

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_
7 changes: 7 additions & 0 deletions plugins/feature/satellitetracker/satellitetrackergui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit 9bfeddf

Please sign in to comment.