1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 14:04:46 -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,11 +29,6 @@ Device start / stop button.
- Blue triangle icon: device is ready and can be started
- Green square icon: device is running and can be stopped
<h3>2: Record</h3>
- Left click: record baseband I/Q stream toggle button
- Right click: choose record file
<h3>3: Frequency</h3>
This is the center frequency in Hz sent in the meta data from the distant SDRangel instance and corresponds to the center frequency of reception. The sub kHz value (000 to 999 Hz) is represented in smaller digits on the right.
@@ -25,15 +25,12 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGDeviceActions.h"
#include "SWGRemoteInputReport.h"
#include "SWGRemoteInputActions.h"
#include "util/simpleserializer.h"
#include "dsp/dspcommands.h"
#include "dsp/dspengine.h"
#include "device/deviceapi.h"
#include "dsp/filerecord.h"
#include "remoteinput.h"
#include "remoteinputudphandler.h"
@@ -43,14 +40,12 @@ MESSAGE_CLASS_DEFINITION(RemoteInput::MsgConfigureRemoteInputTiming, Message)
MESSAGE_CLASS_DEFINITION(RemoteInput::MsgReportRemoteInputAcquisition, Message)
MESSAGE_CLASS_DEFINITION(RemoteInput::MsgReportRemoteInputStreamData, Message)
MESSAGE_CLASS_DEFINITION(RemoteInput::MsgReportRemoteInputStreamTiming, Message)
MESSAGE_CLASS_DEFINITION(RemoteInput::MsgFileRecord, Message)
MESSAGE_CLASS_DEFINITION(RemoteInput::MsgStartStop, Message)
RemoteInput::RemoteInput(DeviceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_sampleRate(48000),
m_mutex(QMutex::Recursive),
m_fileSink(nullptr),
m_settings(),
m_remoteInputUDPHandler(nullptr),
m_deviceDescription(),
@@ -71,13 +66,6 @@ RemoteInput::~RemoteInput()
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
delete m_networkManager;
stop();
if (m_fileSink)
{
m_deviceAPI->removeAncillarySink(m_fileSink);
delete m_fileSink;
}
delete m_remoteInputUDPHandler;
}
@@ -168,17 +156,7 @@ bool RemoteInput::isStreaming() const
bool RemoteInput::handleMessage(const Message& message)
{
if (DSPSignalNotification::match(message))
{
DSPSignalNotification& notif = (DSPSignalNotification&) message;
if (m_fileSink) {
return m_fileSink->handleMessage(notif); // forward to file sink
} else {
return false;
}
}
else if (RemoteInputUDPHandler::MsgReportSampleRateChange::match(message))
if (RemoteInputUDPHandler::MsgReportSampleRateChange::match(message))
{
RemoteInputUDPHandler::MsgReportSampleRateChange& notif = (RemoteInputUDPHandler::MsgReportSampleRateChange&) message;
int sampleRate = notif.getSampleRate();
@@ -193,38 +171,6 @@ bool RemoteInput::handleMessage(const Message& message)
return true;
}
else if (MsgFileRecord::match(message))
{
MsgFileRecord& conf = (MsgFileRecord&) message;
qDebug() << "RemoteInput::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;
@@ -287,9 +233,6 @@ void RemoteInput::applySettings(const RemoteInputSettings& settings, bool force)
if ((m_settings.m_apiPort != settings.m_apiPort) || force) {
reverseAPIKeys.append("apiPort");
}
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)
{
@@ -386,37 +329,6 @@ int RemoteInput::webapiSettingsPutPatch(
return 200;
}
int RemoteInput::webapiActionsPost(
const QStringList& deviceActionsKeys,
SWGSDRangel::SWGDeviceActions& query,
QString& errorMessage)
{
SWGSDRangel::SWGRemoteInputActions *swgRemoteInputActions = query.getRemoteInputActions();
if (swgRemoteInputActions)
{
if (deviceActionsKeys.contains("record"))
{
bool record = swgRemoteInputActions->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 RemoteInputActions in query";
return 400;
}
}
void RemoteInput::webapiUpdateDeviceSettings(
RemoteInputSettings& settings,
const QStringList& deviceSettingsKeys,
@@ -440,9 +352,6 @@ void RemoteInput::webapiUpdateDeviceSettings(
if (deviceSettingsKeys.contains("iqCorrection")) {
settings.m_iqCorrection = response.getRemoteInputSettings()->getIqCorrection() != 0;
}
if (deviceSettingsKeys.contains("fileRecordName")) {
settings.m_fileRecordName = *response.getRemoteInputSettings()->getFileRecordName();
}
if (deviceSettingsKeys.contains("useReverseAPI")) {
settings.m_useReverseAPI = response.getRemoteInputSettings()->getUseReverseApi() != 0;
}
@@ -466,12 +375,6 @@ void RemoteInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& res
response.getRemoteInputSettings()->setDcBlock(settings.m_dcBlock ? 1 : 0);
response.getRemoteInputSettings()->setIqCorrection(settings.m_iqCorrection);
if (response.getRemoteInputSettings()->getFileRecordName()) {
*response.getRemoteInputSettings()->getFileRecordName() = settings.m_fileRecordName;
} else {
response.getRemoteInputSettings()->setFileRecordName(new QString(settings.m_fileRecordName));
}
response.getRemoteInputSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
if (response.getRemoteInputSettings()->getReverseApiAddress()) {
@@ -537,9 +440,6 @@ void RemoteInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys,
if (deviceSettingsKeys.contains("iqCorrection") || force) {
swgRemoteInputSettings->setIqCorrection(settings.m_iqCorrection ? 1 : 0);
}
if (deviceSettingsKeys.contains("fileRecordName") || force) {
swgRemoteInputSettings->setFileRecordName(new QString(settings.m_fileRecordName));
}
QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings")
.arg(settings.m_reverseAPIAddress)
@@ -35,7 +35,6 @@ class QNetworkAccessManager;
class QNetworkReply;
class DeviceAPI;
class RemoteInputUDPHandler;
class FileRecord;
class RemoteInput : public DeviceSampleSource {
Q_OBJECT
@@ -230,25 +229,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
@@ -313,11 +293,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 RemoteInputSettings& settings);
@@ -336,7 +311,6 @@ private:
QString m_remoteAddress;
QString m_deviceDescription;
std::time_t m_startingTimeStamp;
FileRecord *m_fileSink; //!< File sink to record device I/Q output
QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest;
@@ -87,9 +87,6 @@ RemoteInputGui::RemoteInputGui(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_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
@@ -242,23 +239,6 @@ bool RemoteInputGui::handleMessage(const Message& message)
return true;
}
else if (RemoteInput::MsgFileRecord::match(message)) // API action "record" feedback
{
const RemoteInput::MsgFileRecord& notif = (const RemoteInput::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;
@@ -446,18 +426,6 @@ void RemoteInputGui::on_startStop_toggled(bool checked)
}
}
void RemoteInputGui::on_record_toggled(bool checked)
{
if (checked) {
ui->record->setStyleSheet("QToolButton { background-color : red; }");
} else {
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
}
RemoteInput::MsgFileRecord* message = RemoteInput::MsgFileRecord::create(checked);
m_sampleSource->getInputMessageQueue()->push(message);
}
void RemoteInputGui::on_eventCountsReset_clicked(bool checked)
{
(void) checked;
@@ -685,29 +653,3 @@ void RemoteInputGui::openDeviceSettingsDialog(const QPoint& p)
sendSettings();
}
void RemoteInputGui::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();
}
}
}
@@ -130,13 +130,11 @@ private slots:
void on_dataAddress_returnPressed();
void on_dataPort_returnPressed();
void on_startStop_toggled(bool checked);
void on_record_toggled(bool checked);
void on_eventCountsReset_clicked(bool checked);
void updateHardware();
void updateStatus();
void networkManagerFinished(QNetworkReply *reply);
void openDeviceSettingsDialog(const QPoint& p);
void openFileRecordDialog(const QPoint& p);
};
#endif // INCLUDE_REMOTEINPUTGUI_H
@@ -65,20 +65,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>:/record_off.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
@@ -31,7 +31,7 @@
const PluginDescriptor RemoteInputPlugin::m_pluginDescriptor = {
QString("RemoteInput"),
QString("Remote device input"),
QString("4.12.3"),
QString("4.15.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@@ -31,7 +31,6 @@ void RemoteInputSettings::resetToDefaults()
m_dataPort = 9090;
m_dcBlock = false;
m_iqCorrection = false;
m_fileRecordName = "";
m_useReverseAPI = false;
m_reverseAPIAddress = "127.0.0.1";
m_reverseAPIPort = 8888;
@@ -28,7 +28,6 @@ struct RemoteInputSettings {
quint16 m_dataPort;
bool m_dcBlock;
bool m_iqCorrection;
QString m_fileRecordName;
bool m_useReverseAPI;
QString m_reverseAPIAddress;
uint16_t m_reverseAPIPort;