1#ifndef SATELLITEDATABASE_HH
2#define SATELLITEDATABASE_HH
4#include "errorstack.hh"
7#include "transponderdatabase.hh"
8#include "orbitalelementsdatabase.hh"
30 const QString &
name()
const;
73 QJsonObject
toJson()
const;
113 explicit SatelliteDatabase(
unsigned int updatePeriodDays=7, QObject *parent =
nullptr);
125 unsigned int count()
const;
133 bool removeRows(
int row,
int count,
const QModelIndex &parent=QModelIndex());
136 Qt::ItemFlags
flags(
const QModelIndex &index)
const;
139 int rowCount(
const QModelIndex &parent=QModelIndex())
const;
141 int columnCount(
const QModelIndex &parent=QModelIndex())
const;
143 QVariant
headerData(
int section, Qt::Orientation orientation,
int role)
const;
145 QVariant
data(
const QModelIndex &index,
int role)
const;
147 bool setData(
const QModelIndex &index,
const QVariant &value,
int role);
165 QVector<Satellite> _satellites;
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition errorstack.hh:43
OrbitalElement()
Default constructor.
Definition orbitalelementsdatabase.cc:77
Downloads and updates a database of orbital elements from CelesTrak.
Definition orbitalelementsdatabase.hh:122
int columnCount(const QModelIndex &parent=QModelIndex()) const
Implements the QAbstractTableModel interface.
Definition satellitedatabase.cc:304
SatelliteDatabase(unsigned int updatePeriodDays=7, QObject *parent=nullptr)
Constructs a new satellite database.
Definition satellitedatabase.cc:219
void load()
Loads the user-curated satellite database.
Definition satellitedatabase.cc:439
bool setAt(const Satellite &sat, unsigned int idx)
Returns the i-th satellite.
Definition satellitedatabase.cc:262
void loaded()
Gets emitted once the satellites has been loaded.
QVariant data(const QModelIndex &index, int role) const
Implements the QAbstractTableModel interface.
Definition satellitedatabase.cc:360
void error(const QString &msg)
Gets emitted if the loading one of the sources fails.
int rowCount(const QModelIndex &parent=QModelIndex()) const
Implements the QAbstractTableModel interface.
Definition satellitedatabase.cc:298
unsigned int count() const
Returns the number of configured satellites.
Definition satellitedatabase.cc:252
bool save(const ErrorStack &err=ErrorStack()) const
Saves the user-curated satellite database.
Definition satellitedatabase.cc:489
Qt::ItemFlags flags(const QModelIndex &index) const
Implements the QAbstractTableModel interface.
Definition satellitedatabase.cc:333
bool setData(const QModelIndex &index, const QVariant &value, int role)
Implements the QAbstractTableModel interface.
Definition satellitedatabase.cc:409
void update()
Triggers a download of the orbital and transponder databases.
Definition satellitedatabase.cc:433
const TransponderDatabase & transponders() const
Returns the transponder database.
Definition satellitedatabase.cc:237
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
Removes one or more satellites.
Definition satellitedatabase.cc:282
const OrbitalElementsDatabase & orbitalElements() const
Returns the orbital element database.
Definition satellitedatabase.cc:232
QVariant headerData(int section, Qt::Orientation orientation, int role) const
Implements the QAbstractTableModel interface.
Definition satellitedatabase.cc:310
void add(const Satellite &sat)
Appends a satellite.
Definition satellitedatabase.cc:271
const Satellite & getAt(unsigned int idx) const
Returns the i-th satellite.
Definition satellitedatabase.cc:257
Extends the OrbitalElement to include transponder information for a satellite.
Definition satellitedatabase.hh:18
void setBeacon(const Frequency &f)
Sets a beacon frequency.
Definition satellitedatabase.cc:138
static Satellite fromJson(const QJsonObject &obj, const OrbitalElementsDatabase &db)
Constructs a satellite from the given JSON object and orbital element database.
Definition satellitedatabase.cc:180
Frequency _aprsDownlink
Holds the APRS downlink frequency.
Definition satellitedatabase.hh:93
Satellite(const Satellite &sat)=default
Copy constructor.
SelectiveCall _aprsUplinkTone
Holds the APRS uplink tone.
Definition satellitedatabase.hh:95
QString _name
Holds the name of the satellite.
Definition satellitedatabase.hh:81
SelectiveCall _aprsDownlinkTone
Holds the APRS downlink tone.
Definition satellitedatabase.hh:97
SelectiveCall _fmUplinkTone
Holds the FM uplink tone.
Definition satellitedatabase.hh:87
const SelectiveCall & fmDownlinkTone() const
Returns the FM downlink tone (i.e., RX tone).
Definition satellitedatabase.cc:81
Frequency _fmUplink
Holds the FM uplink frequency.
Definition satellitedatabase.hh:83
void setAPRSDownlinkTone(const SelectiveCall &tone)
Sets the APRS downlink sub tone.
Definition satellitedatabase.cc:128
const SelectiveCall & aprsDownlinkTone() const
Returns the APRS downlink tone (i.e., RX tone).
Definition satellitedatabase.cc:123
void setFMUplink(const Frequency &f)
Sets the FM uplink frequency.
Definition satellitedatabase.cc:53
QJsonObject toJson() const
Serializes the satellite into a JSON object.
Definition satellitedatabase.cc:144
Satellite()
Default constructor.
Definition satellitedatabase.cc:19
void setAPRSDownlink(const Frequency &f)
Sets the APRS downlink frequency.
Definition satellitedatabase.cc:107
Frequency _aprsUplink
Holds the APRS uplink frequency.
Definition satellitedatabase.hh:91
Satellite & operator=(const Satellite &other)=default
Copy assignment.
void setFMDownlinkTone(const SelectiveCall &tone)
Sets the FM downlink sub tone.
Definition satellitedatabase.cc:86
const Frequency & aprsDownlink() const
Returns the APRS downlink frequency.
Definition satellitedatabase.cc:102
const Frequency & beacon() const
Returns a beacon frequency.
Definition satellitedatabase.cc:133
void setFMDownlink(const Frequency &f)
Sets the FM downlink frequency.
Definition satellitedatabase.cc:64
SelectiveCall _fmDownlinkTone
Holds the FM downlink tone.
Definition satellitedatabase.hh:89
const Frequency & fmDownlink() const
Returns the FM downlink frequency.
Definition satellitedatabase.cc:59
Frequency _beacon
Holds a beacon frequency.
Definition satellitedatabase.hh:99
void setName(const QString &name)
Sets the name of the satellite.
Definition satellitedatabase.cc:42
void setAPRSUplink(const Frequency &f)
Sets the APRS uplink frequency.
Definition satellitedatabase.cc:97
void setAPRSUplinkTone(const SelectiveCall &tone)
Sets the APRS uplink sub tone.
Definition satellitedatabase.cc:118
Frequency _fmDownlink
Holds the FM downlink frequency.
Definition satellitedatabase.hh:85
const Frequency & fmUplink() const
Returns the FM uplink frequency.
Definition satellitedatabase.cc:48
const SelectiveCall & aprsUplinkTone() const
Returns the APRS uplink tone (i.e., TX tone).
Definition satellitedatabase.cc:113
const SelectiveCall & fmUplinkTone() const
Returns the FM uplink tone (i.e., TX tone).
Definition satellitedatabase.cc:70
void setFMUplinkTone(const SelectiveCall &tone)
Sets the FM uplink sub tone.
Definition satellitedatabase.cc:75
const Frequency & aprsUplink() const
Returns the APRS uplink frequency.
Definition satellitedatabase.cc:92
const QString & name() const
Returns the name of the satellite.
Definition satellitedatabase.cc:37
Implements the database of all known transponder.
Definition transponderdatabase.hh:77
Helper type to encode frequencies without any rounding error.
Definition frequency.hh:107
Encodes a selective call.
Definition signaling.hh:13