1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-10 10:33:29 -05:00

SDRdaemon plugin: report stream skew data on the GUI

This commit is contained in:
f4exb 2016-02-22 15:03:16 +01:00
parent bf78fa016e
commit aa709b9d5c
6 changed files with 87 additions and 16 deletions

View File

@ -67,6 +67,7 @@ public:
void writeData(char *array, uint32_t length); //!< Write data into buffer.
uint8_t *readDataChunk(); //!< Read a chunk of data from buffer
const MetaData& getCurrentMeta() const { return m_currentMeta; }
uint32_t getSampleRateStream() const { return m_sampleRateStream; }
uint32_t getSampleRate() const { return m_sampleRate; }
void updateBlockCounts(uint32_t nbBytesReceived);
bool isSync() const { return m_sync; }

View File

@ -37,6 +37,7 @@ SDRdaemonGui::SDRdaemonGui(PluginAPI* pluginAPI, QWidget* parent) :
m_sampleSource(NULL),
m_acquisition(false),
m_sampleRate(0),
m_sampleRateStream(0),
m_centerFrequency(0),
m_samplesCount(0),
m_tickCount(0),
@ -185,6 +186,7 @@ bool SDRdaemonGui::handleMessage(const Message& message)
}
else if (SDRdaemonInput::MsgReportSDRdaemonStreamData::match(message))
{
m_sampleRateStream = ((SDRdaemonInput::MsgReportSDRdaemonStreamData&)message).getSampleRateStream();
m_sampleRate = ((SDRdaemonInput::MsgReportSDRdaemonStreamData&)message).getSampleRate();
m_centerFrequency = ((SDRdaemonInput::MsgReportSDRdaemonStreamData&)message).getCenterFrequency();
m_startingTimeStamp.tv_sec = ((SDRdaemonInput::MsgReportSDRdaemonStreamData&)message).get_tv_sec();
@ -282,9 +284,14 @@ void SDRdaemonGui::updateWithAcquisition()
void SDRdaemonGui::updateWithStreamData()
{
ui->centerFrequency->setValue(m_centerFrequency / 1000);
QString s = QString::number(m_sampleRate/1000.0, 'f', 0);
ui->sampleRateText->setText(tr("%1k").arg(s));
updateWithStreamTime(); // TODO: remove when time data is implemented
QString s0 = QString::number(m_sampleRateStream/1000.0, 'f', 0);
ui->sampleRateStreamText->setText(tr("%1").arg(s0));
QString s1 = QString::number(m_sampleRate/1000.0, 'f', 3);
ui->sampleRateText->setText(tr("%1").arg(s1));
float skewPerCent = (float) ((m_sampleRate - m_sampleRateStream) * 100) / (float) m_sampleRateStream;
QString s2 = QString::number(skewPerCent, 'f', 2);
ui->skewRateText->setText(tr("%1").arg(s2));
updateWithStreamTime();
}
void SDRdaemonGui::updateWithStreamTime()

View File

@ -55,6 +55,7 @@ private:
SampleSource* m_sampleSource;
bool m_acquisition;
int m_sampleRate;
int m_sampleRateStream;
quint64 m_centerFrequency;
struct timeval m_startingTimeStamp;
int m_samplesCount;

View File

@ -113,14 +113,7 @@
<item>
<layout class="QHBoxLayout" name="rateTimeLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Rate: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="sampleRateText">
<widget class="QLabel" name="sampleRateStreamText">
<property name="minimumSize">
<size>
<width>50</width>
@ -133,10 +126,62 @@
</font>
</property>
<property name="toolTip">
<string>Record sample rate</string>
<string>Nominal sample rate from stream data (kS/s)</string>
</property>
<property name="text">
<string>0k</string>
<string>00000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="Line" name="sampleRateLine1">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="sampleRateText">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Actual sample rate (kS/s)</string>
</property>
<property name="text">
<string>0000.000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="Line" name="sampleRateLine2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="skewRateText">
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Sample rate skew from stream nominal rate (%)</string>
</property>
<property name="text">
<string>-00.00</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -214,6 +259,19 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>

View File

@ -134,24 +134,27 @@ public:
MESSAGE_CLASS_DECLARATION
public:
int getSampleRateStream() const { return m_sampleRateStream; }
int getSampleRate() const { return m_sampleRate; }
quint64 getCenterFrequency() const { return m_centerFrequency; }
uint32_t get_tv_sec() const { return m_tv_sec; }
uint32_t get_tv_usec() const { return m_tv_usec; }
static MsgReportSDRdaemonStreamData* create(int sampleRate, quint64 centerFrequency, uint32_t tv_sec, uint32_t tv_usec)
static MsgReportSDRdaemonStreamData* create(int sampleRateStream, int sampleRate, quint64 centerFrequency, uint32_t tv_sec, uint32_t tv_usec)
{
return new MsgReportSDRdaemonStreamData(sampleRate, centerFrequency, tv_sec, tv_usec);
return new MsgReportSDRdaemonStreamData(sampleRateStream, sampleRate, centerFrequency, tv_sec, tv_usec);
}
protected:
int m_sampleRateStream;
int m_sampleRate;
quint64 m_centerFrequency;
uint32_t m_tv_sec;
uint32_t m_tv_usec;
MsgReportSDRdaemonStreamData(int sampleRate, quint64 centerFrequency, uint32_t tv_sec, uint32_t tv_usec) :
MsgReportSDRdaemonStreamData(int sampleRateStream, int sampleRate, quint64 centerFrequency, uint32_t tv_sec, uint32_t tv_usec) :
Message(),
m_sampleRateStream(sampleRateStream),
m_sampleRate(sampleRate),
m_centerFrequency(centerFrequency),
m_tv_sec(tv_sec),

View File

@ -157,6 +157,7 @@ void SDRdaemonUDPHandler::processData()
DSPSignalNotification *notif = new DSPSignalNotification(m_samplerate, m_centerFrequency * 1000); // Frequency in Hz for the DSP engine
DSPEngine::instance()->getInputMessageQueue()->push(notif);
SDRdaemonInput::MsgReportSDRdaemonStreamData *report = SDRdaemonInput::MsgReportSDRdaemonStreamData::create(
m_sdrDaemonBuffer.getSampleRateStream(),
m_samplerate,
m_centerFrequency * 1000, // Frequency in Hz for the GUI
m_tv_sec,