Radio Clock: Add support for WWVB

pull/968/head
Jon Beniston 2021-07-22 16:08:55 +01:00
rodzic 9535ecb547
commit ff508df7eb
3 zmienionych plików z 40 dodań i 8 usunięć

Wyświetl plik

@ -68,19 +68,23 @@ public:
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
public: public:
QDateTime getDateTime() const { return m_dateTime; }
static MsgDateTime* create(QDateTime dateTime) QDateTime getDateTime() const { return m_dateTime; }
RadioClockSettings::DST getDST() const { return m_dst; }
static MsgDateTime* create(QDateTime dateTime, RadioClockSettings::DST dst = RadioClockSettings::DST::UNKNOWN)
{ {
return new MsgDateTime(dateTime); return new MsgDateTime(dateTime, dst);
} }
private: private:
QDateTime m_dateTime; QDateTime m_dateTime;
RadioClockSettings::DST m_dst;
MsgDateTime(QDateTime dateTime) : MsgDateTime(QDateTime dateTime, RadioClockSettings::DST dst) :
Message(), Message(),
m_dateTime(dateTime) m_dateTime(dateTime),
m_dst(dst)
{ {
} }
}; };

Wyświetl plik

@ -104,6 +104,24 @@ bool RadioClockGUI::handleMessage(const Message& message)
RadioClock::MsgDateTime& report = (RadioClock::MsgDateTime&) message; RadioClock::MsgDateTime& report = (RadioClock::MsgDateTime&) message;
m_dateTime = report.getDateTime(); m_dateTime = report.getDateTime();
displayDateTime(); displayDateTime();
switch (report.getDST())
{
case RadioClockSettings::UNKNOWN:
ui->dst->setText("");
break;
case RadioClockSettings::NOT_IN_EFFECT:
ui->dst->setText("Not in effect");
break;
case RadioClockSettings::IN_EFFECT:
ui->dst->setText("In effect");
break;
case RadioClockSettings::ENDING:
ui->dst->setText("Ending");
break;
case RadioClockSettings::STARTING:
ui->dst->setText("Starting");
break;
}
return true; return true;
} }
else if (RadioClock::MsgStatus::match(message)) else if (RadioClock::MsgStatus::match(message))
@ -257,11 +275,11 @@ RadioClockGUI::RadioClockGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas
m_scopeVis = m_radioClock->getScopeSink(); m_scopeVis = m_radioClock->getScopeSink();
m_scopeVis->setGLScope(ui->glScope); m_scopeVis->setGLScope(ui->glScope);
m_scopeVis->setNbStreams(7); m_scopeVis->setNbStreams(RadioClockSettings::m_scopeStreams);
m_scopeVis->setLiveRate(RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE); m_scopeVis->setLiveRate(RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE);
ui->glScope->connectTimer(MainCore::instance()->getMasterTimer()); ui->glScope->connectTimer(MainCore::instance()->getMasterTimer());
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope); ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
ui->scopeGUI->setStreams(QStringList({"IQ", "MagSq", "TH", "FM", "Data", "Samp", "GotMM"})); ui->scopeGUI->setStreams(QStringList({"IQ", "MagSq", "TH", "FM", "Data", "Samp", "GotMM", "GotM"}));
ui->scopeGUI->setSampleRate(RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE); ui->scopeGUI->setSampleRate(RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE);
ui->status->setText("Looking for minute marker"); ui->status->setText("Looking for minute marker");

Wyświetl plik

@ -34,7 +34,8 @@ struct RadioClockSettings
enum Modulation { enum Modulation {
MSF, MSF,
DCF77, DCF77,
TDF TDF,
WWVB
} m_modulation; } m_modulation;
enum DisplayTZ { enum DisplayTZ {
BROADCAST, BROADCAST,
@ -53,6 +54,7 @@ struct RadioClockSettings
uint16_t m_reverseAPIChannelIndex; uint16_t m_reverseAPIChannelIndex;
Serializable *m_scopeGUI; Serializable *m_scopeGUI;
static const int RADIOCLOCK_CHANNEL_SAMPLE_RATE = 1000; static const int RADIOCLOCK_CHANNEL_SAMPLE_RATE = 1000;
static const int m_scopeStreams = 8;
RadioClockSettings(); RadioClockSettings();
void resetToDefaults(); void resetToDefaults();
@ -60,6 +62,14 @@ struct RadioClockSettings
void setScopeGUI(Serializable *scopeGUI) { m_scopeGUI = scopeGUI; } void setScopeGUI(Serializable *scopeGUI) { m_scopeGUI = scopeGUI; }
QByteArray serialize() const; QByteArray serialize() const;
bool deserialize(const QByteArray& data); bool deserialize(const QByteArray& data);
enum DST {
UNKNOWN,
IN_EFFECT,
NOT_IN_EFFECT,
STARTING,
ENDING
}; // Daylight savings status
}; };
#endif /* INCLUDE_RADIOCLOCKSETTINGS_H */ #endif /* INCLUDE_RADIOCLOCKSETTINGS_H */