1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-07 08:24:43 -04:00

Removed file recording function from device plugins

This commit is contained in:
f4exb
2020-08-08 11:53:56 +02:00
parent fdae0b18c3
commit fddc5a66e8
241 changed files with 42 additions and 4617 deletions
@@ -95,11 +95,6 @@ Device start / stop button.
- Green square icon: device is running and can be stopped
- Magenta (or pink) square icon: an error occurred. In the case the device was accidentally disconnected you may click on the icon, plug back in and start again. Check the console log for possible errors.
<h4>1.3: Record</h4>
- Left click: record baseband I/Q stream toggle button
- Right click: choose record file
<h4>1.4: Stream sample rate</h4>
Baseband I/Q sample rate in kS/s. This is the device sample rate (the "SR" SoapySDR control) divided by the decimation factor (4).
@@ -25,13 +25,10 @@
#include "SWGSoapySDRInputSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGSoapySDRReport.h"
#include "SWGSoapySDRInputActions.h"
#include "device/deviceapi.h"
#include "dsp/dspcommands.h"
#include "dsp/filerecord.h"
#include "dsp/dspengine.h"
#include "soapysdr/devicesoapysdr.h"
@@ -39,13 +36,11 @@
#include "soapysdrinput.h"
MESSAGE_CLASS_DEFINITION(SoapySDRInput::MsgConfigureSoapySDRInput, Message)
MESSAGE_CLASS_DEFINITION(SoapySDRInput::MsgFileRecord, Message)
MESSAGE_CLASS_DEFINITION(SoapySDRInput::MsgStartStop, Message)
MESSAGE_CLASS_DEFINITION(SoapySDRInput::MsgReportGainChange, Message)
SoapySDRInput::SoapySDRInput(DeviceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_fileSink(nullptr),
m_settings(),
m_deviceDescription("SoapySDRInput"),
m_running(false),
@@ -72,12 +67,6 @@ SoapySDRInput::~SoapySDRInput()
stop();
}
if (m_fileSink)
{
m_deviceAPI->removeAncillarySink(m_fileSink);
delete m_fileSink;
}
closeDevice();
}
@@ -799,38 +788,6 @@ bool SoapySDRInput::handleMessage(const Message& message)
return true;
}
else if (MsgFileRecord::match(message))
{
MsgFileRecord& conf = (MsgFileRecord&) message;
qDebug() << "SoapySDRInput::handleMessage: MsgFileRecord: " << conf.getStartStop();
if (conf.getStartStop())
{
if (m_fileSink)
{
m_deviceAPI->removeAncillarySink(m_fileSink);
delete m_fileSink;
}
if (m_settings.m_fileRecordName.size() != 0) {
m_fileSink = new FileRecord(m_settings.m_fileRecordName);
} else {
m_fileSink = new FileRecord(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID()));
}
m_deviceAPI->addAncillarySink(m_fileSink);
m_fileSink->startRecording();
}
else
{
m_fileSink->stopRecording();
m_deviceAPI->removeAncillarySink(m_fileSink);
delete m_fileSink;
m_fileSink = nullptr;
}
return true;
}
else if (MsgStartStop::match(message))
{
MsgStartStop& cmd = (MsgStartStop&) message;
@@ -1294,11 +1251,6 @@ bool SoapySDRInput::applySettings(const SoapySDRInputSettings& settings, bool fo
{
int sampleRate = settings.m_devSampleRate/(1<<settings.m_log2Decim);
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, settings.m_centerFrequency);
if (m_fileSink) {
m_fileSink->handleMessage(*notif); // forward to file sink
}
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
}
@@ -1508,9 +1460,6 @@ void SoapySDRInput::webapiUpdateDeviceSettings(
if (deviceSettingsKeys.contains("transverterMode")) {
settings.m_transverterMode = response.getSoapySdrInputSettings()->getTransverterMode() != 0;
}
if (deviceSettingsKeys.contains("fileRecordName")) {
settings.m_fileRecordName = *response.getSoapySdrInputSettings()->getFileRecordName();
}
if (deviceSettingsKeys.contains("antenna")) {
settings.m_antenna = *response.getSoapySdrInputSettings()->getAntenna();
}
@@ -1664,37 +1613,6 @@ int SoapySDRInput::webapiRun(
return 200;
}
int SoapySDRInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGSoapySDRInputActions *swgSoapySDRInputActions = query.getSoapySdrInputActions();
if (swgSoapySDRInputActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgSoapySDRInputActions->getRecord() != 0;
MsgFileRecord *msg = MsgFileRecord::create(record);
getInputMessageQueue()->push(msg);
if (getMessageQueueToGUI())
{
MsgFileRecord *msgToGUI = MsgFileRecord::create(record);
getMessageQueueToGUI()->push(msgToGUI);
}
}
return 202;
}
else
{
errorMessage = "Missing SoapySDRInputActions in query";
return 400;
}
}
void SoapySDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const SoapySDRInputSettings& settings)
{
response.getSoapySdrInputSettings()->setCenterFrequency(settings.m_centerFrequency);
@@ -1708,12 +1626,6 @@ void SoapySDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& r
response.getSoapySdrInputSettings()->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency);
response.getSoapySdrInputSettings()->setTransverterMode(settings.m_transverterMode ? 1 : 0);
if (response.getSoapySdrInputSettings()->getFileRecordName()) {
*response.getSoapySdrInputSettings()->getFileRecordName() = settings.m_fileRecordName;
} else {
response.getSoapySdrInputSettings()->setFileRecordName(new QString(settings.m_fileRecordName));
}
if (response.getSoapySdrInputSettings()->getAntenna()) {
*response.getSoapySdrInputSettings()->getAntenna() = settings.m_antenna;
} else {
@@ -2041,9 +1953,6 @@ void SoapySDRInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys
if (deviceSettingsKeys.contains("transverterMode") || force) {
swgSoapySDRInputSettings->setTransverterMode(settings.m_transverterMode ? 1 : 0);
}
if (deviceSettingsKeys.contains("fileRecordName") || force) {
swgSoapySDRInputSettings->setFileRecordName(new QString(settings.m_fileRecordName));
}
if (deviceSettingsKeys.contains("antenna") || force) {
swgSoapySDRInputSettings->setAntenna(new QString(settings.m_antenna));
}
@@ -33,7 +33,6 @@ class QNetworkAccessManager;
class QNetworkReply;
class DeviceAPI;
class SoapySDRInputThread;
class FileRecord;
namespace SoapySDR
{
@@ -74,25 +73,6 @@ 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 MsgStartStop : public Message {
MESSAGE_CLASS_DECLARATION
@@ -203,11 +183,6 @@ public:
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage);
virtual int webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& actions,
QString& errorMessage);
static void webapiFormatDeviceSettings(
SWGSDRangel::SWGDeviceSettings& response,
const SoapySDRInputSettings& settings);
@@ -225,7 +200,6 @@ private:
bool m_running;
SoapySDRInputThread *m_thread;
DeviceSoapySDRShared m_deviceShared;
FileRecord *m_fileSink; //!< File sink to record device I/Q output
QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest;
@@ -95,9 +95,6 @@ SoapySDRInputGui::SoapySDRInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
CRightClickEnabler *startStopRightClickEnabler = new CRightClickEnabler(ui->startStop);
connect(startStopRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &)));
CRightClickEnabler *fileRecordRightClickEnabler = new CRightClickEnabler(ui->record);
connect(fileRecordRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openFileRecordDialog(const QPoint &)));
displaySettings();
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
@@ -516,23 +513,6 @@ bool SoapySDRInputGui::handleMessage(const Message& message)
return true;
}
else if (SoapySDRInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const SoapySDRInput::MsgFileRecord& notif = (const SoapySDRInput::MsgFileRecord&) message;
bool record = notif.getStartStop();
ui->record->blockSignals(true);
ui->record->setChecked(record);
if (record) {
ui->record->setStyleSheet("QToolButton { background-color : red; }");
} else {
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
}
ui->record->blockSignals(false);
return true;
}
else
{
return false;
@@ -732,18 +712,6 @@ void SoapySDRInputGui::on_startStop_toggled(bool checked)
}
}
void SoapySDRInputGui::on_record_toggled(bool checked)
{
if (checked) {
ui->record->setStyleSheet("QToolButton { background-color : red; }");
} else {
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
}
SoapySDRInput::MsgFileRecord* message = SoapySDRInput::MsgFileRecord::create(checked);
m_sampleSource->getInputMessageQueue()->push(message);
}
void SoapySDRInputGui::displaySettings()
{
blockApplySettings(true);
@@ -978,29 +946,3 @@ void SoapySDRInputGui::openDeviceSettingsDialog(const QPoint& p)
sendSettings();
}
void SoapySDRInputGui::openFileRecordDialog(const QPoint& p)
{
QFileDialog fileDialog(
this,
tr("Save I/Q record file"),
m_settings.m_fileRecordName,
tr("SDR I/Q Files (*.sdriq)")
);
fileDialog.setOptions(QFileDialog::DontUseNativeDialog);
fileDialog.setFileMode(QFileDialog::AnyFile);
fileDialog.move(p);
QStringList fileNames;
if (fileDialog.exec())
{
fileNames = fileDialog.selectedFiles();
if (fileNames.size() > 0)
{
m_settings.m_fileRecordName = fileNames.at(0);
sendSettings();
}
}
}
@@ -137,11 +137,9 @@ private slots:
void on_fcPos_currentIndexChanged(int index);
void on_transverter_clicked();
void on_startStop_toggled(bool checked);
void on_record_toggled(bool checked);
void updateHardware();
void updateStatus();
void openDeviceSettingsDialog(const QPoint& p);
void openFileRecordDialog(const QPoint& p);
};
@@ -65,20 +65,6 @@
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="record">
<property name="toolTip">
<string>Left: toggle record I/Q samples from device - Right: select output file</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/record_off.png</normaloff>:/record_off.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
@@ -32,7 +32,7 @@
const PluginDescriptor SoapySDRInputPlugin::m_pluginDescriptor = {
QString("SoapySDR"),
QString("SoapySDR Input"),
QString("4.14.5"),
QString("4.15.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@@ -38,7 +38,6 @@ void SoapySDRInputSettings::resetToDefaults()
m_transverterMode = false;
m_transverterDeltaFrequency = 0;
m_iqOrder = true;
m_fileRecordName = "";
m_antenna = "NONE";
m_bandwidth = 1000000;
m_globalGain = 0;
@@ -40,7 +40,6 @@ struct SoapySDRInputSettings {
bool m_transverterMode;
qint64 m_transverterDeltaFrequency;
bool m_iqOrder;
QString m_fileRecordName;
QString m_antenna;
quint32 m_bandwidth;
QMap<QString, double> m_tunableElements;