mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-07 00:14:49 -04:00
Removed file recording function from device plugins
This commit is contained in:
@@ -25,26 +25,21 @@
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGDeviceReport.h"
|
||||
#include "SWGDeviceActions.h"
|
||||
#include "SWGLocalInputReport.h"
|
||||
#include "SWGLocalInputActions.h"
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "dsp/filerecord.h"
|
||||
|
||||
#include "localinput.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(LocalInput::MsgConfigureLocalInput, Message)
|
||||
MESSAGE_CLASS_DEFINITION(LocalInput::MsgFileRecord, Message)
|
||||
MESSAGE_CLASS_DEFINITION(LocalInput::MsgStartStop, Message)
|
||||
MESSAGE_CLASS_DEFINITION(LocalInput::MsgReportSampleRateAndFrequency, Message)
|
||||
|
||||
LocalInput::LocalInput(DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_fileSink(nullptr),
|
||||
m_settings(),
|
||||
m_centerFrequency(0),
|
||||
m_deviceDescription("LocalInput")
|
||||
@@ -62,12 +57,6 @@ LocalInput::~LocalInput()
|
||||
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
||||
delete m_networkManager;
|
||||
stop();
|
||||
|
||||
if (m_fileSink)
|
||||
{
|
||||
m_deviceAPI->removeAncillarySink(m_fileSink);
|
||||
delete m_fileSink;
|
||||
}
|
||||
}
|
||||
|
||||
void LocalInput::destroy()
|
||||
@@ -168,49 +157,7 @@ void LocalInput::setCenterFrequency(qint64 centerFrequency)
|
||||
|
||||
bool LocalInput::handleMessage(const Message& message)
|
||||
{
|
||||
if (DSPSignalNotification::match(message))
|
||||
{
|
||||
DSPSignalNotification& notif = (DSPSignalNotification&) message;
|
||||
|
||||
if (m_fileSink) {
|
||||
return m_fileSink->handleMessage(notif); // forward to file sink
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (MsgFileRecord::match(message))
|
||||
{
|
||||
MsgFileRecord& conf = (MsgFileRecord&) message;
|
||||
qDebug() << "LocalInput::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))
|
||||
if (MsgStartStop::match(message))
|
||||
{
|
||||
MsgStartStop& cmd = (MsgStartStop&) message;
|
||||
qDebug() << "LocalInput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
|
||||
@@ -259,9 +206,6 @@ void LocalInput::applySettings(const LocalInputSettings& settings, bool force)
|
||||
if ((m_settings.m_iqCorrection != settings.m_iqCorrection) || force) {
|
||||
reverseAPIKeys.append("iqCorrection");
|
||||
}
|
||||
if ((m_settings.m_fileRecordName != settings.m_fileRecordName) || force) {
|
||||
reverseAPIKeys.append("fileRecordName");
|
||||
}
|
||||
|
||||
if ((m_settings.m_dcBlock != settings.m_dcBlock) || (m_settings.m_iqCorrection != settings.m_iqCorrection) || force)
|
||||
{
|
||||
@@ -288,7 +232,6 @@ void LocalInput::applySettings(const LocalInputSettings& settings, bool force)
|
||||
qDebug() << "LocalInput::applySettings: "
|
||||
<< " m_dcBlock: " << m_settings.m_dcBlock
|
||||
<< " m_iqCorrection: " << m_settings.m_iqCorrection
|
||||
<< " m_fileRecordName: " << m_settings.m_fileRecordName
|
||||
<< " m_remoteAddress: " << m_remoteAddress;
|
||||
}
|
||||
|
||||
@@ -354,37 +297,6 @@ int LocalInput::webapiSettingsPutPatch(
|
||||
return 200;
|
||||
}
|
||||
|
||||
int LocalInput::webapiActionsPost(
|
||||
const QStringList& deviceActionsKeys,
|
||||
SWGSDRangel::SWGDeviceActions& query,
|
||||
QString& errorMessage)
|
||||
{
|
||||
SWGSDRangel::SWGLocalInputActions *swgLocalInputActions = query.getLocalInputActions();
|
||||
|
||||
if (swgLocalInputActions)
|
||||
{
|
||||
if (deviceActionsKeys.contains("record"))
|
||||
{
|
||||
bool record = swgLocalInputActions->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 LocalInputActions in query";
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
|
||||
void LocalInput::webapiUpdateDeviceSettings(
|
||||
LocalInputSettings& settings,
|
||||
const QStringList& deviceSettingsKeys,
|
||||
@@ -396,9 +308,6 @@ void LocalInput::webapiUpdateDeviceSettings(
|
||||
if (deviceSettingsKeys.contains("iqCorrection")) {
|
||||
settings.m_iqCorrection = response.getLocalInputSettings()->getIqCorrection() != 0;
|
||||
}
|
||||
if (deviceSettingsKeys.contains("fileRecordName")) {
|
||||
settings.m_fileRecordName = *response.getLocalInputSettings()->getFileRecordName();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("useReverseAPI")) {
|
||||
settings.m_useReverseAPI = response.getLocalInputSettings()->getUseReverseApi() != 0;
|
||||
}
|
||||
@@ -418,12 +327,6 @@ void LocalInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& resp
|
||||
response.getLocalInputSettings()->setDcBlock(settings.m_dcBlock ? 1 : 0);
|
||||
response.getLocalInputSettings()->setIqCorrection(settings.m_iqCorrection);
|
||||
|
||||
if (response.getLocalInputSettings()->getFileRecordName()) {
|
||||
*response.getLocalInputSettings()->getFileRecordName() = settings.m_fileRecordName;
|
||||
} else {
|
||||
response.getLocalInputSettings()->setFileRecordName(new QString(settings.m_fileRecordName));
|
||||
}
|
||||
|
||||
response.getLocalInputSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
|
||||
|
||||
if (response.getLocalInputSettings()->getReverseApiAddress()) {
|
||||
@@ -470,9 +373,6 @@ void LocalInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, c
|
||||
if (deviceSettingsKeys.contains("iqCorrection") || force) {
|
||||
swgLocalInputSettings->setIqCorrection(settings.m_iqCorrection ? 1 : 0);
|
||||
}
|
||||
if (deviceSettingsKeys.contains("fileRecordName") || force) {
|
||||
swgLocalInputSettings->setFileRecordName(new QString(settings.m_fileRecordName));
|
||||
}
|
||||
|
||||
QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings")
|
||||
.arg(settings.m_reverseAPIAddress)
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
class DeviceAPI;
|
||||
class FileRecord;
|
||||
|
||||
class LocalInput : public DeviceSampleSource {
|
||||
Q_OBJECT
|
||||
@@ -62,25 +61,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
|
||||
|
||||
@@ -165,11 +145,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 LocalInputSettings& settings);
|
||||
@@ -187,7 +162,6 @@ private:
|
||||
int m_sampleRate;
|
||||
QString m_remoteAddress;
|
||||
QString m_deviceDescription;
|
||||
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
||||
QNetworkAccessManager *m_networkManager;
|
||||
QNetworkRequest m_networkRequest;
|
||||
|
||||
|
||||
@@ -87,9 +87,6 @@ LocalInputGui::LocalInputGui(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_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
||||
@@ -205,23 +202,6 @@ bool LocalInputGui::handleMessage(const Message& message)
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (LocalInput::MsgFileRecord::match(message)) // API action "record" feedback
|
||||
{
|
||||
const LocalInput::MsgFileRecord& notif = (const LocalInput::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;
|
||||
@@ -316,18 +296,6 @@ void LocalInputGui::on_startStop_toggled(bool checked)
|
||||
}
|
||||
}
|
||||
|
||||
void LocalInputGui::on_record_toggled(bool checked)
|
||||
{
|
||||
if (checked) {
|
||||
ui->record->setStyleSheet("QToolButton { background-color : red; }");
|
||||
} else {
|
||||
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
}
|
||||
|
||||
LocalInput::MsgFileRecord* message = LocalInput::MsgFileRecord::create(checked);
|
||||
m_sampleSource->getInputMessageQueue()->push(message);
|
||||
}
|
||||
|
||||
void LocalInputGui::updateHardware()
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
@@ -388,29 +356,3 @@ void LocalInputGui::openDeviceSettingsDialog(const QPoint& p)
|
||||
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void LocalInputGui::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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,11 +117,9 @@ private slots:
|
||||
void on_dcOffset_toggled(bool checked);
|
||||
void on_iqImbalance_toggled(bool checked);
|
||||
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);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_LOCALINPUTGUI_H
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
const PluginDescriptor LocalInputPlugin::m_pluginDescriptor = {
|
||||
QString("LocalInput"),
|
||||
QString("Local device input"),
|
||||
QString("4.12.3"),
|
||||
QString("4.15.0"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
||||
@@ -27,7 +27,6 @@ void LocalInputSettings::resetToDefaults()
|
||||
{
|
||||
m_dcBlock = false;
|
||||
m_iqCorrection = false;
|
||||
m_fileRecordName = "";
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
m_reverseAPIPort = 8888;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
struct LocalInputSettings {
|
||||
bool m_dcBlock;
|
||||
bool m_iqCorrection;
|
||||
QString m_fileRecordName;
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
uint16_t m_reverseAPIPort;
|
||||
|
||||
@@ -15,11 +15,6 @@ Device start / stop button.
|
||||
- Blue triangle icon: device is ready and can be started
|
||||
- Green square icon: device is running and can be stopped
|
||||
|
||||
<h3>2: Record</h3>
|
||||
|
||||
- Left click: record baseband I/Q stream toggle button
|
||||
- Right click: choose record file
|
||||
|
||||
<h3>3: Frequency</h3>
|
||||
|
||||
This is the center frequency in Hz sent from the Local Sink channel instance and corresponds to the center frequency of reception. The sub kHz value (000 to 999 Hz) is represented in smaller digits on the right.
|
||||
|
||||
Reference in New Issue
Block a user