1#ifndef TRANSPONDERDATABASE_HH
2#define TRANSPONDERDATABASE_HH
4#include <QAbstractTableModel>
5#include <QNetworkAccessManager>
45 const QString &
name()
const;
90 explicit TransponderDatabase(
bool autoLoad,
unsigned int updatePeriod = 7, QObject *parent =
nullptr);
93 unsigned int dbAge()
const;
100 int rowCount(
const QModelIndex &parent)
const;
104 QVariant
data(
const QModelIndex &index,
int role)
const;
127 void downloadFinished(QNetworkReply *reply);
131 bool load(
const QString &filename);
135 unsigned int _updatePeriod;
137 QVector<Transponder> _transponders;
139 QNetworkAccessManager _network;
const Transponder & getAt(unsigned int idx) const
Returns the i-th transponder.
Definition transponderdatabase.cc:125
QVector< Transponder >::const_iterator const_iterator
Just a const iterator over all transponder.
Definition transponderdatabase.hh:82
unsigned int dbAge() const
The current age of the cache.
Definition transponderdatabase.cc:184
void error(const QString &msg)
Gets emitted if the loading one of the sources fails.
const_iterator begin() const
Returns an iterator, pointing at the first transponder.
Definition transponderdatabase.cc:173
int columnCount(const QModelIndex &parent) const
Implements the QAbstractTableModel interface.
Definition transponderdatabase.cc:136
void download()
Starts the download of the transponder.
Definition transponderdatabase.cc:255
void loaded()
Gets emitted once the transponder has been loaded.
TransponderDatabase(bool autoLoad, unsigned int updatePeriod=7, QObject *parent=nullptr)
Constructor.
Definition transponderdatabase.cc:115
const_iterator end() const
Returns an iterator, pointing right after the last transponder.
Definition transponderdatabase.cc:178
void load()
Downloads and loads all transponder information.
Definition transponderdatabase.cc:194
int rowCount(const QModelIndex &parent) const
Implements the QAbstractTableModel interface.
Definition transponderdatabase.cc:130
QVariant data(const QModelIndex &index, int role) const
Implements the QAbstractTableModel interface.
Definition transponderdatabase.cc:142
Helper type to encode frequencies without any rounding error.
Definition frequency.hh:107
Represents a single transponder of a satellite.
Definition transponderdatabase.hh:12
Mode mode() const
Returns the transponder mode.
Definition transponderdatabase.cc:41
Mode
Possible transponder modes.
Definition transponderdatabase.hh:22
@ APRS
AFSK APRS.
Definition transponderdatabase.hh:25
@ CW
Simple CW.
Definition transponderdatabase.hh:24
@ BPSK
BPSK.
Definition transponderdatabase.hh:26
@ FM
Plain FM.
Definition transponderdatabase.hh:23
Type _type
Holds the transponder type.
Definition transponderdatabase.hh:61
const Frequency & uplink() const
Returns the uplink frequency, if there is one.
Definition transponderdatabase.cc:51
bool isValid() const
Returns true, if the transponder is valid.
Definition transponderdatabase.cc:31
Frequency _downlink
Holds the downlink frequency.
Definition transponderdatabase.hh:67
static Transponder fromSATNOGS(const QJsonObject &obj)
Parses a transponder from the given SatNOGS JSON object.
Definition transponderdatabase.cc:62
Frequency _uplink
Holds the uplink frequency.
Definition transponderdatabase.hh:69
Type
Possible transponder types.
Definition transponderdatabase.hh:16
@ Transmitter
Just a transmitter (beacon).
Definition transponderdatabase.hh:18
const Frequency & downlink() const
Returns the downlink frequency.
Definition transponderdatabase.cc:56
const QString & name() const
Returns a descriptive name of the transponder.
Definition transponderdatabase.cc:46
Type type() const
Returns the transponder type.
Definition transponderdatabase.cc:36
Mode _mode
Holds the transponder mode.
Definition transponderdatabase.hh:63
Transponder()
Default constructor.
Definition transponderdatabase.cc:19
QString _name
Holds the name.
Definition transponderdatabase.hh:65
unsigned int _satellite
Holds the NORAD id of the satellite.
Definition transponderdatabase.hh:59
unsigned int satellite() const
Returns the NORAD id of the associated satellite.
Definition transponderdatabase.cc:26