1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-08-14 15:33:34 -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
@@ -77,9 +77,6 @@ SDRPlayGui::SDRPlayGui(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);
@@ -193,23 +190,6 @@ bool SDRPlayGui::handleMessage(const Message& message)
return true;
}
else if (SDRPlayInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const SDRPlayInput::MsgFileRecord& notif = (const SDRPlayInput::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;
@@ -487,18 +467,6 @@ void SDRPlayGui::on_startStop_toggled(bool checked)
}
}
void SDRPlayGui::on_record_toggled(bool checked)
{
if (checked) {
ui->record->setStyleSheet("QToolButton { background-color : red; }");
} else {
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
}
SDRPlayInput::MsgFileRecord* message = SDRPlayInput::MsgFileRecord::create(checked);
m_sampleSource->getInputMessageQueue()->push(message);
}
void SDRPlayGui::openDeviceSettingsDialog(const QPoint& p)
{
BasicDeviceSettingsDialog dialog(this);
@@ -517,29 +485,3 @@ void SDRPlayGui::openDeviceSettingsDialog(const QPoint& p)
sendSettings();
}
void SDRPlayGui::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();
}
}
}
@@ -94,9 +94,7 @@ private slots:
void on_gainMixer_toggled(bool checked);
void on_gainBaseband_valueChanged(int value);
void on_startStop_toggled(bool checked);
void on_record_toggled(bool checked);
void openDeviceSettingsDialog(const QPoint& p);
void openFileRecordDialog(const QPoint& p);
};
#endif /* PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYGUI_H_ */
@@ -71,21 +71,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>
<normalon>:/record_on.png</normalon>:/record_off.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
@@ -25,14 +25,11 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGSDRPlayReport.h"
#include "SWGSDRPlayActions.h"
#include "util/simpleserializer.h"
#include "dsp/dspcommands.h"
#include "dsp/dspengine.h"
#include <dsp/filerecord.h>
#include "sdrplayinput.h"
#include <device/deviceapi.h>
@@ -41,12 +38,10 @@
MESSAGE_CLASS_DEFINITION(SDRPlayInput::MsgConfigureSDRPlay, Message)
MESSAGE_CLASS_DEFINITION(SDRPlayInput::MsgReportSDRPlayGains, Message)
MESSAGE_CLASS_DEFINITION(SDRPlayInput::MsgFileRecord, Message)
MESSAGE_CLASS_DEFINITION(SDRPlayInput::MsgStartStop, Message)
SDRPlayInput::SDRPlayInput(DeviceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_fileSink(nullptr),
m_variant(SDRPlayUndef),
m_settings(),
m_dev(0),
@@ -71,12 +66,6 @@ SDRPlayInput::~SDRPlayInput()
stop();
}
if (m_fileSink)
{
m_deviceAPI->removeAncillarySink(m_fileSink);
delete m_fileSink;
}
closeDevice();
}
@@ -314,38 +303,6 @@ bool SDRPlayInput::handleMessage(const Message& message)
return true;
}
else if (MsgFileRecord::match(message))
{
MsgFileRecord& conf = (MsgFileRecord&) message;
qDebug() << "SDRPlayInput::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;
@@ -638,11 +595,6 @@ bool SDRPlayInput::applySettings(const SDRPlaySettings& settings, bool forwardCh
{
int sampleRate = getSampleRate();
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency);
if (m_fileSink) {
m_fileSink->handleMessage(*notif); // forward to file sink
}
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
}
@@ -730,37 +682,6 @@ int SDRPlayInput::webapiSettingsPutPatch(
return 200;
}
int SDRPlayInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGSDRPlayActions *swgSDRPlayActions = query.getSdrPlayActions();
if (swgSDRPlayActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgSDRPlayActions->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 SDRPlayActions in query";
return 400;
}
}
void SDRPlayInput::webapiUpdateDeviceSettings(
SDRPlaySettings& settings,
const QStringList& deviceSettingsKeys,
@@ -817,9 +738,6 @@ void SDRPlayInput::webapiUpdateDeviceSettings(
if (deviceSettingsKeys.contains("basebandGain")) {
settings.m_basebandGain = response.getSdrPlaySettings()->getBasebandGain();
}
if (deviceSettingsKeys.contains("fileRecordName")) {
settings.m_fileRecordName = *response.getSdrPlaySettings()->getFileRecordName();
}
if (deviceSettingsKeys.contains("useReverseAPI")) {
settings.m_useReverseAPI = response.getSdrPlaySettings()->getUseReverseApi() != 0;
}
@@ -853,12 +771,6 @@ void SDRPlayInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& re
response.getSdrPlaySettings()->setMixerAmpOn(settings.m_mixerAmpOn ? 1 : 0);
response.getSdrPlaySettings()->setBasebandGain(settings.m_basebandGain);
if (response.getSdrPlaySettings()->getFileRecordName()) {
*response.getSdrPlaySettings()->getFileRecordName() = settings.m_fileRecordName;
} else {
response.getSdrPlaySettings()->setFileRecordName(new QString(settings.m_fileRecordName));
}
response.getSdrPlaySettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
if (response.getSdrPlaySettings()->getReverseApiAddress()) {
@@ -978,9 +890,6 @@ void SDRPlayInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys,
if (deviceSettingsKeys.contains("basebandGain") || force) {
swgSDRPlaySettings->setBasebandGain(settings.m_basebandGain);
}
if (deviceSettingsKeys.contains("fileRecordName") || force) {
swgSDRPlaySettings->setFileRecordName(new QString(settings.m_fileRecordName));
}
QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings")
.arg(settings.m_reverseAPIAddress)
@@ -32,7 +32,6 @@ class QNetworkAccessManager;
class QNetworkReply;
class DeviceAPI;
class SDRPlayThread;
class FileRecord;
class SDRPlayInput : public DeviceSampleSource {
Q_OBJECT
@@ -97,25 +96,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
@@ -178,11 +158,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 SDRPlaySettings& settings);
@@ -204,7 +179,6 @@ private:
QString m_deviceDescription;
int m_devNumber;
bool m_running;
FileRecord *m_fileSink; //!< File sink to record device I/Q output
QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest;
@@ -43,7 +43,6 @@ void SDRPlaySettings::resetToDefaults()
m_mixerAmpOn = false;
m_basebandGain = 29;
m_iqOrder = true;
m_fileRecordName = "";
m_useReverseAPI = false;
m_reverseAPIAddress = "127.0.0.1";
m_reverseAPIPort = 8888;
@@ -46,7 +46,6 @@ struct SDRPlaySettings {
bool m_mixerAmpOn;
int m_basebandGain;
bool m_iqOrder;
QString m_fileRecordName;
bool m_useReverseAPI;
QString m_reverseAPIAddress;
uint16_t m_reverseAPIPort;