mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 04:50:29 -04: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::MsgStartStop, Message) | ||||||
| MESSAGE_CLASS_DEFINITION(SatelliteTracker::MsgUpdateSatData, Message) | MESSAGE_CLASS_DEFINITION(SatelliteTracker::MsgUpdateSatData, Message) | ||||||
| MESSAGE_CLASS_DEFINITION(SatelliteTracker::MsgSatData, 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_featureIdURI = "sdrangel.feature.satellitetracker"; | ||||||
| const char* const SatelliteTracker::m_featureId = "SatelliteTracker"; | const char* const SatelliteTracker::m_featureId = "SatelliteTracker"; | ||||||
| @ -881,7 +882,7 @@ QString SatelliteTracker::tleURLToFilename(const QString& string) | |||||||
|     return fileName; |     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) |     if (success) | ||||||
|     { |     { | ||||||
| @ -912,7 +913,11 @@ void SatelliteTracker::downloadFinished(const QString& filename, bool success) | |||||||
|             qDebug() << "SatelliteTracker::downloadFinished: Unexpected filename: " << filename; |             qDebug() << "SatelliteTracker::downloadFinished: Unexpected filename: " << filename; | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
|  |     { | ||||||
|         m_updatingSatData = false; |         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() | bool SatelliteTracker::readSatData() | ||||||
| @ -940,7 +945,11 @@ bool SatelliteTracker::readSatData() | |||||||
|                             else |                             else | ||||||
|                                 ok = parseTxtTLEs(tlesFile.readAll()); |                                 ok = parseTxtTLEs(tlesFile.readAll()); | ||||||
|                             if (!ok) |                             if (!ok) | ||||||
|  |                             { | ||||||
|                                 qDebug() << "SatelliteTracker::readSatData - failed to parse: " << tlesFile.fileName(); |                                 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 |                         else | ||||||
|                             qDebug() << "SatelliteTracker::readSatData - failed to open: " << tlesFile.fileName(); |                             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); |     SatelliteTracker(WebAPIAdapterInterface *webAPIAdapterInterface); | ||||||
|     virtual ~SatelliteTracker(); |     virtual ~SatelliteTracker(); | ||||||
|     virtual void destroy() { delete this; } |     virtual void destroy() { delete this; } | ||||||
| @ -220,7 +239,7 @@ private: | |||||||
| 
 | 
 | ||||||
| private slots: | private slots: | ||||||
|     void networkManagerFinished(QNetworkReply *reply); |     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_
 | #endif // INCLUDE_FEATURE_SATELLITETRACKER_H_
 | ||||||
|  | |||||||
| @ -199,6 +199,13 @@ bool SatelliteTrackerGUI::handleMessage(const Message& message) | |||||||
| 
 | 
 | ||||||
|         return true; |         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; |     return false; | ||||||
| } | } | ||||||
|  | |||||||
| @ -26,7 +26,7 @@ | |||||||
| #include "satellitetrackersettings.h" | #include "satellitetrackersettings.h" | ||||||
| 
 | 
 | ||||||
| #define DEAFULT_TARGET                  "ISS" | #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_DATE_FORMAT              "yyyy/MM/dd" | ||||||
| #define DEFAULT_AOS_SPEECH              "${name} is visible for ${duration} minutes. Max elevation, ${elevation} degrees." | #define DEFAULT_AOS_SPEECH              "${name} is visible for ${duration} minutes. Max elevation, ${elevation} degrees." | ||||||
| #define DEFAULT_LOS_SPEECH              "${name} is no longer visible." | #define DEFAULT_LOS_SPEECH              "${name} is no longer visible." | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user