mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-07-11 13:24:19 -04:00
Web API: use message passing to start/stop device, applied to BladeRF output and file output
This commit is contained in:
@@ -39,6 +39,7 @@ FileSinkGui::FileSinkGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::FileSinkGui),
|
||||
m_deviceUISet(deviceUISet),
|
||||
m_doApplySettings(true),
|
||||
m_forceSettings(true),
|
||||
m_settings(),
|
||||
m_fileName("./test.sdriq"),
|
||||
@@ -142,6 +143,14 @@ bool FileSinkGui::handleMessage(const Message& message)
|
||||
updateWithStreamTime();
|
||||
return true;
|
||||
}
|
||||
else if (FileSinkOutput::MsgStartStop::match(message))
|
||||
{
|
||||
FileSinkOutput::MsgStartStop& notif = (FileSinkOutput::MsgStartStop&) message;
|
||||
blockApplySettings(true);
|
||||
ui->startStop->setChecked(notif.getStartStop());
|
||||
blockApplySettings(false);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
@@ -259,22 +268,10 @@ void FileSinkGui::on_interp_currentIndexChanged(int index)
|
||||
|
||||
void FileSinkGui::on_startStop_toggled(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
if (m_deviceUISet->m_deviceSinkAPI->initGeneration())
|
||||
{
|
||||
if (!m_deviceUISet->m_deviceSinkAPI->startGeneration())
|
||||
{
|
||||
qDebug("FileSinkGui::on_startStop_toggled: device start failed");
|
||||
}
|
||||
|
||||
DSPEngine::instance()->startAudioInput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceUISet->m_deviceSinkAPI->stopGeneration();
|
||||
DSPEngine::instance()->stopAudioInput();
|
||||
FileSinkOutput::MsgStartStop *message = FileSinkOutput::MsgStartStop::create(checked);
|
||||
m_deviceSampleSink->getInputMessageQueue()->push(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user