From 5d9c6f4f57e09c3a7f35adb0a273b055a2916764 Mon Sep 17 00:00:00 2001 From: stefanino-ch Date: Mon, 15 Aug 2022 19:08:13 +0200 Subject: [PATCH 1/3] Iq recording can now be controlled via remote control interface. --- resources/remote-control.txt | 4 +++ src/applications/gqrx/mainwindow.cpp | 4 +++ src/applications/gqrx/remote_control.cpp | 35 ++++++++++++++++++++++++ src/applications/gqrx/remote_control.h | 5 ++++ src/qtgui/iq_tool.cpp | 29 +++++++++++++++++++- src/qtgui/iq_tool.h | 2 ++ 6 files changed, 78 insertions(+), 1 deletion(-) diff --git a/resources/remote-control.txt b/resources/remote-control.txt index d9e7679b28..2db5011a08 100644 --- a/resources/remote-control.txt +++ b/resources/remote-control.txt @@ -37,6 +37,10 @@ Supported commands: Get status of audio recorder U RECORD Set status of audio recorder to + u IQRECORD + Get status of IQ recorder + U IQRECORD + Set status of IQ recorder to u DSP Get DSP (SDR receiver) status U DSP diff --git a/src/applications/gqrx/mainwindow.cpp b/src/applications/gqrx/mainwindow.cpp index 72681f13af..854269907f 100644 --- a/src/applications/gqrx/mainwindow.cpp +++ b/src/applications/gqrx/mainwindow.cpp @@ -319,7 +319,9 @@ MainWindow::MainWindow(const QString& cfgfile, bool edit_conf, QWidget *parent) // I/Q playback connect(iq_tool, SIGNAL(startRecording(QString, QString)), this, SLOT(startIqRecording(QString, QString))); + connect(iq_tool, SIGNAL(startRecording(QString)), remote, SLOT(startIqRecorder(QString))); connect(iq_tool, SIGNAL(stopRecording()), this, SLOT(stopIqRecording())); + connect(iq_tool, SIGNAL(stopRecording()), remote, SLOT(stopIqRecorder())); connect(iq_tool, SIGNAL(startPlayback(QString,float,qint64)), this, SLOT(startIqPlayback(QString,float,qint64))); connect(iq_tool, SIGNAL(stopPlayback()), this, SLOT(stopIqPlayback())); connect(iq_tool, SIGNAL(seek(qint64)), this,SLOT(seekIqFile(qint64))); @@ -339,6 +341,8 @@ MainWindow::MainWindow(const QString& cfgfile, bool edit_conf, QWidget *parent) connect(uiDockRxOpt, SIGNAL(sqlLevelChanged(double)), remote, SLOT(setSquelchLevel(double))); connect(remote, SIGNAL(startAudioRecorderEvent()), uiDockAudio, SLOT(startAudioRecorder())); connect(remote, SIGNAL(stopAudioRecorderEvent()), uiDockAudio, SLOT(stopAudioRecorder())); + connect(remote, SIGNAL(startIqRecorderEvent()), iq_tool, SLOT(startIqRecorder())); + connect(remote, SIGNAL(stopIqRecorderEvent()), iq_tool, SLOT(stopIqRecorder())); connect(ui->plotter, SIGNAL(newFilterFreq(int, int)), remote, SLOT(setPassband(int, int))); connect(remote, SIGNAL(newPassband(int)), this, SLOT(setPassband(int))); connect(remote, SIGNAL(gainChanged(QString, double)), uiDockInputCtl, SLOT(setGain(QString,double))); diff --git a/src/applications/gqrx/remote_control.cpp b/src/applications/gqrx/remote_control.cpp index 70a3cf6879..ffd6fac1f3 100644 --- a/src/applications/gqrx/remote_control.cpp +++ b/src/applications/gqrx/remote_control.cpp @@ -50,6 +50,7 @@ RemoteControl::RemoteControl(QObject *parent) : squelch_level = -150.0; audio_gain = -6.0; audio_recorder_status = false; + iq_recorder_status = false; receiver_running = false; hamlib_compatible = false; is_audio_muted = false; @@ -376,6 +377,7 @@ void RemoteControl::setAudioMuted(bool muted) /*! \brief Start audio recorder (from mainwindow). */ void RemoteControl::startAudioRecorder(QString unused) { + /* Check first if a demodulation mode is set. */ if (rc_mode > 0) audio_recorder_status = true; } @@ -386,6 +388,18 @@ void RemoteControl::stopAudioRecorder() audio_recorder_status = false; } +/*! \brief Start iq recorder (from another window). */ +void RemoteControl::startIqRecorder(QString unused) +{ + iq_recorder_status = true; +} + +/*! \brief Stop iq recorder (from another window). */ +void RemoteControl::stopIqRecorder() +{ + iq_recorder_status = false; +} + /*! \brief Set receiver status (from mainwindow). */ void RemoteControl::setReceiverStatus(bool enabled) { @@ -764,6 +778,8 @@ QString RemoteControl::cmd_get_func(QStringList cmdlist) answer = QString("RECORD DSP RDS MUTE\n"); else if (func.compare("RECORD", Qt::CaseInsensitive) == 0) answer = QString("%1\n").arg(audio_recorder_status); + else if (func.compare("IQRECORD", Qt::CaseInsensitive) == 0) + answer = QString("%1\n").arg(iq_recorder_status); else if (func.compare("DSP", Qt::CaseInsensitive) == 0) answer = QString("%1\n").arg(receiver_running); else if (func.compare("RDS", Qt::CaseInsensitive) == 0) @@ -804,6 +820,25 @@ QString RemoteControl::cmd_set_func(QStringList cmdlist) emit stopAudioRecorderEvent(); } } + else if ((func.compare("IQRECORD", Qt::CaseInsensitive) == 0) && ok) + { + iq_recorder_status = status; + if (status) + { + if (receiver_running) + { + emit startIqRecorderEvent(); + answer = QString("RPRT 0\n"); + } + else + answer = QString("RPRT 1\n"); // Seend error + } + else + { + emit stopIqRecorderEvent(); + answer = QString("RPRT 0\n"); + } + } else if ((func.compare("DSP", Qt::CaseInsensitive) == 0) && ok) { if (status) diff --git a/src/applications/gqrx/remote_control.h b/src/applications/gqrx/remote_control.h index d16c1fd073..a5e1d8b6d2 100644 --- a/src/applications/gqrx/remote_control.h +++ b/src/applications/gqrx/remote_control.h @@ -96,6 +96,8 @@ public slots: void setAudioMuted(bool muted); void startAudioRecorder(QString unused); void stopAudioRecorder(); + void startIqRecorder(QString unused); + void stopIqRecorder(); bool setGain(QString name, double gain); void setRDSstatus(bool enabled); void rdsPI(QString program_id); @@ -112,6 +114,8 @@ public slots: void newAudioGain(float gain); void startAudioRecorderEvent(); void stopAudioRecorderEvent(); + void startIqRecorderEvent(); + void stopIqRecorderEvent(); void gainChanged(QString name, double value); void dspChanged(bool value); void newRDSmode(bool value); @@ -144,6 +148,7 @@ private slots: QString rds_station; /*!< RDS program service (station) name */ QString rds_radiotext; /*!< RDS Radiotext */ bool audio_recorder_status; /*!< Recording enabled */ + bool iq_recorder_status; /*!< Iq Recording enabled */ bool receiver_running; /*!< Whether the receiver is running or not */ bool hamlib_compatible; gain_list_t gains; /*!< Possible and current gain settings */ diff --git a/src/qtgui/iq_tool.cpp b/src/qtgui/iq_tool.cpp index b90bae8b15..56e3e890cf 100644 --- a/src/qtgui/iq_tool.cpp +++ b/src/qtgui/iq_tool.cpp @@ -165,7 +165,6 @@ void CIqTool::on_slider_valueChanged(int value) emit seek(seek_pos); } - /*! \brief Start/stop recording */ void CIqTool::on_recButton_clicked(bool checked) { @@ -186,6 +185,34 @@ void CIqTool::on_recButton_clicked(bool checked) } } +/*! Public slot to trig iq recording by external events (e.g. remote control). + * + * If a recording is already in progress we ignore the event. + */ +void CIqTool::startIqRecorder(void) +{ + if (ui->recButton->isChecked()) + { + qDebug() << __func__ << "An iq recording is already in progress"; + return; + } + + // emulate a button click + ui->recButton->click(); +} + +/*! Public slot to stop stop recording by external events (e.g. remote control). + * + * The event is ignored if no recording is in progress. + */ +void CIqTool::stopIqRecorder(void) +{ + if (ui->recButton->isChecked()) + ui->recButton->click(); // emulate a button click + else + qDebug() << __func__ << "No iq recording in progress"; +} + /*! \brief Cancel a recording. * * This slot can be activated to cancel an ongoing recording. Cancelling an diff --git a/src/qtgui/iq_tool.h b/src/qtgui/iq_tool.h index b078da708b..345aa5c0a7 100644 --- a/src/qtgui/iq_tool.h +++ b/src/qtgui/iq_tool.h @@ -71,6 +71,8 @@ class CIqTool : public QDialog public slots: void cancelRecording(); void cancelPlayback(); + void startIqRecorder(void); /*!< Used if Iq Recorder is started e.g from remote control */ + void stopIqRecorder(void); /*!< Used if Iq Recorder is stopped e.g. from remote control */ private slots: void on_recDirEdit_textChanged(const QString &text); From 9124f99497523a8b55154f350b3ea65fa95e2635 Mon Sep 17 00:00:00 2001 From: Clayton Smith Date: Fri, 7 Feb 2025 16:44:12 -0500 Subject: [PATCH 2/3] Cleanup --- src/applications/gqrx/mainwindow.cpp | 2 +- src/applications/gqrx/remote_control.cpp | 27 +++++++++++------------- src/applications/gqrx/remote_control.h | 6 +++--- src/qtgui/iq_tool.cpp | 8 +++---- src/qtgui/iq_tool.h | 4 ++-- 5 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/applications/gqrx/mainwindow.cpp b/src/applications/gqrx/mainwindow.cpp index 854269907f..a9023d2b0f 100644 --- a/src/applications/gqrx/mainwindow.cpp +++ b/src/applications/gqrx/mainwindow.cpp @@ -319,7 +319,7 @@ MainWindow::MainWindow(const QString& cfgfile, bool edit_conf, QWidget *parent) // I/Q playback connect(iq_tool, SIGNAL(startRecording(QString, QString)), this, SLOT(startIqRecording(QString, QString))); - connect(iq_tool, SIGNAL(startRecording(QString)), remote, SLOT(startIqRecorder(QString))); + connect(iq_tool, SIGNAL(startRecording(QString, QString)), remote, SLOT(startIqRecorder(QString, QString))); connect(iq_tool, SIGNAL(stopRecording()), this, SLOT(stopIqRecording())); connect(iq_tool, SIGNAL(stopRecording()), remote, SLOT(stopIqRecorder())); connect(iq_tool, SIGNAL(startPlayback(QString,float,qint64)), this, SLOT(startIqPlayback(QString,float,qint64))); diff --git a/src/applications/gqrx/remote_control.cpp b/src/applications/gqrx/remote_control.cpp index ffd6fac1f3..be29c73766 100644 --- a/src/applications/gqrx/remote_control.cpp +++ b/src/applications/gqrx/remote_control.cpp @@ -388,13 +388,13 @@ void RemoteControl::stopAudioRecorder() audio_recorder_status = false; } -/*! \brief Start iq recorder (from another window). */ -void RemoteControl::startIqRecorder(QString unused) +/*! \brief Start IQ recorder (from another window). */ +void RemoteControl::startIqRecorder(QString unused1, QString unused2) { iq_recorder_status = true; } -/*! \brief Stop iq recorder (from another window). */ +/*! \brief Stop IQ recorder (from another window). */ void RemoteControl::stopIqRecorder() { iq_recorder_status = false; @@ -775,7 +775,7 @@ QString RemoteControl::cmd_get_func(QStringList cmdlist) QString func = cmdlist.value(1, ""); if (func == "?") - answer = QString("RECORD DSP RDS MUTE\n"); + answer = QString("RECORD IQRECORD DSP RDS MUTE\n"); else if (func.compare("RECORD", Qt::CaseInsensitive) == 0) answer = QString("%1\n").arg(audio_recorder_status); else if (func.compare("IQRECORD", Qt::CaseInsensitive) == 0) @@ -802,7 +802,7 @@ QString RemoteControl::cmd_set_func(QStringList cmdlist) if (func == "?") { - answer = QString("RECORD DSP RDS MUTE\n"); + answer = QString("RECORD IQRECORD DSP RDS MUTE\n"); } else if ((func.compare("RECORD", Qt::CaseInsensitive) == 0) && ok) { @@ -822,21 +822,18 @@ QString RemoteControl::cmd_set_func(QStringList cmdlist) } else if ((func.compare("IQRECORD", Qt::CaseInsensitive) == 0) && ok) { - iq_recorder_status = status; - if (status) + if (!receiver_running) { - if (receiver_running) - { - emit startIqRecorderEvent(); - answer = QString("RPRT 0\n"); - } - else - answer = QString("RPRT 1\n"); // Seend error + answer = QString("RPRT 1\n"); } else { - emit stopIqRecorderEvent(); answer = QString("RPRT 0\n"); + iq_recorder_status = status; + if (status) + emit startIqRecorderEvent(); + else + emit stopIqRecorderEvent(); } } else if ((func.compare("DSP", Qt::CaseInsensitive) == 0) && ok) diff --git a/src/applications/gqrx/remote_control.h b/src/applications/gqrx/remote_control.h index a5e1d8b6d2..8084d36ef9 100644 --- a/src/applications/gqrx/remote_control.h +++ b/src/applications/gqrx/remote_control.h @@ -96,7 +96,7 @@ public slots: void setAudioMuted(bool muted); void startAudioRecorder(QString unused); void stopAudioRecorder(); - void startIqRecorder(QString unused); + void startIqRecorder(QString unused1, QString unused2); void stopIqRecorder(); bool setGain(QString name, double gain); void setRDSstatus(bool enabled); @@ -147,8 +147,8 @@ private slots: QString rc_program_id; /*!< RDS Program identification */ QString rds_station; /*!< RDS program service (station) name */ QString rds_radiotext; /*!< RDS Radiotext */ - bool audio_recorder_status; /*!< Recording enabled */ - bool iq_recorder_status; /*!< Iq Recording enabled */ + bool audio_recorder_status; /*!< Audio recording enabled */ + bool iq_recorder_status; /*!< IQ recording enabled */ bool receiver_running; /*!< Whether the receiver is running or not */ bool hamlib_compatible; gain_list_t gains; /*!< Possible and current gain settings */ diff --git a/src/qtgui/iq_tool.cpp b/src/qtgui/iq_tool.cpp index 56e3e890cf..6a376d7fcc 100644 --- a/src/qtgui/iq_tool.cpp +++ b/src/qtgui/iq_tool.cpp @@ -185,7 +185,7 @@ void CIqTool::on_recButton_clicked(bool checked) } } -/*! Public slot to trig iq recording by external events (e.g. remote control). +/*! Public slot to start IQ recording by external events (e.g. remote control). * * If a recording is already in progress we ignore the event. */ @@ -193,7 +193,7 @@ void CIqTool::startIqRecorder(void) { if (ui->recButton->isChecked()) { - qDebug() << __func__ << "An iq recording is already in progress"; + qDebug() << __func__ << "An IQ recording is already in progress"; return; } @@ -201,7 +201,7 @@ void CIqTool::startIqRecorder(void) ui->recButton->click(); } -/*! Public slot to stop stop recording by external events (e.g. remote control). +/*! Public slot to stop IQ recording by external events (e.g. remote control). * * The event is ignored if no recording is in progress. */ @@ -210,7 +210,7 @@ void CIqTool::stopIqRecorder(void) if (ui->recButton->isChecked()) ui->recButton->click(); // emulate a button click else - qDebug() << __func__ << "No iq recording in progress"; + qDebug() << __func__ << "No IQ recording in progress"; } /*! \brief Cancel a recording. diff --git a/src/qtgui/iq_tool.h b/src/qtgui/iq_tool.h index 345aa5c0a7..dc56bd35a9 100644 --- a/src/qtgui/iq_tool.h +++ b/src/qtgui/iq_tool.h @@ -71,8 +71,8 @@ class CIqTool : public QDialog public slots: void cancelRecording(); void cancelPlayback(); - void startIqRecorder(void); /*!< Used if Iq Recorder is started e.g from remote control */ - void stopIqRecorder(void); /*!< Used if Iq Recorder is stopped e.g. from remote control */ + void startIqRecorder(void); /*!< Used if IQ Recorder is started e.g. from remote control */ + void stopIqRecorder(void); /*!< Used if IQ Recorder is stopped e.g. from remote control */ private slots: void on_recDirEdit_textChanged(const QString &text); From 034bdf86f01a64b37a480fc39a8b704a6e659f9a Mon Sep 17 00:00:00 2001 From: Clayton Smith Date: Fri, 7 Feb 2025 16:50:01 -0500 Subject: [PATCH 3/3] Update news --- resources/news.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources/news.txt b/resources/news.txt index 72fae95e78..33f04a7847 100644 --- a/resources/news.txt +++ b/resources/news.txt @@ -1,4 +1,9 @@ + 2.17.7: In progress... + + NEW: Start/stop I/Q recording via remote control. + + 2.17.6: Released November 29, 2024 NEW: Fetch RDS Program Service & RadioText via remote control.