mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-15 12:51:49 -05:00
FCDPro input: moved FileRecord out of the GUI
This commit is contained in:
parent
8e9305c262
commit
622ac93250
@ -24,7 +24,6 @@
|
|||||||
#include "fcdprogui.h"
|
#include "fcdprogui.h"
|
||||||
|
|
||||||
#include <device/devicesourceapi.h>
|
#include <device/devicesourceapi.h>
|
||||||
#include <dsp/filerecord.h>
|
|
||||||
#include "fcdproconst.h"
|
#include "fcdproconst.h"
|
||||||
|
|
||||||
FCDProGui::FCDProGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
FCDProGui::FCDProGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
||||||
@ -144,18 +143,11 @@ FCDProGui::FCDProGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
|||||||
|
|
||||||
displaySettings();
|
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);
|
connect(m_deviceAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
FCDProGui::~FCDProGui()
|
FCDProGui::~FCDProGui()
|
||||||
{
|
{
|
||||||
m_deviceAPI->removeSink(m_fileSink);
|
|
||||||
delete m_fileSink;
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +225,6 @@ void FCDProGui::handleDSPMessages()
|
|||||||
m_deviceCenterFrequency = notif->getCenterFrequency();
|
m_deviceCenterFrequency = notif->getCenterFrequency();
|
||||||
qDebug("FCDProGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
qDebug("FCDProGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
||||||
updateSampleRateAndFrequency();
|
updateSampleRateAndFrequency();
|
||||||
m_fileSink->handleMessage(*notif); // forward to file sink
|
|
||||||
|
|
||||||
delete message;
|
delete message;
|
||||||
}
|
}
|
||||||
@ -440,16 +431,14 @@ void FCDProGui::on_startStop_toggled(bool checked)
|
|||||||
|
|
||||||
void FCDProGui::on_record_toggled(bool checked)
|
void FCDProGui::on_record_toggled(bool checked)
|
||||||
{
|
{
|
||||||
if (checked)
|
if (checked) {
|
||||||
{
|
|
||||||
ui->record->setStyleSheet("QToolButton { background-color : red; }");
|
ui->record->setStyleSheet("QToolButton { background-color : red; }");
|
||||||
m_fileSink->startRecording();
|
} else {
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||||
m_fileSink->stopRecording();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FCDProInput::MsgFileRecord* message = FCDProInput::MsgFileRecord::create(checked);
|
||||||
|
m_sampleSource->getInputMessageQueue()->push(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FCDProGui::updateStatus()
|
void FCDProGui::updateStatus()
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "fcdproinput.h"
|
#include "fcdproinput.h"
|
||||||
|
|
||||||
class DeviceSourceAPI;
|
class DeviceSourceAPI;
|
||||||
class FileRecord;
|
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@ -59,7 +58,6 @@ private:
|
|||||||
QTimer m_statusTimer;
|
QTimer m_statusTimer;
|
||||||
std::vector<int> m_gains;
|
std::vector<int> m_gains;
|
||||||
DeviceSampleSource* m_sampleSource;
|
DeviceSampleSource* m_sampleSource;
|
||||||
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
|
||||||
int m_sampleRate;
|
int m_sampleRate;
|
||||||
quint64 m_deviceCenterFrequency; //!< Center frequency in device
|
quint64 m_deviceCenterFrequency; //!< Center frequency in device
|
||||||
int m_lastEngineState;
|
int m_lastEngineState;
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
|
#include "dsp/filerecord.h"
|
||||||
#include "fcdproinput.h"
|
#include "fcdproinput.h"
|
||||||
|
|
||||||
#include <device/devicesourceapi.h>
|
#include <device/devicesourceapi.h>
|
||||||
@ -33,6 +34,7 @@
|
|||||||
#include "fcdproconst.h"
|
#include "fcdproconst.h"
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(FCDProInput::MsgConfigureFCD, Message)
|
MESSAGE_CLASS_DEFINITION(FCDProInput::MsgConfigureFCD, Message)
|
||||||
|
MESSAGE_CLASS_DEFINITION(FCDProInput::MsgFileRecord, Message)
|
||||||
|
|
||||||
FCDProInput::FCDProInput(DeviceSourceAPI *deviceAPI) :
|
FCDProInput::FCDProInput(DeviceSourceAPI *deviceAPI) :
|
||||||
m_deviceAPI(deviceAPI),
|
m_deviceAPI(deviceAPI),
|
||||||
@ -43,11 +45,18 @@ FCDProInput::FCDProInput(DeviceSourceAPI *deviceAPI) :
|
|||||||
m_running(false)
|
m_running(false)
|
||||||
{
|
{
|
||||||
openDevice();
|
openDevice();
|
||||||
|
|
||||||
|
char recFileNameCStr[30];
|
||||||
|
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
|
||||||
|
m_fileSink = new FileRecord(std::string(recFileNameCStr));
|
||||||
|
m_deviceAPI->addSink(m_fileSink);
|
||||||
}
|
}
|
||||||
|
|
||||||
FCDProInput::~FCDProInput()
|
FCDProInput::~FCDProInput()
|
||||||
{
|
{
|
||||||
if (m_running) stop();
|
if (m_running) stop();
|
||||||
|
m_deviceAPI->removeSink(m_fileSink);
|
||||||
|
delete m_fileSink;
|
||||||
closeDevice();
|
closeDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,6 +173,19 @@ bool FCDProInput::handleMessage(const Message& message)
|
|||||||
applySettings(conf.getSettings(), false);
|
applySettings(conf.getSettings(), false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (MsgFileRecord::match(message))
|
||||||
|
{
|
||||||
|
MsgFileRecord& conf = (MsgFileRecord&) message;
|
||||||
|
qDebug() << "FCDProInput::handleMessage: MsgFileRecord: " << conf.getStartStop();
|
||||||
|
|
||||||
|
if (conf.getStartStop()) {
|
||||||
|
m_fileSink->startRecording();
|
||||||
|
} else {
|
||||||
|
m_fileSink->stopRecording();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -373,6 +395,7 @@ void FCDProInput::applySettings(const FCDProSettings& settings, bool force)
|
|||||||
{
|
{
|
||||||
DSPSignalNotification *notif = new DSPSignalNotification(fcd_traits<Pro>::sampleRate, m_settings.m_centerFrequency);
|
DSPSignalNotification *notif = new DSPSignalNotification(fcd_traits<Pro>::sampleRate, m_settings.m_centerFrequency);
|
||||||
m_deviceAPI->getDeviceInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceInputMessageQueue()->push(notif);
|
||||||
|
m_fileSink->handleMessage(*notif); // forward to file sink
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ struct fcd_buffer {
|
|||||||
|
|
||||||
class DeviceSourceAPI;
|
class DeviceSourceAPI;
|
||||||
class FCDProThread;
|
class FCDProThread;
|
||||||
|
class FileRecord;
|
||||||
|
|
||||||
class FCDProInput : public DeviceSampleSource {
|
class FCDProInput : public DeviceSampleSource {
|
||||||
public:
|
public:
|
||||||
@ -55,6 +56,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)
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
FCDProInput(DeviceSourceAPI *deviceAPI);
|
FCDProInput(DeviceSourceAPI *deviceAPI);
|
||||||
virtual ~FCDProInput();
|
virtual ~FCDProInput();
|
||||||
|
|
||||||
@ -99,6 +119,7 @@ private:
|
|||||||
FCDProThread* m_FCDThread;
|
FCDProThread* m_FCDThread;
|
||||||
QString m_deviceDescription;
|
QString m_deviceDescription;
|
||||||
bool m_running;
|
bool m_running;
|
||||||
|
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_FCDPROINPUT_H
|
#endif // INCLUDE_FCDPROINPUT_H
|
||||||
|
Loading…
Reference in New Issue
Block a user