1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Tx ph.1: Fixes to file sink GUI and some debug messages

This commit is contained in:
f4exb 2016-10-23 02:22:00 +02:00
parent 8f8f4c2d96
commit 119127fdab
6 changed files with 52 additions and 26 deletions

View File

@ -40,6 +40,7 @@ FileSinkGui::FileSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
m_deviceAPI(deviceAPI),
m_settings(),
m_deviceSampleSink(0),
m_sampleRate(0),
m_generation(false),
m_fileName("./test.sdriq"),
m_startingTimeStamp(0),
@ -59,14 +60,16 @@ FileSinkGui::FileSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
}
connect(&(m_deviceAPI->getMainWindow()->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
m_statusTimer.start(500);
displaySettings();
m_deviceSampleSink = new FileSinkOutput(m_deviceAPI, m_deviceAPI->getMainWindow()->getMasterTimer());
connect(m_deviceSampleSink->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSinkMessages()));
m_deviceAPI->setSink(m_deviceSampleSink);
connect(m_deviceAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
}
FileSinkGui::~FileSinkGui()
@ -145,19 +148,32 @@ bool FileSinkGui::handleMessage(const Message& message)
}
}
void FileSinkGui::handleSinkMessages()
void FileSinkGui::handleDSPMessages()
{
Message* message;
Message* message;
while ((message = m_deviceSampleSink->getOutputMessageQueueToGUI()->pop()) != 0)
{
//qDebug("FileSourceGui::handleSourceMessages: message: %s", message->getIdentifier());
while ((message = m_deviceAPI->getDeviceOutputMessageQueue()->pop()) != 0)
{
qDebug("FileSinkGui::handleDSPMessages: message: %s", message->getIdentifier());
if (handleMessage(*message))
{
delete message;
}
}
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
qDebug("FileSinkGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
updateSampleRateAndFrequency();
delete message;
}
}
}
void FileSinkGui::updateSampleRateAndFrequency()
{
m_deviceAPI->getSpectrum()->setSampleRate(m_sampleRate);
m_deviceAPI->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
ui->deviceRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000));
}
void FileSinkGui::displaySettings()
@ -169,8 +185,17 @@ void FileSinkGui::displaySettings()
void FileSinkGui::sendSettings()
{
if(!m_updateTimer.isActive())
m_updateTimer.start(100);
}
void FileSinkGui::updateHardware()
{
qDebug() << "FileSinkGui::updateHardware";
FileSinkOutput::MsgConfigureFileSink* message = FileSinkOutput::MsgConfigureFileSink::create(m_settings);
m_deviceSampleSink->getInputMessageQueue()->push(message);
m_updateTimer.stop();
}
void FileSinkGui::updateStatus()

View File

@ -55,9 +55,12 @@ private:
DeviceSinkAPI* m_deviceAPI;
FileSinkSettings m_settings;
QString m_fileName;
QTimer m_statusTimer;
QTimer m_updateTimer;
QTimer m_statusTimer;
std::vector<int> m_gains;
DeviceSampleSink* m_deviceSampleSink;
int m_sampleRate;
quint64 m_deviceCenterFrequency; //!< Center frequency in device
bool m_generation;
std::time_t m_startingTimeStamp;
int m_samplesCount;
@ -70,13 +73,15 @@ private:
void configureFileName();
void updateWithGeneration();
void updateWithStreamTime();
void updateSampleRateAndFrequency();
private slots:
void handleSinkMessages();
void handleDSPMessages();
void on_centerFrequency_changed(quint64 value);
void on_startStop_toggled(bool checked);
void on_showFileDialog_clicked(bool checked);
void on_sampleRate_currentIndexChanged(int index);
void updateHardware();
void updateStatus();
void tick();
};

View File

@ -47,7 +47,7 @@
<item>
<widget class="ButtonSwitch" name="startStop">
<property name="toolTip">
<string>start/stop acquisition</string>
<string>start/stop generation</string>
</property>
<property name="text">
<string/>
@ -55,7 +55,7 @@
<property name="icon">
<iconset resource="../../../sdrbase/resources/res.qrc">
<normaloff>:/record_off.png</normaloff>
<normalon>:/record_on.png</normalon>:/record_off.png</iconset>
<normalon>:/stop.png</normalon>:/record_off.png</iconset>
</property>
</widget>
</item>

View File

@ -154,6 +154,7 @@ bool FileSinkOutput::handleMessage(const Message& message)
}
else if (MsgConfigureFileSink::match(message))
{
qDebug() << "FileSinkOutput::handleMessage: MsgConfigureFileSink";
MsgConfigureFileSink& conf = (MsgConfigureFileSink&) message;
applySettings(conf.getSettings(), false);
return true;
@ -214,6 +215,9 @@ void FileSinkOutput::applySettings(const FileSinkSettings& settings, bool force)
if (forwardChange)
{
qDebug("FileSinkOutput::applySettings: forward: m_centerFrequency: %llu m_sampleRate: %d",
m_settings.m_centerFrequency,
m_settings.m_sampleRate);
DSPSignalNotification *notif = new DSPSignalNotification(m_settings.m_sampleRate, m_settings.m_centerFrequency);
m_deviceAPI->getDeviceInputMessageQueue()->push(notif);
}

View File

@ -416,7 +416,7 @@ void DSPDeviceSinkEngine::handleData()
void DSPDeviceSinkEngine::handleSynchronousMessages()
{
Message *message = m_syncMessenger.getMessage();
qDebug() << "DSPDeviceSourceEngine::handleSynchronousMessages: " << message->getIdentifier();
qDebug() << "DSPDeviceSinkEngine::handleSynchronousMessages: " << message->getIdentifier();
if (DSPExit::match(*message))
{
@ -520,7 +520,7 @@ void DSPDeviceSinkEngine::handleInputMessages()
qDebug() << "DSPDeviceSinkEngine::handleInputMessages: DSPSignalNotification(" << m_sampleRate << "," << m_centerFrequency << ")";
// forward source changes to sources with immediate execution
// forward source changes to sources with immediate execution
for(BasebandSampleSources::const_iterator it = m_basebandSampleSources.begin(); it != m_basebandSampleSources.end(); it++)
{
@ -534,14 +534,6 @@ void DSPDeviceSinkEngine::handleInputMessages()
(*it)->handleSourceMessage(*message);
}
// forward source changes to sinks with immediate execution
for(BasebandSampleSinks::const_iterator it = m_basebandSampleSinks.begin(); it != m_basebandSampleSinks.end(); it++)
{
qDebug() << "DSPDeviceSourceEngine::handleInputMessages: forward message to " << (*it)->objectName().toStdString().c_str();
(*it)->handleMessage(*message);
}
// forward changes to listeners on DSP output queue
DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the output queue

View File

@ -164,7 +164,7 @@ void UpChannelizer::applyConfiguration()
qDebug() << "UpChannelizer::applyConfiguration in=" << m_outputSampleRate
<< ", req=" << m_requestedInputSampleRate
<< ", out=" << m_requestedInputSampleRate
<< ", out=" << m_currentInputSampleRate
<< ", fc=" << m_currentCenterFrequency;
if (m_sampleSource != 0)