1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 06:04:39 -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
@@ -28,11 +28,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.
<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 to host sample rate (3) divided by the decimation factor (4).
@@ -73,9 +73,6 @@ TestSourceGui::TestSourceGui(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 &)));
}
TestSourceGui::~TestSourceGui()
@@ -284,18 +281,6 @@ void TestSourceGui::on_phaseImbalance_valueChanged(int value)
sendSettings();
}
void TestSourceGui::on_record_toggled(bool checked)
{
if (checked) {
ui->record->setStyleSheet("QToolButton { background-color : red; }");
} else {
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
}
TestSourceInput::MsgFileRecord* message = TestSourceInput::MsgFileRecord::create(checked);
m_sampleSource->getInputMessageQueue()->push(message);
}
void TestSourceGui::displayAmplitude()
{
int amplitudeInt = ui->amplitudeCoarse->value() * 100 + ui->amplitudeFine->value();
@@ -481,23 +466,6 @@ bool TestSourceGui::handleMessage(const Message& message)
return true;
}
else if (TestSourceInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const TestSourceInput::MsgFileRecord& notif = (const TestSourceInput::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;
@@ -557,29 +525,3 @@ void TestSourceGui::openDeviceSettingsDialog(const QPoint& p)
sendSettings();
}
void TestSourceGui::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();
}
}
}
@@ -97,9 +97,7 @@ private slots:
void on_iBias_valueChanged(int value);
void on_qBias_valueChanged(int value);
void on_phaseImbalance_valueChanged(int value);
void on_record_toggled(bool checked);
void openDeviceSettingsDialog(const QPoint& p);
void openFileRecordDialog(const QPoint& p);
void updateStatus();
void updateHardware();
};
@@ -74,20 +74,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>
@@ -25,24 +25,19 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceActions.h"
#include "SWGTestSourceActions.h"
#include "testsourceinput.h"
#include "device/deviceapi.h"
#include "testsourceworker.h"
#include "dsp/dspcommands.h"
#include "dsp/dspengine.h"
#include "dsp/filerecord.h"
MESSAGE_CLASS_DEFINITION(TestSourceInput::MsgConfigureTestSource, Message)
MESSAGE_CLASS_DEFINITION(TestSourceInput::MsgFileRecord, Message)
MESSAGE_CLASS_DEFINITION(TestSourceInput::MsgStartStop, Message)
TestSourceInput::TestSourceInput(DeviceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_fileSink(nullptr),
m_settings(),
m_testSourceWorker(nullptr),
m_deviceDescription(),
@@ -59,22 +54,6 @@ TestSourceInput::TestSourceInput(DeviceAPI *deviceAPI) :
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
}
TestSourceInput::~TestSourceInput()
{
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
delete m_networkManager;
if (m_running) {
stop();
}
if (m_fileSink)
{
m_deviceAPI->removeAncillarySink(m_fileSink);
delete m_fileSink;
}
}
void TestSourceInput::destroy()
{
delete this;
@@ -207,38 +186,6 @@ bool TestSourceInput::handleMessage(const Message& message)
return true;
}
else if (MsgFileRecord::match(message))
{
MsgFileRecord& conf = (MsgFileRecord&) message;
qDebug() << "TestSourceInput::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;
@@ -418,11 +365,6 @@ bool TestSourceInput::applySettings(const TestSourceSettings& settings, bool for
{
int sampleRate = settings.m_sampleRate/(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);
}
@@ -547,37 +489,6 @@ int TestSourceInput::webapiSettingsPutPatch(
return 200;
}
int TestSourceInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGTestSourceActions *swgTestSourceActions = query.getTestSourceActions();
if (swgTestSourceActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgTestSourceActions->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 TestSourceActions in query";
return 400;
}
}
void TestSourceInput::webapiUpdateDeviceSettings(
TestSourceSettings& settings,
const QStringList& deviceSettingsKeys,
@@ -639,9 +550,6 @@ void TestSourceInput::webapiUpdateDeviceSettings(
if (deviceSettingsKeys.contains("phaseImbalance")) {
settings.m_phaseImbalance = response.getTestSourceSettings()->getPhaseImbalance();
};
if (deviceSettingsKeys.contains("fileRecordName")) {
settings.m_fileRecordName = *response.getTestSourceSettings()->getFileRecordName();
}
if (deviceSettingsKeys.contains("useReverseAPI")) {
settings.m_useReverseAPI = response.getTestSourceSettings()->getUseReverseApi() != 0;
}
@@ -675,12 +583,6 @@ void TestSourceInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings&
response.getTestSourceSettings()->setQFactor(settings.m_qFactor);
response.getTestSourceSettings()->setPhaseImbalance(settings.m_phaseImbalance);
if (response.getTestSourceSettings()->getFileRecordName()) {
*response.getTestSourceSettings()->getFileRecordName() = settings.m_fileRecordName;
} else {
response.getTestSourceSettings()->setFileRecordName(new QString(settings.m_fileRecordName));
}
response.getTestSourceSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
if (response.getTestSourceSettings()->getReverseApiAddress()) {
@@ -752,9 +654,6 @@ void TestSourceInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKe
if (deviceSettingsKeys.contains("phaseImbalance") || force) {
swgTestSourceSettings->setPhaseImbalance(settings.m_phaseImbalance);
};
if (deviceSettingsKeys.contains("fileRecordName") || force) {
swgTestSourceSettings->setFileRecordName(new QString(settings.m_fileRecordName));
}
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings")
.arg(settings.m_reverseAPIAddress)
@@ -29,7 +29,6 @@
class DeviceAPI;
class TestSourceWorker;
class FileRecord;
class QNetworkAccessManager;
class QNetworkReply;
@@ -59,25 +58,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
@@ -136,11 +116,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 TestSourceSettings& settings);
@@ -152,7 +127,6 @@ public:
private:
DeviceAPI *m_deviceAPI;
FileRecord *m_fileSink; //!< File sink to record device I/Q output
QMutex m_mutex;
TestSourceSettings m_settings;
TestSourceWorker* m_testSourceWorker;
@@ -31,7 +31,7 @@
const PluginDescriptor TestSourcePlugin::m_pluginDescriptor = {
QString("TestSource"),
QString("Test Source input"),
QString("4.12.3"),
QString("4.15.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@@ -42,7 +42,6 @@ void TestSourceSettings::resetToDefaults()
m_iFactor = 0.0f;
m_qFactor = 0.0f;
m_phaseImbalance = 0.0f;
m_fileRecordName = "";
m_useReverseAPI = false;
m_reverseAPIAddress = "127.0.0.1";
m_reverseAPIPort = 8888;
@@ -60,7 +60,6 @@ struct TestSourceSettings {
float m_iFactor; //!< -1.0 < x < 1.0
float m_qFactor; //!< -1.0 < x < 1.0
float m_phaseImbalance; //!< -1.0 < x < 1.0
QString m_fileRecordName;
bool m_useReverseAPI;
QString m_reverseAPIAddress;
uint16_t m_reverseAPIPort;