1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-08-14 15:33:34 -04:00

Web API: use message passing to start/stop device, applied to BladeRF output and file output

This commit is contained in:
f4exb
2017-12-14 00:38:22 +01:00
parent 53925bd4fd
commit db86bc5813
8 changed files with 110 additions and 36 deletions
@@ -30,6 +30,7 @@
#include "filesinkthread.h"
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgConfigureFileSink, Message)
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgStartStop, Message)
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgConfigureFileSinkName, Message)
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgConfigureFileSinkWork, Message)
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgConfigureFileSinkStreamTiming, Message)
@@ -159,6 +160,27 @@ bool FileSinkOutput::handleMessage(const Message& message)
openFileStream();
return true;
}
else if (MsgStartStop::match(message))
{
MsgStartStop& cmd = (MsgStartStop&) message;
qDebug() << "FileSinkOutput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
if (cmd.getStartStop())
{
if (m_deviceAPI->initGeneration())
{
m_deviceAPI->startGeneration();
DSPEngine::instance()->startAudioInput();
}
}
else
{
m_deviceAPI->stopGeneration();
DSPEngine::instance()->stopAudioInput();
}
return true;
}
else if (MsgConfigureFileSink::match(message))
{
qDebug() << "FileSinkOutput::handleMessage: MsgConfigureFileSink";