1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-05 23:45:00 -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
@@ -17,7 +17,7 @@ set(bladerf1input_HEADERS
)
include_directories(
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
${CMAKE_SOURCE_DIR}/devices
${LIBBLADERF_INCLUDE_DIRS}
)
@@ -26,7 +26,6 @@ if(NOT SERVER_MODE)
set(bladerf1input_SOURCES
${bladerf1input_SOURCES}
bladerf1inputgui.cpp
bladerf1inputgui.ui
)
set(bladerf1input_HEADERS
@@ -54,13 +53,13 @@ if(ENABLE_EXTERNAL_LIBRARIES)
endif()
target_link_libraries(${TARGET_NAME}
Qt5::Core
${TARGET_LIB}
Qt5::Core
${TARGET_LIB}
sdrbase
${TARGET_LIB_GUI}
swagger
${LIBBLADERF_LIBRARIES}
bladerf1device
swagger
${LIBBLADERF_LIBRARIES}
bladerf1device
)
install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER})
@@ -24,15 +24,12 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceActions.h"
#include "SWGBladeRF1InputActions.h"
#include "util/simpleserializer.h"
#include "dsp/dspcommands.h"
#include "dsp/dspdevicesourceengine.h"
#include "dsp/dspdevicesinkengine.h"
#include "dsp/dspengine.h"
#include "dsp/filerecord.h"
#include "device/deviceapi.h"
#include "bladerf1input.h"
@@ -40,11 +37,9 @@
MESSAGE_CLASS_DEFINITION(Bladerf1Input::MsgConfigureBladerf1, Message)
MESSAGE_CLASS_DEFINITION(Bladerf1Input::MsgStartStop, Message)
MESSAGE_CLASS_DEFINITION(Bladerf1Input::MsgFileRecord, Message)
Bladerf1Input::Bladerf1Input(DeviceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_fileSink(nullptr),
m_settings(),
m_dev(0),
m_bladerfThread(nullptr),
@@ -52,10 +47,7 @@ Bladerf1Input::Bladerf1Input(DeviceAPI *deviceAPI) :
m_running(false)
{
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();
@@ -71,12 +63,6 @@ Bladerf1Input::~Bladerf1Input()
stop();
}
if (m_fileSink)
{
m_deviceAPI->removeAncillarySink(m_fileSink);
delete m_fileSink;
}
closeDevice();
m_deviceAPI->setBuddySharedPtr(0);
}
@@ -294,38 +280,6 @@ bool Bladerf1Input::handleMessage(const Message& message)
return true;
}
else if (MsgFileRecord::match(message))
{
MsgFileRecord& conf = (MsgFileRecord&) message;
qDebug() << "BladerfInput::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;
@@ -592,11 +546,6 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& 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);
}
@@ -674,12 +623,6 @@ void Bladerf1Input::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& r
response.getBladeRf1InputSettings()->setDcBlock(settings.m_dcBlock ? 1 : 0);
response.getBladeRf1InputSettings()->setIqCorrection(settings.m_iqCorrection ? 1 : 0);
if (response.getBladeRf1InputSettings()->getFileRecordName()) {
*response.getBladeRf1InputSettings()->getFileRecordName() = settings.m_fileRecordName;
} else {
response.getBladeRf1InputSettings()->setFileRecordName(new QString(settings.m_fileRecordName));
}
response.getBladeRf1InputSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
if (response.getBladeRf1InputSettings()->getReverseApiAddress()) {
@@ -762,9 +705,6 @@ void Bladerf1Input::webapiUpdateDeviceSettings(
if (deviceSettingsKeys.contains("iqCorrection")) {
settings.m_iqCorrection = response.getBladeRf1InputSettings()->getIqCorrection() != 0;
}
if (deviceSettingsKeys.contains("fileRecordName")) {
settings.m_fileRecordName = *response.getBladeRf1InputSettings()->getFileRecordName();
}
if (deviceSettingsKeys.contains("useReverseAPI")) {
settings.m_useReverseAPI = response.getBladeRf1InputSettings()->getUseReverseApi() != 0;
}
@@ -807,37 +747,6 @@ int Bladerf1Input::webapiRun(
return 200;
}
int Bladerf1Input::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGBladeRF1InputActions *swgBladeRF1InputActions = query.getBladeRf1InputActions();
if (swgBladeRF1InputActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgBladeRF1InputActions->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 BladeRF1InputActions in query";
return 400;
}
}
void Bladerf1Input::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF1InputSettings& settings, bool force)
{
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
@@ -891,9 +800,6 @@ void Bladerf1Input::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys
if (deviceSettingsKeys.contains("iqCorrection") || force) {
swgBladeRF1Settings->setIqCorrection(settings.m_iqCorrection ? 1 : 0);
}
if (deviceSettingsKeys.contains("fileRecordName") || force) {
swgBladeRF1Settings->setFileRecordName(new QString(settings.m_fileRecordName));
}
QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings")
.arg(settings.m_reverseAPIAddress)
@@ -25,15 +25,14 @@
#include <libbladeRF.h>
#include <dsp/devicesamplesource.h>
#include "../../../devices/bladerf1/devicebladerf1.h"
#include "../../../devices/bladerf1/devicebladerf1param.h"
#include "bladerf1/devicebladerf1.h"
#include "bladerf1/devicebladerf1param.h"
#include "bladerf1inputsettings.h"
class QNetworkAccessManager;
class QNetworkReply;
class DeviceAPI;
class Bladerf1InputThread;
class FileRecord;
class Bladerf1Input : public DeviceSampleSource {
Q_OBJECT
@@ -61,25 +60,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
@@ -138,11 +118,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 BladeRF1InputSettings& settings);
@@ -161,7 +136,6 @@ private:
QString m_deviceDescription;
DeviceBladeRF1Params m_sharedParams;
bool m_running;
FileRecord *m_fileSink; //!< File sink to record device I/Q output
QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest;
@@ -68,9 +68,6 @@ Bladerf1InputGui::Bladerf1InputGui(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);
@@ -156,23 +153,6 @@ bool Bladerf1InputGui::handleMessage(const Message& message)
return true;
}
else if (Bladerf1Input::MsgFileRecord::match(message)) // API action "record" feedback
{
const Bladerf1Input::MsgFileRecord& notif = (const Bladerf1Input::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;
@@ -455,18 +435,6 @@ void Bladerf1InputGui::on_startStop_toggled(bool checked)
}
}
void Bladerf1InputGui::on_record_toggled(bool checked)
{
if (checked) {
ui->record->setStyleSheet("QToolButton { background-color : red; }");
} else {
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
}
Bladerf1Input::MsgFileRecord* message = Bladerf1Input::MsgFileRecord::create(checked);
m_sampleSource->getInputMessageQueue()->push(message);
}
void Bladerf1InputGui::on_sampleRateMode_toggled(bool checked)
{
m_sampleRateMode = checked;
@@ -579,29 +547,3 @@ void Bladerf1InputGui::openDeviceSettingsDialog(const QPoint& p)
sendSettings();
}
void Bladerf1InputGui::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();
}
}
}
@@ -90,12 +90,10 @@ private slots:
void on_xb200_currentIndexChanged(int index);
void on_fcPos_currentIndexChanged(int index);
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 // INCLUDE_BLADERFINPUTGUI_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 Blderf1InputPlugin::m_pluginDescriptor = {
QString("BladeRF1"),
QString("BladeRF1 Input"),
QString("4.12.3"),
QString("4.15.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@@ -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 (4A) this is the baseband I/Q sample rate in kS/s. This is the device to host sample rate (4) divided by the decimation factor (5).