1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 21:54:55 -04:00

Removed file recording function from device plugins

This commit is contained in:
f4exb
2020-08-08 11:53:56 +02:00
parent db7ae9a0cd
commit e6e7ece46c
241 changed files with 250 additions and 4140 deletions
@@ -24,13 +24,10 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceActions.h"
#include "SWGHackRFInputActions.h"
#include "util/simpleserializer.h"
#include "dsp/dspcommands.h"
#include "dsp/dspengine.h"
#include "dsp/filerecord.h"
#include "device/deviceapi.h"
#include "hackrf/devicehackrfvalues.h"
#include "hackrf/devicehackrfshared.h"
@@ -40,7 +37,6 @@
MESSAGE_CLASS_DEFINITION(HackRFInput::MsgConfigureHackRF, Message)
MESSAGE_CLASS_DEFINITION(HackRFInput::MsgReportHackRF, Message)
MESSAGE_CLASS_DEFINITION(HackRFInput::MsgFileRecord, Message)
MESSAGE_CLASS_DEFINITION(HackRFInput::MsgStartStop, Message)
HackRFInput::HackRFInput(DeviceAPI *deviceAPI) :
@@ -53,10 +49,7 @@ HackRFInput::HackRFInput(DeviceAPI *deviceAPI) :
{
openDevice();
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
m_deviceAPI->setNbSourceStreams(1);
m_deviceAPI->addAncillarySink(m_fileSink);
m_deviceAPI->setBuddySharedPtr(&m_sharedParams);
m_networkManager = new QNetworkAccessManager();
@@ -72,8 +65,6 @@ HackRFInput::~HackRFInput()
stop();
}
m_deviceAPI->removeAncillarySink(m_fileSink);
delete m_fileSink;
closeDevice();
m_deviceAPI->setBuddySharedPtr(0);
}
@@ -269,28 +260,6 @@ bool HackRFInput::handleMessage(const Message& message)
return true;
}
else if (MsgFileRecord::match(message))
{
MsgFileRecord& conf = (MsgFileRecord&) message;
qDebug() << "HackRFInput::handleMessage: MsgFileRecord: " << conf.getStartStop();
if (conf.getStartStop())
{
if (m_settings.m_fileRecordName.size() != 0) {
m_fileSink->setFileName(m_settings.m_fileRecordName);
} else {
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
}
m_fileSink->startRecording();
}
else
{
m_fileSink->stopRecording();
}
return true;
}
else if (MsgStartStop::match(message))
{
MsgStartStop& cmd = (MsgStartStop&) message;
@@ -337,7 +306,6 @@ bool HackRFInput::handleMessage(const Message& message)
m_settings.m_centerFrequency = settings.m_centerFrequency;
int sampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2Decim);
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency);
m_fileSink->handleMessage(*notif); // forward to file sink
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
return true;
@@ -571,7 +539,6 @@ bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force)
{
int sampleRate = settings.m_devSampleRate/(1<<settings.m_log2Decim);
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, settings.m_centerFrequency);
m_fileSink->handleMessage(*notif); // forward to file sink
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
}
@@ -684,9 +651,6 @@ void HackRFInput::webapiUpdateDeviceSettings(
if (deviceSettingsKeys.contains("iqCorrection")) {
settings.m_iqCorrection = response.getHackRfInputSettings()->getIqCorrection() != 0;
}
if (deviceSettingsKeys.contains("fileRecordName")) {
settings.m_fileRecordName = *response.getHackRfInputSettings()->getFileRecordName();
}
if (deviceSettingsKeys.contains("transverterDeltaFrequency")) {
settings.m_transverterDeltaFrequency = response.getHackRfInputSettings()->getTransverterDeltaFrequency();
}
@@ -725,12 +689,6 @@ void HackRFInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& res
response.getHackRfInputSettings()->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency);
response.getHackRfInputSettings()->setTransverterMode(settings.m_transverterMode ? 1 : 0);
if (response.getHackRfInputSettings()->getFileRecordName()) {
*response.getHackRfInputSettings()->getFileRecordName() = settings.m_fileRecordName;
} else {
response.getHackRfInputSettings()->setFileRecordName(new QString(settings.m_fileRecordName));
}
response.getHackRfInputSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
if (response.getHackRfInputSettings()->getReverseApiAddress()) {
@@ -771,37 +729,6 @@ int HackRFInput::webapiRun(
return 200;
}
int HackRFInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGHackRFInputActions *swgHackRFInputActions = query.getHackRfInputActions();
if (swgHackRFInputActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgHackRFInputActions->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 HackRFInputActions in query";
return 400;
}
}
void HackRFInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const HackRFInputSettings& settings, bool force)
{
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
@@ -852,9 +779,6 @@ void HackRFInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys,
if (deviceSettingsKeys.contains("iqCorrection") || force) {
swgHackRFInputSettings->setIqCorrection(settings.m_iqCorrection ? 1 : 0);
}
if (deviceSettingsKeys.contains("fileRecordName") || force) {
swgHackRFInputSettings->setFileRecordName(new QString(settings.m_fileRecordName));
}
if (deviceSettingsKeys.contains("transverterDeltaFrequency") || force) {
swgHackRFInputSettings->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency);
}
@@ -32,7 +32,6 @@ class QNetworkAccessManager;
class QNetworkReply;
class DeviceAPI;
class HackRFInputThread;
class FileRecord;
class HackRFInput : 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)
{ }
};
HackRFInput(DeviceAPI *deviceAPI);
virtual ~HackRFInput();
virtual void destroy();
@@ -155,11 +135,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 HackRFInputSettings& settings);
@@ -178,7 +153,6 @@ private:
QString m_deviceDescription;
DeviceHackRFParams m_sharedParams;
bool m_running;
FileRecord *m_fileSink; //!< File sink to record device I/Q output
QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest;
@@ -62,9 +62,6 @@ HackRFInputGui::HackRFInputGui(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();
displayBandwidths();
@@ -159,23 +156,6 @@ bool HackRFInputGui::handleMessage(const Message& message)
return true;
}
else if (HackRFInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const HackRFInput::MsgFileRecord& notif = (const HackRFInput::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;
@@ -445,18 +425,6 @@ void HackRFInputGui::on_startStop_toggled(bool checked)
}
}
void HackRFInputGui::on_record_toggled(bool checked)
{
if (checked) {
ui->record->setStyleSheet("QToolButton { background-color : red; }");
} else {
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
}
HackRFInput::MsgFileRecord* message = HackRFInput::MsgFileRecord::create(checked);
m_sampleSource->getInputMessageQueue()->push(message);
}
void HackRFInputGui::on_sampleRateMode_toggled(bool checked)
{
m_sampleRateMode = checked;
@@ -539,29 +507,3 @@ void HackRFInputGui::openDeviceSettingsDialog(const QPoint& p)
sendSettings();
}
void HackRFInputGui::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();
}
}
}
@@ -101,13 +101,11 @@ private slots:
void on_bbFilter_currentIndexChanged(int index);
void on_vga_valueChanged(int value);
void on_startStop_toggled(bool checked);
void on_record_toggled(bool checked);
void on_sampleRateMode_toggled(bool checked);
void on_transverter_clicked();
void updateHardware();
void updateStatus();
void openDeviceSettingsDialog(const QPoint& p);
void openFileRecordDialog(const QPoint& p);
};
#endif // INCLUDE_HACKRFINPUTGUI_H
@@ -77,20 +77,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>
@@ -33,7 +33,7 @@
const PluginDescriptor HackRFInputPlugin::m_pluginDescriptor = {
QString("HackRF"),
QString("HackRF Input"),
QString("4.14.11"),
QString("4.15.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@@ -40,7 +40,6 @@ void HackRFInputSettings::resetToDefaults()
m_dcBlock = false;
m_iqCorrection = false;
m_devSampleRate = 2400000;
m_fileRecordName = "";
m_transverterMode = false;
m_transverterDeltaFrequency = 0;
m_iqOrder = true;
@@ -40,7 +40,6 @@ struct HackRFInputSettings {
bool m_lnaExt;
bool m_dcBlock;
bool m_iqCorrection;
QString m_fileRecordName;
bool m_transverterMode;
qint64 m_transverterDeltaFrequency;
bool m_iqOrder;
@@ -28,11 +28,6 @@ If you have the Tx open in another tab and it is running then it will be stopped
The settings on Rx or Tx tab are reapplied on start so these settings can be considered independent.
<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>
In device to host sample rate input mode (6A) this is the baseband I/Q sample rate in kS/s. This is the device to host sample rate (6) divided by the decimation factor (7).