2016-05-24 06:08:35 -04:00
|
|
|
#ifndef RADIO_HPP__
|
|
|
|
#define RADIO_HPP__
|
2015-03-14 15:13:18 -04:00
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QLocale>
|
2016-05-24 06:08:35 -04:00
|
|
|
#include <QList>
|
|
|
|
|
|
|
|
#include "udp_export.h"
|
2015-03-14 15:13:18 -04:00
|
|
|
|
|
|
|
class QVariant;
|
|
|
|
class QString;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Declarations common to radio software.
|
|
|
|
//
|
|
|
|
|
|
|
|
namespace Radio
|
|
|
|
{
|
|
|
|
//
|
|
|
|
// Frequency types
|
|
|
|
//
|
|
|
|
using Frequency = quint64;
|
2015-10-21 16:05:02 -04:00
|
|
|
using Frequencies = QList<Frequency>;
|
2015-03-14 15:13:18 -04:00
|
|
|
using FrequencyDelta = qint64;
|
|
|
|
|
2016-05-24 06:08:35 -04:00
|
|
|
//
|
|
|
|
// Qt type registration
|
|
|
|
//
|
|
|
|
void UDP_NO_EXPORT register_types ();
|
|
|
|
|
2015-03-14 15:13:18 -04:00
|
|
|
//
|
|
|
|
// Frequency type conversion.
|
|
|
|
//
|
|
|
|
// QVariant argument is convertible to double and is assumed to
|
|
|
|
// be scaled by (10 ** -scale).
|
|
|
|
//
|
2017-01-08 18:58:00 -05:00
|
|
|
Frequency UDP_EXPORT frequency (QVariant const&, int scale,
|
|
|
|
bool * ok = nullptr, QLocale const& = QLocale ());
|
|
|
|
FrequencyDelta UDP_EXPORT frequency_delta (QVariant const&, int scale,
|
|
|
|
bool * ok = nullptr, QLocale const& = QLocale ());
|
2015-03-14 15:13:18 -04:00
|
|
|
|
|
|
|
//
|
|
|
|
// Frequency type formatting
|
|
|
|
//
|
2016-05-24 06:08:35 -04:00
|
|
|
QString UDP_EXPORT frequency_MHz_string (Frequency, QLocale const& = QLocale ());
|
|
|
|
QString UDP_EXPORT frequency_MHz_string (FrequencyDelta, QLocale const& = QLocale ());
|
|
|
|
QString UDP_EXPORT pretty_frequency_MHz_string (Frequency, QLocale const& = QLocale ());
|
|
|
|
QString UDP_EXPORT pretty_frequency_MHz_string (double, int scale, QLocale const& = QLocale ());
|
|
|
|
QString UDP_EXPORT pretty_frequency_MHz_string (FrequencyDelta, QLocale const& = QLocale ());
|
2015-03-14 15:13:18 -04:00
|
|
|
|
|
|
|
//
|
|
|
|
// Callsigns
|
|
|
|
//
|
2016-05-24 06:08:35 -04:00
|
|
|
bool UDP_EXPORT is_callsign (QString const&);
|
|
|
|
bool UDP_EXPORT is_compound_callsign (QString const&);
|
|
|
|
QString UDP_EXPORT base_callsign (QString);
|
2015-03-14 15:13:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE (Radio::Frequency);
|
2015-10-21 16:05:02 -04:00
|
|
|
Q_DECLARE_METATYPE (Radio::Frequencies);
|
2015-03-14 15:13:18 -04:00
|
|
|
Q_DECLARE_METATYPE (Radio::FrequencyDelta);
|
|
|
|
|
|
|
|
#endif
|