2022-07-20 16:41:11 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2023-11-19 05:43:20 +00:00
|
|
|
// Copyright (C) 2022 Jon Beniston, M7RCE <jon@beniston.com> //
|
2022-07-20 16:41:11 +00:00
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation as version 3 of the License, or //
|
|
|
|
// (at your option) any later version. //
|
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef INCLUDE_GIRO_H
|
|
|
|
#define INCLUDE_GIRO_H
|
|
|
|
|
|
|
|
#include <QtCore>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QJsonDocument>
|
|
|
|
|
|
|
|
#include "export.h"
|
|
|
|
|
|
|
|
class QNetworkAccessManager;
|
|
|
|
class QNetworkReply;
|
2024-04-05 09:41:24 +00:00
|
|
|
class QNetworkDiskCache;
|
2022-07-20 16:41:11 +00:00
|
|
|
|
|
|
|
// GIRO - Global Ionosphere Radio Observatory
|
|
|
|
// Gets MUFD, TEC, foF2 and other data for various stations around the world
|
|
|
|
// Also gets MUF and foF2 contours as GeoJSON
|
|
|
|
// Data from https://prop.kc2g.com/stations/
|
|
|
|
class SDRBASE_API GIRO : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
protected:
|
|
|
|
GIRO();
|
|
|
|
|
|
|
|
public:
|
|
|
|
// See the following paper for an explanation of some of these variables
|
|
|
|
// https://sbgf.org.br/mysbgf/eventos/expanded_abstracts/13th_CISBGf/A%20Simple%20Method%20to%20Calculate%20the%20Maximum%20Usable%20Frequency.pdf
|
|
|
|
struct GIROStationData {
|
|
|
|
QString m_station;
|
|
|
|
float m_latitude;
|
|
|
|
float m_longitude;
|
|
|
|
QDateTime m_dateTime;
|
|
|
|
float m_mufd; // Maximum usable frequency
|
|
|
|
float m_md; // Propagation coefficient? D=3000km?
|
|
|
|
float m_tec; // Total electron content
|
|
|
|
float m_foF2; // Critical frequency of F2 layer in ionosphere (highest frequency to be reflected)
|
|
|
|
float m_hmF2; // F2 layer height of peak electron density (km?)
|
|
|
|
float m_foE; // Critical frequency of E layer
|
|
|
|
int m_confidence;
|
|
|
|
GIROStationData() :
|
|
|
|
m_latitude(NAN),
|
|
|
|
m_longitude(NAN),
|
|
|
|
m_mufd(NAN),
|
|
|
|
m_md(NAN),
|
|
|
|
m_tec(NAN),
|
|
|
|
m_foF2(NAN),
|
|
|
|
m_hmF2(NAN),
|
|
|
|
m_foE(NAN),
|
|
|
|
m_confidence(-1)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-04-05 09:41:24 +00:00
|
|
|
struct DataSet {
|
|
|
|
QDateTime m_dateTime;
|
|
|
|
QString m_runId;
|
|
|
|
};
|
|
|
|
|
2022-07-20 16:41:11 +00:00
|
|
|
static GIRO* create(const QString& service="prop.kc2g.com");
|
|
|
|
|
|
|
|
~GIRO();
|
2024-04-05 09:41:24 +00:00
|
|
|
void getIndexPeriodically(int periodInMins=15);
|
|
|
|
void getDataPeriodically(int periodInMins=2);
|
|
|
|
void getMUFPeriodically(int periodInMins=15);
|
|
|
|
void getfoF2Periodically(int periodInMins=15);
|
2022-07-20 16:41:11 +00:00
|
|
|
|
2024-04-05 09:41:24 +00:00
|
|
|
void getMUF(const QString& runId);
|
|
|
|
void getfoF2(const QString& runId);
|
|
|
|
|
|
|
|
QString getRunId(const QDateTime& dateTime);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void getIndex();
|
2022-07-20 16:41:11 +00:00
|
|
|
void getData();
|
|
|
|
void getMUF();
|
|
|
|
void getfoF2();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void handleReply(QNetworkReply* reply);
|
|
|
|
|
|
|
|
signals:
|
2024-04-05 09:41:24 +00:00
|
|
|
void indexUpdated(const QList<DataSet>& data);
|
2022-07-20 16:41:11 +00:00
|
|
|
void dataUpdated(const GIROStationData& data); // Called when new data available.
|
|
|
|
void mufUpdated(const QJsonDocument& doc);
|
|
|
|
void foF2Updated(const QJsonDocument& doc);
|
|
|
|
|
|
|
|
private:
|
2022-07-20 16:52:43 +00:00
|
|
|
bool containsNonNull(const QJsonObject& obj, const QString &key) const;
|
2024-04-05 09:41:24 +00:00
|
|
|
void handleIndex(QJsonDocument& document);
|
|
|
|
void handleStations(QJsonDocument& document);
|
2022-07-20 16:41:11 +00:00
|
|
|
|
2024-04-05 09:41:24 +00:00
|
|
|
QTimer m_indexTimer;
|
2022-07-20 16:41:11 +00:00
|
|
|
QTimer m_dataTimer; // Timer for periodic updates
|
|
|
|
QTimer m_mufTimer;
|
|
|
|
QTimer m_foF2Timer;
|
|
|
|
QNetworkAccessManager *m_networkManager;
|
2024-04-05 09:41:24 +00:00
|
|
|
QNetworkDiskCache *m_cache;
|
|
|
|
QList<DataSet> m_index;
|
2022-07-20 16:41:11 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* INCLUDE_GIRO_H */
|