1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-15 20:28:52 -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
@@ -29,13 +29,10 @@
#include "SWGLimeSdrInputSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGLimeSdrInputReport.h"
#include "SWGLimeSdrInputActions.h"
#include "device/deviceapi.h"
#include "dsp/dspcommands.h"
#include "dsp/filerecord.h"
#include "dsp/dspengine.h"
#include "limesdrinput.h"
#include "limesdrinputthread.h"
@@ -47,12 +44,10 @@ MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgConfigureLimeSDR, Message)
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgGetStreamInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgGetDeviceInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgReportStreamInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgFileRecord, Message)
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgStartStop, Message)
LimeSDRInput::LimeSDRInput(DeviceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_fileSink(nullptr),
m_settings(),
m_limeSDRInputThread(nullptr),
m_deviceDescription("LimeSDRInput"),
@@ -81,12 +76,6 @@ LimeSDRInput::~LimeSDRInput()
stop();
}
if (m_fileSink)
{
m_deviceAPI->removeAncillarySink(m_fileSink);
delete m_fileSink;
}
suspendRxBuddies();
suspendTxBuddies();
closeDevice();
@@ -748,38 +737,6 @@ bool LimeSDRInput::handleMessage(const Message& message)
return true;
}
else if (MsgFileRecord::match(message))
{
MsgFileRecord& conf = (MsgFileRecord&) message;
qDebug() << "LimeSDRInput::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;
@@ -1361,11 +1318,6 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
int sampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftDecim);
int ncoShift = m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0;
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency + ncoShift);
if (m_fileSink) {
m_fileSink->handleMessage(*notif); // forward to file sink
}
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
}
@@ -1555,9 +1507,6 @@ void LimeSDRInput::webapiUpdateDeviceSettings(
if (deviceSettingsKeys.contains("transverterMode")) {
settings.m_transverterMode = response.getLimeSdrInputSettings()->getTransverterMode() != 0;
}
if (deviceSettingsKeys.contains("fileRecordName")) {
settings.m_fileRecordName = *response.getLimeSdrInputSettings()->getFileRecordName();
}
if (deviceSettingsKeys.contains("gpioDir")) {
settings.m_gpioDir = response.getLimeSdrInputSettings()->getGpioDir() & 0xFF;
}
@@ -1602,13 +1551,6 @@ void LimeSDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& re
response.getLimeSdrInputSettings()->setTiaGain(settings.m_tiaGain);
response.getLimeSdrInputSettings()->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency);
response.getLimeSdrInputSettings()->setTransverterMode(settings.m_transverterMode ? 1 : 0);
if (response.getLimeSdrInputSettings()->getFileRecordName()) {
*response.getLimeSdrInputSettings()->getFileRecordName() = settings.m_fileRecordName;
} else {
response.getLimeSdrInputSettings()->setFileRecordName(new QString(settings.m_fileRecordName));
}
response.getLimeSdrInputSettings()->setGpioDir(settings.m_gpioDir);
response.getLimeSdrInputSettings()->setGpioPins(settings.m_gpioPins);
response.getLimeSdrInputSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
@@ -1662,37 +1604,6 @@ int LimeSDRInput::webapiRun(
return 200;
}
int LimeSDRInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGLimeSdrInputActions *swgLimeSdrInputActions = query.getLimeSdrInputActions();
if (swgLimeSdrInputActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgLimeSdrInputActions->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 LimeSdrInputActions in query";
return 400;
}
}
void LimeSDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
{
bool success = false;
@@ -1810,9 +1721,6 @@ void LimeSDRInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys,
if (deviceSettingsKeys.contains("transverterMode") || force) {
swgLimeSdrInputSettings->setTransverterMode(settings.m_transverterMode ? 1 : 0);
}
if (deviceSettingsKeys.contains("fileRecordName") || force) {
swgLimeSdrInputSettings->setFileRecordName(new QString(settings.m_fileRecordName));
}
if (deviceSettingsKeys.contains("gpioDir") || force) {
swgLimeSdrInputSettings->setGpioDir(settings.m_gpioDir & 0xFF);
}
@@ -30,7 +30,6 @@
class DeviceAPI;
class LimeSDRInputThread;
class FileRecord;
class QNetworkAccessManager;
class QNetworkReply;
@@ -166,25 +165,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
@@ -247,11 +227,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 LimeSDRInputSettings& settings);
@@ -278,7 +253,6 @@ private:
DeviceLimeSDRShared m_deviceShared;
bool m_channelAcquired;
lms_stream_t m_streamId;
FileRecord *m_fileSink; //!< File sink to record device I/Q output
QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest;
@@ -97,9 +97,6 @@ LimeSDRInputGUI::LimeSDRInputGUI(DeviceUISet *deviceUISet, QWidget* parent) :
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_limeSDRInput->setMessageQueueToGUI(&m_inputMessageQueue);
CRightClickEnabler *fileRecordRightClickEnabler = new CRightClickEnabler(ui->record);
connect(fileRecordRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openFileRecordDialog(const QPoint &)));
CRightClickEnabler *startStopRightClickEnabler = new CRightClickEnabler(ui->startStop);
connect(startStopRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &)));
}
@@ -263,23 +260,6 @@ bool LimeSDRInputGUI::handleMessage(const Message& message)
return true;
}
else if (LimeSDRInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const LimeSDRInput::MsgFileRecord& notif = (const LimeSDRInput::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;
@@ -571,18 +551,6 @@ void LimeSDRInputGUI::on_startStop_toggled(bool checked)
}
}
void LimeSDRInputGUI::on_record_toggled(bool checked)
{
if (checked) {
ui->record->setStyleSheet("QToolButton { background-color : red; }");
} else {
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
}
LimeSDRInput::MsgFileRecord* message = LimeSDRInput::MsgFileRecord::create(checked);
m_limeSDRInput->getInputMessageQueue()->push(message);
}
void LimeSDRInputGUI::on_centerFrequency_changed(quint64 value)
{
setCenterFrequencySetting(value);
@@ -772,29 +740,3 @@ void LimeSDRInputGUI::openDeviceSettingsDialog(const QPoint& p)
sendSettings();
}
void LimeSDRInputGUI::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();
}
}
}
@@ -83,7 +83,6 @@ private:
private slots:
void handleInputMessages();
void on_startStop_toggled(bool checked);
void on_record_toggled(bool checked);
void on_centerFrequency_changed(quint64 value);
void on_ncoFrequency_changed(qint64 value);
void on_ncoEnable_toggled(bool checked);
@@ -105,7 +104,6 @@ private slots:
void on_transverter_clicked();
void on_sampleRateMode_toggled(bool checked);
void openDeviceSettingsDialog(const QPoint& p);
void openFileRecordDialog(const QPoint& p);
void updateHardware();
void updateStatus();
@@ -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>
@@ -35,7 +35,7 @@
const PluginDescriptor LimeSDRInputPlugin::m_pluginDescriptor = {
QString("LimeSDR"),
QString("LimeSDR Input"),
QString("4.14.5"),
QString("4.15.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@@ -47,7 +47,6 @@ void LimeSDRInputSettings::resetToDefaults()
m_transverterMode = false;
m_transverterDeltaFrequency = 0;
m_iqOrder = true;
m_fileRecordName = "";
m_gpioDir = 0;
m_gpioPins = 0;
m_useReverseAPI = false;
@@ -67,7 +67,6 @@ struct LimeSDRInputSettings
bool m_transverterMode;
qint64 m_transverterDeltaFrequency;
bool m_iqOrder;
QString m_fileRecordName;
uint8_t m_gpioDir; //!< GPIO pin direction LSB first; 0 input, 1 output
uint8_t m_gpioPins; //!< GPIO pins to write; LSB first
bool m_useReverseAPI;
@@ -30,11 +30,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 to stop, plug back in, check the source on the sampling devices control panel 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: ADC sample rate</h4>
This is the sample rate at which the ADC runs in kS/s (k) or MS/s (M) before hardware decimation (8). Thus this is the device to host sample rate (5) multiplied by the hardware decimation factor (3).