mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 10:05:46 -05:00
SDRDaemon input: moved FileRecord out of the GUI
This commit is contained in:
parent
48503d3147
commit
6c25c939e7
@ -38,7 +38,6 @@
|
||||
#include "util/simpleserializer.h"
|
||||
|
||||
#include <device/devicesourceapi.h>
|
||||
#include <dsp/filerecord.h>
|
||||
#include "sdrdaemonsourcegui.h"
|
||||
|
||||
SDRdaemonSourceGui::SDRdaemonSourceGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
||||
@ -104,11 +103,6 @@ SDRdaemonSourceGui::SDRdaemonSourceGui(DeviceSourceAPI *deviceAPI, QWidget* pare
|
||||
|
||||
displaySettings();
|
||||
|
||||
char recFileNameCStr[30];
|
||||
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
|
||||
m_fileSink = new FileRecord(std::string(recFileNameCStr));
|
||||
m_deviceAPI->addSink(m_fileSink);
|
||||
|
||||
connect(m_deviceAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
||||
|
||||
m_eventsTime.start();
|
||||
@ -122,8 +116,6 @@ SDRdaemonSourceGui::SDRdaemonSourceGui(DeviceSourceAPI *deviceAPI, QWidget* pare
|
||||
|
||||
SDRdaemonSourceGui::~SDRdaemonSourceGui()
|
||||
{
|
||||
m_deviceAPI->removeSink(m_fileSink);
|
||||
delete m_fileSink;
|
||||
delete m_sampleSource;
|
||||
delete ui;
|
||||
}
|
||||
@ -273,7 +265,8 @@ void SDRdaemonSourceGui::handleDSPMessages()
|
||||
m_deviceCenterFrequency = notif->getCenterFrequency();
|
||||
qDebug("SDRdaemonGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
||||
updateSampleRateAndFrequency();
|
||||
m_fileSink->handleMessage(*notif); // forward to file sink
|
||||
DSPSignalNotification *fwd = new DSPSignalNotification(*notif);
|
||||
m_sampleSource->getInputMessageQueue()->push(fwd);
|
||||
|
||||
delete message;
|
||||
}
|
||||
@ -620,16 +613,14 @@ void SDRdaemonSourceGui::on_startStop_toggled(bool checked)
|
||||
|
||||
void SDRdaemonSourceGui::on_record_toggled(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
if (checked) {
|
||||
ui->record->setStyleSheet("QToolButton { background-color : red; }");
|
||||
m_fileSink->startRecording();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
m_fileSink->stopRecording();
|
||||
}
|
||||
|
||||
SDRdaemonSourceInput::MsgFileRecord* message = SDRdaemonSourceInput::MsgFileRecord::create(checked);
|
||||
m_sampleSource->getInputMessageQueue()->push(message);
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::on_eventCountsReset_clicked(bool checked __attribute__((unused)))
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "sdrdaemonsourceinput.h"
|
||||
|
||||
class DeviceSourceAPI;
|
||||
class FileRecord;
|
||||
|
||||
namespace Ui {
|
||||
class SDRdaemonSourceGui;
|
||||
@ -59,7 +58,6 @@ private:
|
||||
QTimer m_statusTimer;
|
||||
DeviceSampleSource* m_sampleSource;
|
||||
bool m_acquisition;
|
||||
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
||||
int m_deviceSampleRate;
|
||||
quint64 m_deviceCenterFrequency; //!< Center frequency in device
|
||||
int m_lastEngineState;
|
||||
|
@ -36,6 +36,7 @@ MESSAGE_CLASS_DEFINITION(SDRdaemonSourceInput::MsgConfigureSDRdaemonStreamTiming
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonSourceInput::MsgReportSDRdaemonAcquisition, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonSourceInput::MsgFileRecord, Message)
|
||||
|
||||
SDRdaemonSourceInput::SDRdaemonSourceInput(const QTimer& masterTimer, DeviceSourceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
@ -53,11 +54,18 @@ SDRdaemonSourceInput::SDRdaemonSourceInput(const QTimer& masterTimer, DeviceSour
|
||||
m_sampleFifo.setSize(96000 * 4);
|
||||
m_SDRdaemonUDPHandler = new SDRdaemonSourceUDPHandler(&m_sampleFifo, getOutputMessageQueueToGUI(), m_deviceAPI);
|
||||
m_SDRdaemonUDPHandler->connectTimer(&m_masterTimer);
|
||||
|
||||
char recFileNameCStr[30];
|
||||
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
|
||||
m_fileSink = new FileRecord(std::string(recFileNameCStr));
|
||||
m_deviceAPI->addSink(m_fileSink);
|
||||
}
|
||||
|
||||
SDRdaemonSourceInput::~SDRdaemonSourceInput()
|
||||
{
|
||||
stop();
|
||||
m_deviceAPI->removeSink(m_fileSink);
|
||||
delete m_fileSink;
|
||||
delete m_SDRdaemonUDPHandler;
|
||||
}
|
||||
|
||||
@ -106,7 +114,25 @@ void SDRdaemonSourceInput::getRemoteAddress(QString &s)
|
||||
|
||||
bool SDRdaemonSourceInput::handleMessage(const Message& message)
|
||||
{
|
||||
if (MsgConfigureSDRdaemonSource::match(message))
|
||||
if (DSPSignalNotification::match(message))
|
||||
{
|
||||
DSPSignalNotification& notif = (DSPSignalNotification&) message;
|
||||
return m_fileSink->handleMessage(notif); // forward to file sink
|
||||
}
|
||||
else if (MsgFileRecord::match(message))
|
||||
{
|
||||
MsgFileRecord& conf = (MsgFileRecord&) message;
|
||||
qDebug() << "SDRdaemonSourceInput::handleMessage: MsgFileRecord: " << conf.getStartStop();
|
||||
|
||||
if (conf.getStartStop()) {
|
||||
m_fileSink->startRecording();
|
||||
} else {
|
||||
m_fileSink->stopRecording();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MsgConfigureSDRdaemonSource::match(message))
|
||||
{
|
||||
qDebug() << "SDRdaemonSourceInput::handleMessage:" << message.getIdentifier();
|
||||
//SDRdaemonSourceInput& conf = (MsgConfigureSDRdaemonFEC&) message;
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
class DeviceSourceAPI;
|
||||
class SDRdaemonSourceUDPHandler;
|
||||
class FileRecord;
|
||||
|
||||
class SDRdaemonSourceInput : public DeviceSampleSource {
|
||||
public:
|
||||
@ -283,6 +284,25 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgFileRecord : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
bool getStartStop() const { return m_startStop; }
|
||||
|
||||
static MsgFileRecord* create(bool startStop) {
|
||||
return new MsgFileRecord(startStop);
|
||||
}
|
||||
|
||||
protected:
|
||||
bool m_startStop;
|
||||
|
||||
MsgFileRecord(bool startStop) :
|
||||
Message(),
|
||||
m_startStop(startStop)
|
||||
{ }
|
||||
};
|
||||
|
||||
SDRdaemonSourceInput(const QTimer& masterTimer, DeviceSourceAPI *deviceAPI);
|
||||
virtual ~SDRdaemonSourceInput();
|
||||
|
||||
@ -310,6 +330,7 @@ private:
|
||||
const QTimer& m_masterTimer;
|
||||
bool m_autoFollowRate;
|
||||
bool m_autoCorrBuffer;
|
||||
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
||||
};
|
||||
|
||||
#endif // INCLUDE_SDRDAEMONSOURCEINPUT_H
|
||||
|
Loading…
Reference in New Issue
Block a user