mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-08-09 09:12:27 -04:00
Airspy input: moved FileRecord out of the GUI
This commit is contained in:
parent
464f356340
commit
f6058d2b12
@ -54,19 +54,11 @@ AirspyGui::AirspyGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
|||||||
m_rates = ((AirspyInput*) m_sampleSource)->getSampleRates();
|
m_rates = ((AirspyInput*) m_sampleSource)->getSampleRates();
|
||||||
displaySampleRates();
|
displaySampleRates();
|
||||||
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
AirspyGui::~AirspyGui()
|
AirspyGui::~AirspyGui()
|
||||||
{
|
{
|
||||||
m_deviceAPI->removeSink(m_fileSink);
|
|
||||||
delete m_fileSink;
|
|
||||||
delete m_sampleSource; // Valgrind memcheck
|
delete m_sampleSource; // Valgrind memcheck
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
@ -153,7 +145,6 @@ void AirspyGui::handleDSPMessages()
|
|||||||
m_deviceCenterFrequency = notif->getCenterFrequency();
|
m_deviceCenterFrequency = notif->getCenterFrequency();
|
||||||
qDebug("AirspyGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
qDebug("AirspyGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
||||||
updateSampleRateAndFrequency();
|
updateSampleRateAndFrequency();
|
||||||
m_fileSink->handleMessage(*notif); // forward to file sink
|
|
||||||
|
|
||||||
delete message;
|
delete message;
|
||||||
}
|
}
|
||||||
@ -365,16 +356,14 @@ void AirspyGui::on_startStop_toggled(bool checked)
|
|||||||
|
|
||||||
void AirspyGui::on_record_toggled(bool checked)
|
void AirspyGui::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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AirspyInput::MsgFileRecord* message = AirspyInput::MsgFileRecord::create(checked);
|
||||||
|
m_sampleSource->getInputMessageQueue()->push(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyGui::updateHardware()
|
void AirspyGui::updateHardware()
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#define AIRSPY_MAX_DEVICE (32)
|
#define AIRSPY_MAX_DEVICE (32)
|
||||||
|
|
||||||
class DeviceSourceAPI;
|
class DeviceSourceAPI;
|
||||||
class FileRecord;
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AirspyGui;
|
class AirspyGui;
|
||||||
@ -62,7 +61,6 @@ private:
|
|||||||
QTimer m_statusTimer;
|
QTimer m_statusTimer;
|
||||||
std::vector<uint32_t> m_rates;
|
std::vector<uint32_t> m_rates;
|
||||||
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;
|
||||||
|
@ -22,12 +22,14 @@
|
|||||||
#include "airspyinput.h"
|
#include "airspyinput.h"
|
||||||
|
|
||||||
#include <device/devicesourceapi.h>
|
#include <device/devicesourceapi.h>
|
||||||
|
#include <dsp/filerecord.h>
|
||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
#include "airspysettings.h"
|
#include "airspysettings.h"
|
||||||
#include "airspythread.h"
|
#include "airspythread.h"
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(AirspyInput::MsgConfigureAirspy, Message)
|
MESSAGE_CLASS_DEFINITION(AirspyInput::MsgConfigureAirspy, Message)
|
||||||
|
MESSAGE_CLASS_DEFINITION(AirspyInput::MsgFileRecord, Message)
|
||||||
//MESSAGE_CLASS_DEFINITION(AirspyInput::MsgReportAirspy, Message)
|
//MESSAGE_CLASS_DEFINITION(AirspyInput::MsgReportAirspy, Message)
|
||||||
|
|
||||||
AirspyInput::AirspyInput(DeviceSourceAPI *deviceAPI) :
|
AirspyInput::AirspyInput(DeviceSourceAPI *deviceAPI) :
|
||||||
@ -39,11 +41,18 @@ AirspyInput::AirspyInput(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);
|
||||||
}
|
}
|
||||||
|
|
||||||
AirspyInput::~AirspyInput()
|
AirspyInput::~AirspyInput()
|
||||||
{
|
{
|
||||||
if (m_running) stop();
|
if (m_running) stop();
|
||||||
|
m_deviceAPI->removeSink(m_fileSink);
|
||||||
|
delete m_fileSink;
|
||||||
closeDevice();
|
closeDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,6 +229,19 @@ bool AirspyInput::handleMessage(const Message& message)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (MsgFileRecord::match(message))
|
||||||
|
{
|
||||||
|
MsgFileRecord& conf = (MsgFileRecord&) message;
|
||||||
|
qDebug() << "RTLSDRInput::handleMessage: MsgFileRecord: " << conf.getStartStop();
|
||||||
|
|
||||||
|
if (conf.getStartStop()) {
|
||||||
|
m_fileSink->startRecording();
|
||||||
|
} else {
|
||||||
|
m_fileSink->stopRecording();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -479,6 +501,7 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
|||||||
int sampleRate = devSampleRate/(1<<m_settings.m_log2Decim);
|
int sampleRate = devSampleRate/(1<<m_settings.m_log2Decim);
|
||||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency);
|
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency);
|
||||||
m_deviceAPI->getDeviceInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceInputMessageQueue()->push(notif);
|
||||||
|
m_fileSink->handleMessage(*notif); // forward to file sink
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
class DeviceSourceAPI;
|
class DeviceSourceAPI;
|
||||||
class AirspyThread;
|
class AirspyThread;
|
||||||
|
class FileRecord;
|
||||||
|
|
||||||
class AirspyInput : public DeviceSampleSource {
|
class AirspyInput : public DeviceSampleSource {
|
||||||
public:
|
public:
|
||||||
@ -48,6 +49,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)
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
// class MsgReportAirspy : public Message {
|
// class MsgReportAirspy : public Message {
|
||||||
// MESSAGE_CLASS_DECLARATION
|
// MESSAGE_CLASS_DECLARATION
|
||||||
//
|
//
|
||||||
@ -96,6 +116,7 @@ private:
|
|||||||
QString m_deviceDescription;
|
QString m_deviceDescription;
|
||||||
std::vector<uint32_t> m_sampleRates;
|
std::vector<uint32_t> m_sampleRates;
|
||||||
bool m_running;
|
bool m_running;
|
||||||
|
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_AIRSPYINPUT_H
|
#endif // INCLUDE_AIRSPYINPUT_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user