mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-19 06:08:51 -04:00
Removed file recording function from device plugins
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user