mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-02 06:04:39 -04:00
Removed file recording function from device plugins
This commit is contained in:
@@ -25,20 +25,16 @@
|
||||
#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)
|
||||
|
||||
@@ -50,9 +46,7 @@ LocalInput::LocalInput(DeviceAPI *deviceAPI) :
|
||||
{
|
||||
m_sampleFifo.setSize(96000 * 4);
|
||||
|
||||
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
|
||||
m_deviceAPI->setNbSourceStreams(1);
|
||||
m_deviceAPI->addAncillarySink(m_fileSink);
|
||||
|
||||
m_networkManager = new QNetworkAccessManager();
|
||||
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
||||
@@ -63,8 +57,6 @@ LocalInput::~LocalInput()
|
||||
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
||||
delete m_networkManager;
|
||||
stop();
|
||||
m_deviceAPI->removeAncillarySink(m_fileSink);
|
||||
delete m_fileSink;
|
||||
}
|
||||
|
||||
void LocalInput::destroy()
|
||||
@@ -165,34 +157,7 @@ void LocalInput::setCenterFrequency(qint64 centerFrequency)
|
||||
|
||||
bool LocalInput::handleMessage(const Message& message)
|
||||
{
|
||||
if (DSPSignalNotification::match(message))
|
||||
{
|
||||
DSPSignalNotification& notif = (DSPSignalNotification&) message;
|
||||
return m_fileSink->handleMessage(notif); // forward to file sink
|
||||
}
|
||||
else if (MsgFileRecord::match(message))
|
||||
{
|
||||
MsgFileRecord& conf = (MsgFileRecord&) message;
|
||||
qDebug() << "LocalInput::handleMessage: MsgFileRecord: " << conf.getStartStop();
|
||||
|
||||
if (conf.getStartStop())
|
||||
{
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSink->setFileName(m_settings.m_fileRecordName);
|
||||
} else {
|
||||
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
|
||||
}
|
||||
|
||||
m_fileSink->startRecording();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fileSink->stopRecording();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MsgStartStop::match(message))
|
||||
if (MsgStartStop::match(message))
|
||||
{
|
||||
MsgStartStop& cmd = (MsgStartStop&) message;
|
||||
qDebug() << "LocalInput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
|
||||
@@ -241,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)
|
||||
{
|
||||
@@ -270,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;
|
||||
}
|
||||
|
||||
@@ -336,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,
|
||||
@@ -378,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;
|
||||
}
|
||||
@@ -400,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()) {
|
||||
@@ -452,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)
|
||||
|
||||
Reference in New Issue
Block a user