1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-03 06:24:48 -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
@@ -26,12 +26,9 @@
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGBladeRF2InputReport.h"
#include "SWGDeviceActions.h"
#include "SWGBladeRF2InputActions.h"
#include "device/deviceapi.h"
#include "dsp/dspcommands.h"
#include "dsp/filerecord.h"
#include "dsp/dspengine.h"
#include "bladerf2/devicebladerf2shared.h"
@@ -41,13 +38,11 @@
MESSAGE_CLASS_DEFINITION(BladeRF2Input::MsgConfigureBladeRF2, Message)
MESSAGE_CLASS_DEFINITION(BladeRF2Input::MsgFileRecord, Message)
MESSAGE_CLASS_DEFINITION(BladeRF2Input::MsgStartStop, Message)
MESSAGE_CLASS_DEFINITION(BladeRF2Input::MsgReportGainRange, Message)
BladeRF2Input::BladeRF2Input(DeviceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_fileSink(nullptr),
m_settings(),
m_deviceDescription("BladeRF2Input"),
m_running(false),
@@ -82,12 +77,6 @@ BladeRF2Input::~BladeRF2Input()
stop();
}
if (m_fileSink)
{
m_deviceAPI->removeAncillarySink(m_fileSink);
delete m_fileSink;
}
closeDevice();
}
@@ -704,11 +693,6 @@ bool BladeRF2Input::handleMessage(const Message& message)
{
int sampleRate = settings.m_devSampleRate/(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);
}
@@ -724,38 +708,6 @@ bool BladeRF2Input::handleMessage(const Message& message)
return true;
}
else if (MsgFileRecord::match(message))
{
MsgFileRecord& conf = (MsgFileRecord&) message;
qDebug() << "BladeRF2Input::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;
@@ -992,11 +944,6 @@ bool BladeRF2Input::applySettings(const BladeRF2InputSettings& settings, bool fo
{
int sampleRate = settings.m_devSampleRate/(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);
}
@@ -1147,9 +1094,6 @@ void BladeRF2Input::webapiUpdateDeviceSettings(
if (deviceSettingsKeys.contains("transverterMode")) {
settings.m_transverterMode = response.getBladeRf2InputSettings()->getTransverterMode() != 0;
}
if (deviceSettingsKeys.contains("fileRecordName")) {
settings.m_fileRecordName = *response.getBladeRf2InputSettings()->getFileRecordName();
}
if (deviceSettingsKeys.contains("useReverseAPI")) {
settings.m_useReverseAPI = response.getBladeRf2InputSettings()->getUseReverseApi() != 0;
}
@@ -1190,12 +1134,6 @@ void BladeRF2Input::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& r
response.getBladeRf2InputSettings()->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency);
response.getBladeRf2InputSettings()->setTransverterMode(settings.m_transverterMode ? 1 : 0);
if (response.getBladeRf2InputSettings()->getFileRecordName()) {
*response.getBladeRf2InputSettings()->getFileRecordName() = settings.m_fileRecordName;
} else {
response.getBladeRf2InputSettings()->setFileRecordName(new QString(settings.m_fileRecordName));
}
response.getBladeRf2InputSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
if (response.getBladeRf2InputSettings()->getReverseApiAddress()) {
@@ -1287,37 +1225,6 @@ int BladeRF2Input::webapiRun(
return 200;
}
int BladeRF2Input::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGBladeRF2InputActions *swgBladeRF2InputActions = query.getBladeRf2InputActions();
if (swgBladeRF2InputActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgBladeRF2InputActions->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 BladeRF2InputActions in query";
return 400;
}
}
void BladeRF2Input::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF2InputSettings& settings, bool force)
{
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
@@ -1356,9 +1263,6 @@ void BladeRF2Input::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys
if (deviceSettingsKeys.contains("transverterMode") || force) {
swgBladeRF2Settings->setTransverterMode(settings.m_transverterMode ? 1 : 0);
}
if (deviceSettingsKeys.contains("fileRecordName") || force) {
swgBladeRF2Settings->setFileRecordName(new QString(settings.m_fileRecordName));
}
if (deviceSettingsKeys.contains("devSampleRate")) {
swgBladeRF2Settings->setDevSampleRate(settings.m_devSampleRate);
}
@@ -32,7 +32,6 @@ class QNetworkAccessManager;
class QNetworkReply;
class DeviceAPI;
class BladeRF2InputThread;
class FileRecord;
struct bladerf_gain_modes;
struct bladerf;
@@ -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
@@ -182,11 +162,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 BladeRF2InputSettings& settings);
@@ -204,7 +179,6 @@ private:
bool m_running;
DeviceBladeRF2Shared m_deviceShared;
BladeRF2InputThread *m_thread;
FileRecord *m_fileSink; //!< File sink to record device I/Q output
std::vector<GainMode> m_gainModes;
QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest;
@@ -89,9 +89,6 @@ BladeRF2InputGui::BladeRF2InputGui(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);
@@ -220,23 +217,6 @@ bool BladeRF2InputGui::handleMessage(const Message& message)
return true;
}
else if (BladeRF2Input::MsgFileRecord::match(message)) // API action "record" feedback
{
const BladeRF2Input::MsgFileRecord& notif = (const BladeRF2Input::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;
@@ -491,18 +471,6 @@ void BladeRF2InputGui::on_startStop_toggled(bool checked)
}
}
void BladeRF2InputGui::on_record_toggled(bool checked)
{
if (checked) {
ui->record->setStyleSheet("QToolButton { background-color : red; }");
} else {
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
}
BladeRF2Input::MsgFileRecord* message = BladeRF2Input::MsgFileRecord::create(checked);
m_sampleSource->getInputMessageQueue()->push(message);
}
void BladeRF2InputGui::on_sampleRateMode_toggled(bool checked)
{
m_sampleRateMode = checked;
@@ -573,29 +541,3 @@ void BladeRF2InputGui::openDeviceSettingsDialog(const QPoint& p)
sendSettings();
}
void BladeRF2InputGui::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();
}
}
}
@@ -92,12 +92,10 @@ private slots:
void on_gain_valueChanged(int value);
void on_transverter_clicked();
void on_startStop_toggled(bool checked);
void on_record_toggled(bool checked);
void on_sampleRateMode_toggled(bool checked);
void updateHardware();
void updateStatus();
void openDeviceSettingsDialog(const QPoint& p);
void openFileRecordDialog(const QPoint& p);
};
#endif /* PLUGINS_SAMPLESOURCE_BLADERF2INPUT_BLADERF2INPUTGUI_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>
@@ -32,7 +32,7 @@
const PluginDescriptor Blderf2InputPlugin::m_pluginDescriptor = {
QString("BladeRF2"),
QString("BladeRF2 Input"),
QString("4.14.5"),
QString("4.15.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@@ -40,7 +40,6 @@ void BladeRF2InputSettings::resetToDefaults()
m_transverterMode = false;
m_transverterDeltaFrequency = 0;
m_iqOrder = true;
m_fileRecordName = "";
m_useReverseAPI = false;
m_reverseAPIAddress = "127.0.0.1";
m_reverseAPIPort = 8888;
@@ -42,7 +42,6 @@ struct BladeRF2InputSettings {
bool m_transverterMode;
qint64 m_transverterDeltaFrequency;
bool m_iqOrder;
QString m_fileRecordName;
bool m_useReverseAPI;
QString m_reverseAPIAddress;
uint16_t m_reverseAPIPort;
@@ -37,11 +37,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>
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 (8).