From 5cad053158750762d3e9d2a2adaaf874ed7bb7ff Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 6 Mar 2023 21:20:40 +0100 Subject: [PATCH] PTT feature: GPIO and command support (1) --- plugins/feature/simpleptt/CMakeLists.txt | 4 + .../feature/simpleptt/simplepttcommand.cpp | 158 ++++++++++ plugins/feature/simpleptt/simplepttcommand.h | 55 ++++ plugins/feature/simpleptt/simplepttgui.ui | 263 ++++++++++++++++- .../feature/simpleptt/simplepttmessages.cpp | 21 ++ plugins/feature/simpleptt/simplepttmessages.h | 80 ++++++ .../feature/simpleptt/simplepttsettings.cpp | 77 +++++ plugins/feature/simpleptt/simplepttsettings.h | 19 ++ plugins/feature/simpleptt/simplepttworker.cpp | 56 ++++ plugins/feature/simpleptt/simplepttworker.h | 9 +- sdrbase/resources/webapi/doc/html2/index.html | 269 ++++-------------- .../doc/swagger/include/ChannelReport.yaml | 4 - .../doc/swagger/include/ChannelSettings.yaml | 4 - .../webapi/doc/swagger/include/SimplePTT.yaml | 53 ++++ .../api/swagger/include/SimplePTT.yaml | 53 ++++ swagger/sdrangel/code/html2/index.html | 269 ++++-------------- .../code/qt5/client/SWGSimplePTTSettings.cpp | 257 +++++++++++++++++ .../code/qt5/client/SWGSimplePTTSettings.h | 66 +++++ 18 files changed, 1265 insertions(+), 452 deletions(-) create mode 100644 plugins/feature/simpleptt/simplepttcommand.cpp create mode 100644 plugins/feature/simpleptt/simplepttcommand.h create mode 100644 plugins/feature/simpleptt/simplepttmessages.cpp create mode 100644 plugins/feature/simpleptt/simplepttmessages.h diff --git a/plugins/feature/simpleptt/CMakeLists.txt b/plugins/feature/simpleptt/CMakeLists.txt index ebb651830..64ff045d0 100644 --- a/plugins/feature/simpleptt/CMakeLists.txt +++ b/plugins/feature/simpleptt/CMakeLists.txt @@ -7,6 +7,8 @@ set(simpleptt_SOURCES simplepttworker.cpp simplepttreport.cpp simplepttwebapiadapter.cpp + simplepttcommand.cpp + simplepttmessages.cpp ) set(simpleptt_HEADERS @@ -16,6 +18,8 @@ set(simpleptt_HEADERS simplepttworker.h simplepttreport.h simplepttwebapiadapter.h + simplepttcommand.h + simplepttmessages.h ) include_directories( diff --git a/plugins/feature/simpleptt/simplepttcommand.cpp b/plugins/feature/simpleptt/simplepttcommand.cpp new file mode 100644 index 000000000..8e329d6ac --- /dev/null +++ b/plugins/feature/simpleptt/simplepttcommand.cpp @@ -0,0 +1,158 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2023 Edouard Griffiths, F4EXB // +// // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation as version 3 of the License, or // +// (at your option) any later version. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License V3 for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +/////////////////////////////////////////////////////////////////////////////////// +#include "util/timeutil.h" +#include "util/messagequeue.h" + +#include "simplepttmessages.h" +#include "simplepttcommand.h" + +SimplePTTCommand::SimplePTTCommand() : + m_currentProcess(nullptr), + m_currentProcessState(QProcess::NotRunning), + m_isInError(false), + m_currentProcessError(QProcess::UnknownError), + m_hasExited(false), + m_currentProcessExitCode(0), + m_currentProcessExitStatus(QProcess::NormalExit), + m_currentProcessPid(0), + m_msgQueueToGUI(nullptr) +{ + m_currentProcessStartTimeStampms = 0; + m_currentProcessFinishTimeStampms = 0; +} + +SimplePTTCommand::~SimplePTTCommand() +{ + if (m_currentProcess) + { +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) + disconnect(m_currentProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); +#else + disconnect(m_currentProcess, SIGNAL(errorOccurred(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); +#endif + disconnect(m_currentProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus))); + disconnect(m_currentProcess, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(processStateChanged(QProcess::ProcessState))); + m_currentProcess->deleteLater(); + } +} + +void SimplePTTCommand::processStateChanged(QProcess::ProcessState newState) +{ + //qDebug("Command::processStateChanged: %d", newState); + if (newState == QProcess::Running) { + m_currentProcessPid = m_currentProcess->processId(); + } + + m_currentProcessState = newState; +} + +void SimplePTTCommand::processError(QProcess::ProcessError error) +{ + //qDebug("Command::processError: %d state: %d", error, m_currentProcessState); + m_currentProcessFinishTimeStampms = TimeUtil::nowms(); + m_currentProcessError = error; + m_isInError = true; + + SimplePTTMessages::MsgCommandError *msg = SimplePTTMessages::MsgCommandError::create( + m_currentProcessFinishTimeStampms, m_currentProcessError + ); + + if (m_currentProcessState == QProcess::NotRunning) + { + m_log = m_currentProcess->readAllStandardOutput(); + msg->getLog() = m_log; + +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) + disconnect(m_currentProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); +#else + disconnect(m_currentProcess, SIGNAL(errorOccurred(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); +#endif + disconnect(m_currentProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus))); + disconnect(m_currentProcess, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(processStateChanged(QProcess::ProcessState))); + + m_currentProcess->deleteLater(); // make sure other threads can still access it until all events have been processed + m_currentProcess = nullptr; // for this thread it can assume it was deleted + } + + if (m_msgQueueToGUI) { + m_msgQueueToGUI->push(msg); + } else { + delete msg; + } +} + + +void SimplePTTCommand::processFinished(int exitCode, QProcess::ExitStatus exitStatus) +{ + //qDebug("Command::processFinished: (%d) %d", exitCode, exitStatus); + m_currentProcessFinishTimeStampms = TimeUtil::nowms(); + m_currentProcessExitCode = exitCode; + m_currentProcessExitStatus = exitStatus; + m_hasExited = true; + m_log = m_currentProcess->readAllStandardOutput(); + + if (m_msgQueueToGUI) + { + SimplePTTMessages::MsgCommandFinished *msg = SimplePTTMessages::MsgCommandFinished::create( + m_currentProcessFinishTimeStampms, + exitCode, + exitStatus + ); + msg->getLog() = m_log; + m_msgQueueToGUI->push(msg); + } + +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) + disconnect(m_currentProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); +#else + disconnect(m_currentProcess, SIGNAL(errorOccurred(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); +#endif + disconnect(m_currentProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus))); + disconnect(m_currentProcess, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(processStateChanged(QProcess::ProcessState))); + + m_currentProcess->deleteLater(); // make sure other threads can still access it until all events have been processed + m_currentProcess = nullptr; // for this thread it can assume it was deleted +} + +void SimplePTTCommand::run(const QString& command, int rxDeviceSetIndex, double rxCenterFrequency, int txDeviceSetIndex, double txCenterFrequency) +{ + if (command == "") { + return; + } + + m_currentProcess = new QProcess(this); + m_isInError = false; + m_hasExited = false; + QString args = QString("%1 %2 %3 %4").arg(rxDeviceSetIndex).arg(rxCenterFrequency).arg(txDeviceSetIndex).arg(txCenterFrequency); + +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) + connect(m_currentProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); +#else + connect(m_currentProcess, SIGNAL(errorOccurred(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); +#endif + connect(m_currentProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus))); + connect(m_currentProcess, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(processStateChanged(QProcess::ProcessState))); + + m_currentProcess->setProcessChannelMode(QProcess::MergedChannels); + m_currentProcessStartTimeStampms = TimeUtil::nowms(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QStringList allArgs = args.split(" ", Qt::SkipEmptyParts); +#else + QStringList allArgs = args.split(" ", QString::SkipEmptyParts); +#endif + m_currentProcess->start(command, allArgs); +} diff --git a/plugins/feature/simpleptt/simplepttcommand.h b/plugins/feature/simpleptt/simplepttcommand.h new file mode 100644 index 000000000..881031711 --- /dev/null +++ b/plugins/feature/simpleptt/simplepttcommand.h @@ -0,0 +1,55 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2023 Edouard Griffiths, F4EXB // +// // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation as version 3 of the License, or // +// (at your option) any later version. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License V3 for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +/////////////////////////////////////////////////////////////////////////////////// +#ifndef INCLUDE_FEATURE_SIMPLEPTTCOMMAND_H_ +#define INCLUDE_FEATURE_SIMPLEPTTCOMMAND_H_ + +#include +#include + +class MessageQueue; + +class SimplePTTCommand : public QObject +{ + Q_OBJECT +public: + SimplePTTCommand(); + ~SimplePTTCommand(); + void setMessageQueueToGUI(MessageQueue *messageQueue) { m_msgQueueToGUI = messageQueue; } + void run(const QString& command, int rxDeviceSetIndex, double rxCenterFrequency, int txDeviceSetIndex, double txCenterFrequency); + const QString& getLastLog() { return m_log; } + +private: + QProcess *m_currentProcess; + qint64 m_currentProcessPid; + QProcess::ProcessState m_currentProcessState; + QString m_log; + uint64_t m_currentProcessStartTimeStampms; + uint64_t m_currentProcessFinishTimeStampms; + bool m_isInError; + QProcess::ProcessError m_currentProcessError; + int m_currentProcessExitCode; + QProcess::ExitStatus m_currentProcessExitStatus; + bool m_hasExited; + MessageQueue *m_msgQueueToGUI; //!< Queue to report state to GUI + +private slots: + void processStateChanged(QProcess::ProcessState newState); + void processError(QProcess::ProcessError error); + void processFinished(int exitCode, QProcess::ExitStatus exitStatus); +}; + +#endif // INCLUDE_FEATURE_SIMPLEPTTCOMMAND_H_ diff --git a/plugins/feature/simpleptt/simplepttgui.ui b/plugins/feature/simpleptt/simplepttgui.ui index 1fcdbd163..c00b1df61 100644 --- a/plugins/feature/simpleptt/simplepttgui.ui +++ b/plugins/feature/simpleptt/simplepttgui.ui @@ -7,7 +7,7 @@ 0 0 320 - 155 + 305 @@ -25,7 +25,7 @@ 560 - 155 + 305 @@ -43,7 +43,7 @@ 2 2 300 - 151 + 291 @@ -444,6 +444,263 @@ + + + + + + Rx-Tx Cmd + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + Choose Rx to Tx command + + + + + + + :/load.png:/load.png + + + + + + + Rx to Tx command + + + ... + + + + + + + + + + + Tx-Rx Cmd + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + Choose Tx to Rx command + + + + + + + :/load.png:/load.png + + + + + + + Tx to Rx command + + + ... + + + + + + + + + + + Rx-Tx GPIO + + + + + + + Rx to Tx GPIO mask (1 byte hex) + + + Mask + + + + + + + + 35 + 16777215 + + + + HH + + + + + + + Rx to Tx GPIO value (1 byte hex) + + + Val + + + + + + + + 35 + 16777215 + + + + HH + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Rx has GPIO controls + + + Rx + + + + + + + + + + + Tx-Rx GPIO + + + + + + + Mask + + + + + + + + 35 + 16777215 + + + + Tx to Rx GPIO mask (1 byte hex) + + + HH + + + + + + + + + + Val + + + + + + + + 35 + 16777215 + + + + Tx to Rx GPIO value (1 byte hex) + + + HH + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Tx has GPIO controls + + + Tx + + + + + diff --git a/plugins/feature/simpleptt/simplepttmessages.cpp b/plugins/feature/simpleptt/simplepttmessages.cpp new file mode 100644 index 000000000..fe61f1c50 --- /dev/null +++ b/plugins/feature/simpleptt/simplepttmessages.cpp @@ -0,0 +1,21 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2023 Edouard Griffiths, F4EXB // +// // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation as version 3 of the License, or // +// (at your option) any later version. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License V3 for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +/////////////////////////////////////////////////////////////////////////////////// +#include "simplepttmessages.h" + +MESSAGE_CLASS_DEFINITION(SimplePTTMessages::MsgCommandError, Message) +MESSAGE_CLASS_DEFINITION(SimplePTTMessages::MsgCommandFinished, Message) + diff --git a/plugins/feature/simpleptt/simplepttmessages.h b/plugins/feature/simpleptt/simplepttmessages.h new file mode 100644 index 000000000..a3cf1ce05 --- /dev/null +++ b/plugins/feature/simpleptt/simplepttmessages.h @@ -0,0 +1,80 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2023 Edouard Griffiths, F4EXB // +// // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation as version 3 of the License, or // +// (at your option) any later version. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License V3 for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +/////////////////////////////////////////////////////////////////////////////////// +#ifndef INCLUDE_FEATURE_SIMPLEPTTMESSAGES_H_ +#define INCLUDE_FEATURE_SIMPLEPTTMESSAGES_H_ + +#include + +#include "util/message.h" + +class SimplePTTMessages : public QObject { + Q_OBJECT +public: + class MsgCommandError : public Message { + MESSAGE_CLASS_DECLARATION + + public: + uint64_t getFinishedTimeStamp() { return m_finishedTimeStamp; } + int getError() { return m_error; } + QString& getLog() { return m_log; } + + static MsgCommandError* create(uint64_t finishedTimeStamp, int error) { + return new MsgCommandError(finishedTimeStamp, error); + } + + private: + uint64_t m_finishedTimeStamp; + int m_error; + QString m_log; + + MsgCommandError(uint64_t finishedTimeStamp, int error) : + Message(), + m_finishedTimeStamp(finishedTimeStamp), + m_error(error) + { } + }; + + class MsgCommandFinished : public Message { + MESSAGE_CLASS_DECLARATION + + public: + uint64_t getFinishedTimeStamp() { return m_finishedTimeStamp; } + int getExitCode() { return m_exitCode; } + int getExitStatus() { return m_exitStatus; } + QString& getLog() { return m_log; } + + static MsgCommandFinished* create(uint64_t finishedTimeStamp, int exitCode, int exitStatus) { + return new MsgCommandFinished(finishedTimeStamp, exitCode, exitStatus); + } + + private: + uint64_t m_finishedTimeStamp; + int m_exitCode; + int m_exitStatus; + QString m_log; + + MsgCommandFinished(uint64_t finishedTimeStamp, int exitCode, int exitStatus) : + Message(), + m_finishedTimeStamp(finishedTimeStamp), + m_exitCode(exitCode), + m_exitStatus(exitStatus) + { } + }; +}; + + +#endif // INCLUDE_FEATURE_SIMPLEPTTMESSAGES_H_ diff --git a/plugins/feature/simpleptt/simplepttsettings.cpp b/plugins/feature/simpleptt/simplepttsettings.cpp index 55ff4b61a..0281e33db 100644 --- a/plugins/feature/simpleptt/simplepttsettings.cpp +++ b/plugins/feature/simpleptt/simplepttsettings.cpp @@ -42,6 +42,17 @@ void SimplePTTSettings::resetToDefaults() m_voxHold = 500; m_vox = false; m_voxEnable = false; + m_gpioControl = GPIONone; + m_rx2txCommandEnable = false; + m_rx2txGPIOMask = 0; + m_rx2txGPIOValues = 0; + m_rx2txCommandEnable = false; + m_rx2txCommand = ""; + m_tx2rxGPIOEnable = false; + m_tx2rxGPIOMask = 0; + m_tx2rxGPIOValues = 0; + m_tx2rxCommandEnable = false; + m_tx2rxCommand = ""; m_useReverseAPI = false; m_reverseAPIAddress = "127.0.0.1"; m_reverseAPIPort = 8888; @@ -77,6 +88,17 @@ QByteArray SimplePTTSettings::serialize() const s.writeS32(17, m_voxHold); s.writeS32(18, m_workspaceIndex); s.writeBlob(19, m_geometryBytes); + s.writeS32(20, (int) m_gpioControl); + s.writeBool(21, m_rx2txGPIOEnable); + s.writeS32(22, m_rx2txGPIOMask); + s.writeS32(23, m_rx2txGPIOValues); + s.writeBool(24, m_rx2txCommandEnable); + s.writeString(25, m_rx2txCommand); + s.writeBool(26, m_tx2rxGPIOEnable); + s.writeS32(27, m_tx2rxGPIOMask); + s.writeS32(28, m_tx2rxGPIOValues); + s.writeBool(29, m_tx2rxCommandEnable); + s.writeString(30, m_tx2rxCommand); return s.final(); } @@ -96,6 +118,7 @@ bool SimplePTTSettings::deserialize(const QByteArray& data) QByteArray bytetmp; uint32_t utmp; QString strtmp; + int32_t tmp; d.readString(1, &m_title, "Simple PTT"); d.readU32(2, &m_rgbColor, QColor(255, 0, 0).rgb()); @@ -131,6 +154,18 @@ bool SimplePTTSettings::deserialize(const QByteArray& data) d.readS32(17, &m_voxHold, 500); d.readS32(18, &m_workspaceIndex, 0); d.readBlob(19, &m_geometryBytes); + d.readS32(20, &tmp, 0); + m_gpioControl = (GPIOControl) tmp; + d.readBool(21, &m_rx2txGPIOEnable, false); + d.readS32(22, &m_rx2txGPIOMask, 0); + d.readS32(23, &m_rx2txGPIOValues, 0); + d.readBool(24, &m_rx2txCommandEnable, false); + d.readString(25, &m_rx2txCommand, ""); + d.readBool(26, &m_tx2rxGPIOEnable, false); + d.readS32(27, &m_tx2rxGPIOMask, 0); + d.readS32(28, &m_tx2rxGPIOValues, 0); + d.readBool(29, &m_tx2rxCommandEnable, false); + d.readString(30, &m_tx2rxCommand, ""); return true; } @@ -176,6 +211,27 @@ void SimplePTTSettings::applySettings(const QStringList& settingsKeys, const Sim if (settingsKeys.contains("voxEnable")) { m_voxEnable = settings.m_voxEnable; } + if (settingsKeys.contains("gpioControl")) { + m_gpioControl = settings.m_gpioControl; + } + if (settingsKeys.contains("rx2txGPIOMask")) { + m_rx2txGPIOMask = settings.m_rx2txGPIOMask; + } + if (settingsKeys.contains("rx2txGPIOValues")) { + m_rx2txGPIOValues = settings.m_rx2txGPIOValues; + } + if (settingsKeys.contains("rx2txCommand")) { + m_rx2txCommand = settings.m_rx2txCommand; + } + if (settingsKeys.contains("tx2rxGPIOMask")) { + m_tx2rxGPIOMask = settings.m_tx2rxGPIOMask; + } + if (settingsKeys.contains("tx2rxGPIOValues")) { + m_tx2rxGPIOValues = settings.m_tx2rxGPIOValues; + } + if (settingsKeys.contains("tx2rxCommand")) { + m_tx2rxCommand = settings.m_tx2rxCommand; + } if (settingsKeys.contains("useReverseAPI")) { m_useReverseAPI = settings.m_useReverseAPI; } @@ -224,6 +280,27 @@ QString SimplePTTSettings::getDebugString(const QStringList& settingsKeys, bool if (settingsKeys.contains("voxLevel") || force) { ostr << " m_voxLevel: " << m_voxLevel; } + if (settingsKeys.contains("gpioControl") || force) { + ostr << " m_gpioControl: " << m_gpioControl; + } + if (settingsKeys.contains("rx2txGPIOMask") || force) { + ostr << " m_rx2txGPIOMask: " << m_rx2txGPIOMask; + } + if (settingsKeys.contains("rx2txGPIOValues") || force) { + ostr << " m_rx2txGPIOValues: " << m_rx2txGPIOValues; + } + if (settingsKeys.contains("rx2txCommand") || force) { + ostr << " m_rx2txCommand: " << m_rx2txCommand.toStdString(); + } + if (settingsKeys.contains("tx2rxGPIOMask") || force) { + ostr << " m_tx2rxGPIOMask: " << m_tx2rxGPIOMask; + } + if (settingsKeys.contains("tx2rxGPIOValues") || force) { + ostr << " m_tx2rxGPIOValues: " << m_tx2rxGPIOValues; + } + if (settingsKeys.contains("tx2rxCommand") || force) { + ostr << " m_tx2rxCommand: " << m_tx2rxCommand.toStdString(); + } if (settingsKeys.contains("useReverseAPI") || force) { ostr << " m_useReverseAPI: " << m_useReverseAPI; } diff --git a/plugins/feature/simpleptt/simplepttsettings.h b/plugins/feature/simpleptt/simplepttsettings.h index 82acb101c..5ef3e2c41 100644 --- a/plugins/feature/simpleptt/simplepttsettings.h +++ b/plugins/feature/simpleptt/simplepttsettings.h @@ -25,6 +25,13 @@ class Serializable; struct SimplePTTSettings { + enum GPIOControl + { + GPIONone, + GPIORx, + GPIOTx + }; + QString m_title; quint32 m_rgbColor; int m_rxDeviceSetIndex; @@ -36,6 +43,18 @@ struct SimplePTTSettings int m_voxHold; //!< Vox hold in milliseconds bool m_vox; bool m_voxEnable; + GPIOControl m_gpioControl; + + bool m_rx2txGPIOEnable; + int m_rx2txGPIOMask; + int m_rx2txGPIOValues; + bool m_rx2txCommandEnable; + QString m_rx2txCommand; + bool m_tx2rxGPIOEnable; + int m_tx2rxGPIOMask; + int m_tx2rxGPIOValues; + bool m_tx2rxCommandEnable; + QString m_tx2rxCommand; bool m_useReverseAPI; QString m_reverseAPIAddress; uint16_t m_reverseAPIPort; diff --git a/plugins/feature/simpleptt/simplepttworker.cpp b/plugins/feature/simpleptt/simplepttworker.cpp index 6e8603302..6f06fa482 100644 --- a/plugins/feature/simpleptt/simplepttworker.cpp +++ b/plugins/feature/simpleptt/simplepttworker.cpp @@ -25,6 +25,7 @@ #include "audio/audiodevicemanager.h" #include "dsp/dspengine.h" #include "util/db.h" +#include "channel/channelwebapiutils.h" #include "simplepttreport.h" #include "simplepttworker.h" @@ -174,6 +175,7 @@ void SimplePTTWorker::sendPTT(bool tx) if (m_settings.m_rxDeviceSetIndex >= 0) { m_tx = false; + preSwitch(true); switchedOff = turnDevice(false); } @@ -188,6 +190,7 @@ void SimplePTTWorker::sendPTT(bool tx) if (m_settings.m_txDeviceSetIndex >= 0) { m_tx = true; + preSwitch(false); switchedOff = turnDevice(false); } @@ -249,6 +252,59 @@ bool SimplePTTWorker::turnDevice(bool on) } } +void SimplePTTWorker::preSwitch(bool tx) +{ + double rxFrequency = 0; + double txFrequency = 0; + ChannelWebAPIUtils::getCenterFrequency(m_settings.m_rxDeviceSetIndex, rxFrequency); + ChannelWebAPIUtils::getCenterFrequency(m_settings.m_txDeviceSetIndex, txFrequency); + + m_command.run( + tx ? m_settings.m_rx2txCommand : m_settings.m_tx2rxCommand, + m_settings.m_rxDeviceSetIndex, + rxFrequency, + m_settings.m_txDeviceSetIndex, + txFrequency + ); + + if (m_settings.m_gpioControl == SimplePTTSettings::GPIONone) { + return; + } + + int gpioMask; + int gpioPins; + int gpioDir; + int deviceSetIndex = m_settings.m_gpioControl == SimplePTTSettings::GPIOTx ? m_settings.m_txDeviceSetIndex : m_settings.m_rxDeviceSetIndex; + + if (!ChannelWebAPIUtils::getDeviceSetting(deviceSetIndex, "gpioDir", gpioDir)) + { + qDebug() << "SimplePTTWorker::preSwitch - Failed to read gpioDir setting. Does this SDR support it?"; + return; + } + + gpioMask = tx ? m_settings.m_rx2txGPIOMask : m_settings.m_tx2rxGPIOMask; + gpioDir |= gpioMask; // set masked pins as outputs + + if (!ChannelWebAPIUtils::patchDeviceSetting(deviceSetIndex, "gpioDir", gpioDir)) + { + qDebug() << "SimplePTTWorker::preSwitch - Failed to write gpioDir setting. Does this SDR support it?"; + return; + } + + if (!ChannelWebAPIUtils::getDeviceSetting(deviceSetIndex, "gpioPins", gpioPins)) + { + qDebug() << "SimplePTTWorker::preSwitch - Failed to read gpioPins setting. Does this SDR support it?"; + return; + } + + gpioPins != gpioMask & (tx ? m_settings.m_rx2txGPIOValues : m_settings.m_tx2rxGPIOValues); + gpioPins &= ~gpioMask | (tx ? m_settings.m_rx2txGPIOValues : m_settings.m_tx2rxGPIOValues); + + if (!ChannelWebAPIUtils::patchDeviceSetting(deviceSetIndex, "gpioPins", gpioPins)) { + qDebug() << "SimplePTTWorker::preSwitch - Failed to write gpioPins setting. Does this SDR support it?"; + } +} + void SimplePTTWorker::handleAudio() { unsigned int nbRead; diff --git a/plugins/feature/simpleptt/simplepttworker.h b/plugins/feature/simpleptt/simplepttworker.h index 2305c376c..cc81cfbdc 100644 --- a/plugins/feature/simpleptt/simplepttworker.h +++ b/plugins/feature/simpleptt/simplepttworker.h @@ -26,6 +26,7 @@ #include "audio/audiofifo.h" #include "simplepttsettings.h" +#include "simplepttcommand.h" class WebAPIAdapterInterface; @@ -84,7 +85,11 @@ public: void startWork(); void stopWork(); MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } - void setMessageQueueToGUI(MessageQueue *messageQueue) { m_msgQueueToGUI = messageQueue; } + + void setMessageQueueToGUI(MessageQueue *messageQueue) { + m_msgQueueToGUI = messageQueue; + m_command.setMessageQueueToGUI(messageQueue); + } void getAudioPeak(float& peak) { @@ -106,6 +111,7 @@ private: float m_voxLevel; int m_voxHoldCount; bool m_voxState; + SimplePTTCommand m_command; QTimer m_updateTimer; QRecursiveMutex m_mutex; @@ -113,6 +119,7 @@ private: void applySettings(const SimplePTTSettings& settings, const QList& settingsKeys, bool force = false); void sendPTT(bool tx); bool turnDevice(bool on); + void preSwitch(bool tx); private slots: void handleInputMessages(); diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index c773bcbb9..14cf152d4 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -2449,18 +2449,6 @@ margin-bottom: 20px; "type" : "integer", "description" : "Audio channel to IQ mapping\n * 0 - I=L, Q=0\n * 1 - I=R, Q=0\n * 2 - I=L, Q=R\n * 3 - I=R, Q=L\n" }, - "dcBlock" : { - "type" : "integer", - "description" : "Auto DC blocking\n * 0 - Off\n * 1 - On\n" - }, - "iqImbalance" : { - "type" : "integer", - "description" : "Auto IQ balance (you need auto DC blocking active)\n * 0 - Off\n * 1 - On\n" - }, - "fcPos" : { - "type" : "integer", - "description" : "Decimated bandpass center frequency position\n * 0 - Infradyne\n * 1 - Supradyne\n * 2 - Centered\n" - }, "useReverseAPI" : { "type" : "integer", "description" : "Synchronize with reverse API (1 for yes, 0 for no)" @@ -3532,9 +3520,6 @@ margin-bottom: 20px; "FT8DemodReport" : { "$ref" : "#/definitions/FT8DemodReport" }, - "RTTYDemodReport" : { - "$ref" : "#/definitions/RTTYDemodReport" - }, "HeatMapReport" : { "$ref" : "#/definitions/HeatMapReport" }, @@ -3544,9 +3529,6 @@ margin-bottom: 20px; "M17ModReport" : { "$ref" : "#/definitions/M17ModReport" }, - "NavtexDemodReport" : { - "$ref" : "#/definitions/NavtexDemodReport" - }, "NFMDemodReport" : { "$ref" : "#/definitions/NFMDemodReport" }, @@ -3696,9 +3678,6 @@ margin-bottom: 20px; "FT8DemodSettings" : { "$ref" : "#/definitions/FT8DemodSettings" }, - "RTTYDemodSettings" : { - "$ref" : "#/definitions/RTTYDemodSettings" - }, "HeatMapSettings" : { "$ref" : "#/definitions/HeatMapSettings" }, @@ -3714,9 +3693,6 @@ margin-bottom: 20px; "M17ModSettings" : { "$ref" : "#/definitions/M17ModSettings" }, - "NavtexDemodSettings" : { - "$ref" : "#/definitions/NavtexDemodSettings" - }, "NFMDemodSettings" : { "$ref" : "#/definitions/NFMDemodSettings" }, @@ -9720,94 +9696,6 @@ margin-bottom: 20px; } }, "description" : "Enumeration with name for values" -}; - defs.NavtexDemodReport = { - "properties" : { - "channelPowerDB" : { - "type" : "number", - "format" : "float", - "description" : "power received in channel (dB)" - }, - "channelSampleRate" : { - "type" : "integer" - } - }, - "description" : "ACARSDemod" -}; - defs.NavtexDemodSettings = { - "properties" : { - "inputFrequencyOffset" : { - "type" : "integer", - "format" : "int64" - }, - "rfBandwidth" : { - "type" : "number", - "format" : "float" - }, - "navArea" : { - "type" : "integer" - }, - "filterStation" : { - "type" : "string" - }, - "filterType" : { - "type" : "string" - }, - "udpEnabled" : { - "type" : "integer", - "description" : "Whether to forward received messages to specified UDP port" - }, - "udpAddress" : { - "type" : "string", - "description" : "UDP address to forward received messages to" - }, - "udpPort" : { - "type" : "integer", - "description" : "UDP port to forward received messages to" - }, - "logFilename" : { - "type" : "string" - }, - "logEnabled" : { - "type" : "integer" - }, - "rgbColor" : { - "type" : "integer" - }, - "title" : { - "type" : "string" - }, - "streamIndex" : { - "type" : "integer", - "description" : "MIMO channel. Not relevant when connected to SI (single Rx)." - }, - "useReverseAPI" : { - "type" : "integer", - "description" : "Synchronize with reverse API (1 for yes, 0 for no)" - }, - "reverseAPIAddress" : { - "type" : "string" - }, - "reverseAPIPort" : { - "type" : "integer" - }, - "reverseAPIDeviceIndex" : { - "type" : "integer" - }, - "reverseAPIChannelIndex" : { - "type" : "integer" - }, - "scopeConfig" : { - "$ref" : "#/definitions/GLScope" - }, - "channelMarker" : { - "$ref" : "#/definitions/ChannelMarker" - }, - "rollupState" : { - "$ref" : "#/definitions/RollupState" - } - }, - "description" : "ACARSDemod" }; defs.NoiseFigureReport = { "properties" : { @@ -11161,110 +11049,6 @@ margin-bottom: 20px; "format" : "float" } } -}; - defs.RTTYDemodReport = { - "properties" : { - "channelPowerDB" : { - "type" : "number", - "format" : "float", - "description" : "power received in channel (dB)" - }, - "channelSampleRate" : { - "type" : "integer" - } - }, - "description" : "ACARSDemod" -}; - defs.RTTYDemodSettings = { - "properties" : { - "inputFrequencyOffset" : { - "type" : "integer", - "format" : "int64" - }, - "rfBandwidth" : { - "type" : "number", - "format" : "float" - }, - "baudRate" : { - "type" : "number", - "format" : "float" - }, - "frequencyShift" : { - "type" : "integer" - }, - "udpEnabled" : { - "type" : "integer", - "description" : "Whether to forward received messages to specified UDP port" - }, - "udpAddress" : { - "type" : "string", - "description" : "UDP address to forward received messages to" - }, - "udpPort" : { - "type" : "integer", - "description" : "UDP port to forward received messages to" - }, - "characterSet" : { - "type" : "integer" - }, - "suppressCRLF" : { - "type" : "integer" - }, - "unshiftOnSpace" : { - "type" : "integer" - }, - "msbFirst" : { - "type" : "integer" - }, - "spaceHigh" : { - "type" : "integer" - }, - "squelch" : { - "type" : "integer" - }, - "logFilename" : { - "type" : "string" - }, - "logEnabled" : { - "type" : "integer" - }, - "rgbColor" : { - "type" : "integer" - }, - "title" : { - "type" : "string" - }, - "streamIndex" : { - "type" : "integer", - "description" : "MIMO channel. Not relevant when connected to SI (single Rx)." - }, - "useReverseAPI" : { - "type" : "integer", - "description" : "Synchronize with reverse API (1 for yes, 0 for no)" - }, - "reverseAPIAddress" : { - "type" : "string" - }, - "reverseAPIPort" : { - "type" : "integer" - }, - "reverseAPIDeviceIndex" : { - "type" : "integer" - }, - "reverseAPIChannelIndex" : { - "type" : "integer" - }, - "scopeConfig" : { - "$ref" : "#/definitions/GLScope" - }, - "channelMarker" : { - "$ref" : "#/definitions/ChannelMarker" - }, - "rollupState" : { - "$ref" : "#/definitions/RollupState" - } - }, - "description" : "ACARSDemod" }; defs.RadioAstronomyActions = { "properties" : { @@ -13452,6 +13236,54 @@ margin-bottom: 20px; "audioDeviceName" : { "type" : "string" }, + "gpioControl" : { + "type" : "integer", + "description" : "GPIO control\n * 0 - No GPIO control\n * 1 - Rx side controls GPIO\n * 2 - Tx side controls GPIO\n" + }, + "rx2txGPIOEnable" : { + "type" : "integer", + "description" : "Enable Rx to Tx GPIO control\n * 0 - disable\n * 1 - enable\n" + }, + "rx2txGPIOMask" : { + "type" : "integer", + "format" : "int8", + "description" : "Rx to Tx change GPIO mask" + }, + "rx2txGPIOValues" : { + "type" : "integer", + "format" : "int8", + "description" : "Rx to Tx change GPIO values" + }, + "rx2txCommandEnable" : { + "type" : "integer", + "description" : "Enable Rx to Tx command\n * 0 - disable\n * 1 - enable\n" + }, + "rx2txCommand" : { + "type" : "string", + "description" : "Command to be executed when Rx switches to Tx" + }, + "tx2rxGPIOEnable" : { + "type" : "integer", + "description" : "Enable Tx to Rx GPIO control\n * 0 - disable\n * 1 - enable\n" + }, + "tx2rxGPIOMask" : { + "type" : "integer", + "format" : "int8", + "description" : "Tx to Rx change GPIO mask" + }, + "tx2rxGPIOValues" : { + "type" : "integer", + "format" : "int8", + "description" : "Tx to Rx change GPIO values" + }, + "tx2rxCommandEnable" : { + "type" : "integer", + "description" : "Enable Tx to Rx command\n * 0 - disable\n * 1 - enable\n" + }, + "tx2rxCommand" : { + "type" : "string", + "description" : "Command to be executed when Tx switches to Rx" + }, "useReverseAPI" : { "type" : "integer", "description" : "Synchronize with reverse API (1 for yes, 0 for no)" @@ -15109,9 +14941,6 @@ margin-bottom: 20px; "audioMute" : { "type" : "integer" }, - "identBandpassEnable" : { - "type" : "integer" - }, "rgbColor" : { "type" : "integer" }, @@ -57260,7 +57089,7 @@ except ApiException as e:
- Generated 2023-03-11T09:38:49.252+01:00 + Generated 2023-03-01T20:50:44.079+01:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/ChannelReport.yaml b/sdrbase/resources/webapi/doc/swagger/include/ChannelReport.yaml index 1697138e5..5e72b6691 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/ChannelReport.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/ChannelReport.yaml @@ -51,16 +51,12 @@ ChannelReport: $ref: "/doc/swagger/include/FreqTracker.yaml#/FreqTrackerReport" FT8DemodReport: $ref: "/doc/swagger/include/FT8Demod.yaml#/FT8DemodReport" - RTTYDemodReport: - $ref: "/doc/swagger/include/RTTYDemod.yaml#/RTTYDemodReport" HeatMapReport: $ref: "/doc/swagger/include/HeatMap.yaml#/HeatMapReport" M17DemodReport: $ref: "/doc/swagger/include/M17Demod.yaml#/M17DemodReport" M17ModReport: $ref: "/doc/swagger/include/M17Mod.yaml#/M17ModReport" - NavtexDemodReport: - $ref: "/doc/swagger/include/NavtexDemod.yaml#/NavtexDemodReport" NFMDemodReport: $ref: "/doc/swagger/include/NFMDemod.yaml#/NFMDemodReport" NFMModReport: diff --git a/sdrbase/resources/webapi/doc/swagger/include/ChannelSettings.yaml b/sdrbase/resources/webapi/doc/swagger/include/ChannelSettings.yaml index 10855b93a..d675d621f 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/ChannelSettings.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/ChannelSettings.yaml @@ -65,8 +65,6 @@ ChannelSettings: $ref: "/doc/swagger/include/FreqTracker.yaml#/FreqTrackerSettings" FT8DemodSettings: $ref: "/doc/swagger/include/FT8Demod.yaml#/FT8DemodSettings" - RTTYDemodSettings: - $ref: "/doc/swagger/include/RTTYDemod.yaml#/RTTYDemodSettings" HeatMapSettings: $ref: "/doc/swagger/include/HeatMap.yaml#/HeatMapSettings" InterferometerSettings: @@ -77,8 +75,6 @@ ChannelSettings: $ref: "/doc/swagger/include/M17Demod.yaml#/M17DemodSettings" M17ModSettings: $ref: "/doc/swagger/include/M17Mod.yaml#/M17ModSettings" - NavtexDemodSettings: - $ref: "/doc/swagger/include/NavtexDemod.yaml#/NavtexDemodSettings" NFMDemodSettings: $ref: "/doc/swagger/include/NFMDemod.yaml#/NFMDemodSettings" NFMModSettings: diff --git a/sdrbase/resources/webapi/doc/swagger/include/SimplePTT.yaml b/sdrbase/resources/webapi/doc/swagger/include/SimplePTT.yaml index 4f8945f5c..a52fa66d6 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/SimplePTT.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/SimplePTT.yaml @@ -37,6 +37,59 @@ SimplePTTSettings: description: Vox hold timeout in milliseconds audioDeviceName: type: string + gpioControl: + type: integer + description: > + GPIO control + * 0 - No GPIO control + * 1 - Rx side controls GPIO + * 2 - Tx side controls GPIO + rx2txGPIOEnable: + type: integer + description: > + Enable Rx to Tx GPIO control + * 0 - disable + * 1 - enable + rx2txGPIOMask: + type: integer + format: int8 + description: Rx to Tx change GPIO mask + rx2txGPIOValues: + type: integer + format: int8 + description: Rx to Tx change GPIO values + rx2txCommandEnable: + type: integer + description: > + Enable Rx to Tx command + * 0 - disable + * 1 - enable + rx2txCommand: + type: string + description: Command to be executed when Rx switches to Tx + tx2rxGPIOEnable: + type: integer + description: > + Enable Tx to Rx GPIO control + * 0 - disable + * 1 - enable + tx2rxGPIOMask: + type: integer + format: int8 + description: Tx to Rx change GPIO mask + tx2rxGPIOValues: + type: integer + format: int8 + description: Tx to Rx change GPIO values + tx2rxCommandEnable: + type: integer + description: > + Enable Tx to Rx command + * 0 - disable + * 1 - enable + tx2rxCommand: + type: string + description: Command to be executed when Tx switches to Rx useReverseAPI: description: Synchronize with reverse API (1 for yes, 0 for no) type: integer diff --git a/swagger/sdrangel/api/swagger/include/SimplePTT.yaml b/swagger/sdrangel/api/swagger/include/SimplePTT.yaml index b11cadd9d..80a0862af 100644 --- a/swagger/sdrangel/api/swagger/include/SimplePTT.yaml +++ b/swagger/sdrangel/api/swagger/include/SimplePTT.yaml @@ -37,6 +37,59 @@ SimplePTTSettings: description: Vox hold timeout in milliseconds audioDeviceName: type: string + gpioControl: + type: integer + description: > + GPIO control + * 0 - No GPIO control + * 1 - Rx side controls GPIO + * 2 - Tx side controls GPIO + rx2txGPIOEnable: + type: integer + description: > + Enable Rx to Tx GPIO control + * 0 - disable + * 1 - enable + rx2txGPIOMask: + type: integer + format: int8 + description: Rx to Tx change GPIO mask + rx2txGPIOValues: + type: integer + format: int8 + description: Rx to Tx change GPIO values + rx2txCommandEnable: + type: integer + description: > + Enable Rx to Tx command + * 0 - disable + * 1 - enable + rx2txCommand: + type: string + description: Command to be executed when Rx switches to Tx + tx2rxGPIOEnable: + type: integer + description: > + Enable Tx to Rx GPIO control + * 0 - disable + * 1 - enable + tx2rxGPIOMask: + type: integer + format: int8 + description: Tx to Rx change GPIO mask + tx2rxGPIOValues: + type: integer + format: int8 + description: Tx to Rx change GPIO values + tx2rxCommandEnable: + type: integer + description: > + Enable Tx to Rx command + * 0 - disable + * 1 - enable + tx2rxCommand: + type: string + description: Command to be executed when Tx switches to Rx useReverseAPI: description: Synchronize with reverse API (1 for yes, 0 for no) type: integer diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index c773bcbb9..14cf152d4 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -2449,18 +2449,6 @@ margin-bottom: 20px; "type" : "integer", "description" : "Audio channel to IQ mapping\n * 0 - I=L, Q=0\n * 1 - I=R, Q=0\n * 2 - I=L, Q=R\n * 3 - I=R, Q=L\n" }, - "dcBlock" : { - "type" : "integer", - "description" : "Auto DC blocking\n * 0 - Off\n * 1 - On\n" - }, - "iqImbalance" : { - "type" : "integer", - "description" : "Auto IQ balance (you need auto DC blocking active)\n * 0 - Off\n * 1 - On\n" - }, - "fcPos" : { - "type" : "integer", - "description" : "Decimated bandpass center frequency position\n * 0 - Infradyne\n * 1 - Supradyne\n * 2 - Centered\n" - }, "useReverseAPI" : { "type" : "integer", "description" : "Synchronize with reverse API (1 for yes, 0 for no)" @@ -3532,9 +3520,6 @@ margin-bottom: 20px; "FT8DemodReport" : { "$ref" : "#/definitions/FT8DemodReport" }, - "RTTYDemodReport" : { - "$ref" : "#/definitions/RTTYDemodReport" - }, "HeatMapReport" : { "$ref" : "#/definitions/HeatMapReport" }, @@ -3544,9 +3529,6 @@ margin-bottom: 20px; "M17ModReport" : { "$ref" : "#/definitions/M17ModReport" }, - "NavtexDemodReport" : { - "$ref" : "#/definitions/NavtexDemodReport" - }, "NFMDemodReport" : { "$ref" : "#/definitions/NFMDemodReport" }, @@ -3696,9 +3678,6 @@ margin-bottom: 20px; "FT8DemodSettings" : { "$ref" : "#/definitions/FT8DemodSettings" }, - "RTTYDemodSettings" : { - "$ref" : "#/definitions/RTTYDemodSettings" - }, "HeatMapSettings" : { "$ref" : "#/definitions/HeatMapSettings" }, @@ -3714,9 +3693,6 @@ margin-bottom: 20px; "M17ModSettings" : { "$ref" : "#/definitions/M17ModSettings" }, - "NavtexDemodSettings" : { - "$ref" : "#/definitions/NavtexDemodSettings" - }, "NFMDemodSettings" : { "$ref" : "#/definitions/NFMDemodSettings" }, @@ -9720,94 +9696,6 @@ margin-bottom: 20px; } }, "description" : "Enumeration with name for values" -}; - defs.NavtexDemodReport = { - "properties" : { - "channelPowerDB" : { - "type" : "number", - "format" : "float", - "description" : "power received in channel (dB)" - }, - "channelSampleRate" : { - "type" : "integer" - } - }, - "description" : "ACARSDemod" -}; - defs.NavtexDemodSettings = { - "properties" : { - "inputFrequencyOffset" : { - "type" : "integer", - "format" : "int64" - }, - "rfBandwidth" : { - "type" : "number", - "format" : "float" - }, - "navArea" : { - "type" : "integer" - }, - "filterStation" : { - "type" : "string" - }, - "filterType" : { - "type" : "string" - }, - "udpEnabled" : { - "type" : "integer", - "description" : "Whether to forward received messages to specified UDP port" - }, - "udpAddress" : { - "type" : "string", - "description" : "UDP address to forward received messages to" - }, - "udpPort" : { - "type" : "integer", - "description" : "UDP port to forward received messages to" - }, - "logFilename" : { - "type" : "string" - }, - "logEnabled" : { - "type" : "integer" - }, - "rgbColor" : { - "type" : "integer" - }, - "title" : { - "type" : "string" - }, - "streamIndex" : { - "type" : "integer", - "description" : "MIMO channel. Not relevant when connected to SI (single Rx)." - }, - "useReverseAPI" : { - "type" : "integer", - "description" : "Synchronize with reverse API (1 for yes, 0 for no)" - }, - "reverseAPIAddress" : { - "type" : "string" - }, - "reverseAPIPort" : { - "type" : "integer" - }, - "reverseAPIDeviceIndex" : { - "type" : "integer" - }, - "reverseAPIChannelIndex" : { - "type" : "integer" - }, - "scopeConfig" : { - "$ref" : "#/definitions/GLScope" - }, - "channelMarker" : { - "$ref" : "#/definitions/ChannelMarker" - }, - "rollupState" : { - "$ref" : "#/definitions/RollupState" - } - }, - "description" : "ACARSDemod" }; defs.NoiseFigureReport = { "properties" : { @@ -11161,110 +11049,6 @@ margin-bottom: 20px; "format" : "float" } } -}; - defs.RTTYDemodReport = { - "properties" : { - "channelPowerDB" : { - "type" : "number", - "format" : "float", - "description" : "power received in channel (dB)" - }, - "channelSampleRate" : { - "type" : "integer" - } - }, - "description" : "ACARSDemod" -}; - defs.RTTYDemodSettings = { - "properties" : { - "inputFrequencyOffset" : { - "type" : "integer", - "format" : "int64" - }, - "rfBandwidth" : { - "type" : "number", - "format" : "float" - }, - "baudRate" : { - "type" : "number", - "format" : "float" - }, - "frequencyShift" : { - "type" : "integer" - }, - "udpEnabled" : { - "type" : "integer", - "description" : "Whether to forward received messages to specified UDP port" - }, - "udpAddress" : { - "type" : "string", - "description" : "UDP address to forward received messages to" - }, - "udpPort" : { - "type" : "integer", - "description" : "UDP port to forward received messages to" - }, - "characterSet" : { - "type" : "integer" - }, - "suppressCRLF" : { - "type" : "integer" - }, - "unshiftOnSpace" : { - "type" : "integer" - }, - "msbFirst" : { - "type" : "integer" - }, - "spaceHigh" : { - "type" : "integer" - }, - "squelch" : { - "type" : "integer" - }, - "logFilename" : { - "type" : "string" - }, - "logEnabled" : { - "type" : "integer" - }, - "rgbColor" : { - "type" : "integer" - }, - "title" : { - "type" : "string" - }, - "streamIndex" : { - "type" : "integer", - "description" : "MIMO channel. Not relevant when connected to SI (single Rx)." - }, - "useReverseAPI" : { - "type" : "integer", - "description" : "Synchronize with reverse API (1 for yes, 0 for no)" - }, - "reverseAPIAddress" : { - "type" : "string" - }, - "reverseAPIPort" : { - "type" : "integer" - }, - "reverseAPIDeviceIndex" : { - "type" : "integer" - }, - "reverseAPIChannelIndex" : { - "type" : "integer" - }, - "scopeConfig" : { - "$ref" : "#/definitions/GLScope" - }, - "channelMarker" : { - "$ref" : "#/definitions/ChannelMarker" - }, - "rollupState" : { - "$ref" : "#/definitions/RollupState" - } - }, - "description" : "ACARSDemod" }; defs.RadioAstronomyActions = { "properties" : { @@ -13452,6 +13236,54 @@ margin-bottom: 20px; "audioDeviceName" : { "type" : "string" }, + "gpioControl" : { + "type" : "integer", + "description" : "GPIO control\n * 0 - No GPIO control\n * 1 - Rx side controls GPIO\n * 2 - Tx side controls GPIO\n" + }, + "rx2txGPIOEnable" : { + "type" : "integer", + "description" : "Enable Rx to Tx GPIO control\n * 0 - disable\n * 1 - enable\n" + }, + "rx2txGPIOMask" : { + "type" : "integer", + "format" : "int8", + "description" : "Rx to Tx change GPIO mask" + }, + "rx2txGPIOValues" : { + "type" : "integer", + "format" : "int8", + "description" : "Rx to Tx change GPIO values" + }, + "rx2txCommandEnable" : { + "type" : "integer", + "description" : "Enable Rx to Tx command\n * 0 - disable\n * 1 - enable\n" + }, + "rx2txCommand" : { + "type" : "string", + "description" : "Command to be executed when Rx switches to Tx" + }, + "tx2rxGPIOEnable" : { + "type" : "integer", + "description" : "Enable Tx to Rx GPIO control\n * 0 - disable\n * 1 - enable\n" + }, + "tx2rxGPIOMask" : { + "type" : "integer", + "format" : "int8", + "description" : "Tx to Rx change GPIO mask" + }, + "tx2rxGPIOValues" : { + "type" : "integer", + "format" : "int8", + "description" : "Tx to Rx change GPIO values" + }, + "tx2rxCommandEnable" : { + "type" : "integer", + "description" : "Enable Tx to Rx command\n * 0 - disable\n * 1 - enable\n" + }, + "tx2rxCommand" : { + "type" : "string", + "description" : "Command to be executed when Tx switches to Rx" + }, "useReverseAPI" : { "type" : "integer", "description" : "Synchronize with reverse API (1 for yes, 0 for no)" @@ -15109,9 +14941,6 @@ margin-bottom: 20px; "audioMute" : { "type" : "integer" }, - "identBandpassEnable" : { - "type" : "integer" - }, "rgbColor" : { "type" : "integer" }, @@ -57260,7 +57089,7 @@ except ApiException as e:
- Generated 2023-03-11T09:38:49.252+01:00 + Generated 2023-03-01T20:50:44.079+01:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGSimplePTTSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGSimplePTTSettings.cpp index ae13fa200..dac6e6de7 100644 --- a/swagger/sdrangel/code/qt5/client/SWGSimplePTTSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGSimplePTTSettings.cpp @@ -50,6 +50,28 @@ SWGSimplePTTSettings::SWGSimplePTTSettings() { m_vox_hold_isSet = false; audio_device_name = nullptr; m_audio_device_name_isSet = false; + gpio_control = 0; + m_gpio_control_isSet = false; + rx2tx_gpio_enable = 0; + m_rx2tx_gpio_enable_isSet = false; + rx2tx_gpio_mask = 0; + m_rx2tx_gpio_mask_isSet = false; + rx2tx_gpio_values = 0; + m_rx2tx_gpio_values_isSet = false; + rx2tx_command_enable = 0; + m_rx2tx_command_enable_isSet = false; + rx2tx_command = nullptr; + m_rx2tx_command_isSet = false; + tx2rx_gpio_enable = 0; + m_tx2rx_gpio_enable_isSet = false; + tx2rx_gpio_mask = 0; + m_tx2rx_gpio_mask_isSet = false; + tx2rx_gpio_values = 0; + m_tx2rx_gpio_values_isSet = false; + tx2rx_command_enable = 0; + m_tx2rx_command_enable_isSet = false; + tx2rx_command = nullptr; + m_tx2rx_command_isSet = false; use_reverse_api = 0; m_use_reverse_api_isSet = false; reverse_api_address = nullptr; @@ -92,6 +114,28 @@ SWGSimplePTTSettings::init() { m_vox_hold_isSet = false; audio_device_name = new QString(""); m_audio_device_name_isSet = false; + gpio_control = 0; + m_gpio_control_isSet = false; + rx2tx_gpio_enable = 0; + m_rx2tx_gpio_enable_isSet = false; + rx2tx_gpio_mask = 0; + m_rx2tx_gpio_mask_isSet = false; + rx2tx_gpio_values = 0; + m_rx2tx_gpio_values_isSet = false; + rx2tx_command_enable = 0; + m_rx2tx_command_enable_isSet = false; + rx2tx_command = new QString(""); + m_rx2tx_command_isSet = false; + tx2rx_gpio_enable = 0; + m_tx2rx_gpio_enable_isSet = false; + tx2rx_gpio_mask = 0; + m_tx2rx_gpio_mask_isSet = false; + tx2rx_gpio_values = 0; + m_tx2rx_gpio_values_isSet = false; + tx2rx_command_enable = 0; + m_tx2rx_command_enable_isSet = false; + tx2rx_command = new QString(""); + m_tx2rx_command_isSet = false; use_reverse_api = 0; m_use_reverse_api_isSet = false; reverse_api_address = new QString(""); @@ -124,6 +168,21 @@ SWGSimplePTTSettings::cleanup() { delete audio_device_name; } + + + + + if(rx2tx_command != nullptr) { + delete rx2tx_command; + } + + + + + if(tx2rx_command != nullptr) { + delete tx2rx_command; + } + if(reverse_api_address != nullptr) { delete reverse_api_address; } @@ -168,6 +227,28 @@ SWGSimplePTTSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&audio_device_name, pJson["audioDeviceName"], "QString", "QString"); + ::SWGSDRangel::setValue(&gpio_control, pJson["gpioControl"], "qint32", ""); + + ::SWGSDRangel::setValue(&rx2tx_gpio_enable, pJson["rx2txGPIOEnable"], "qint32", ""); + + ::SWGSDRangel::setValue(&rx2tx_gpio_mask, pJson["rx2txGPIOMask"], "qint32", ""); + + ::SWGSDRangel::setValue(&rx2tx_gpio_values, pJson["rx2txGPIOValues"], "qint32", ""); + + ::SWGSDRangel::setValue(&rx2tx_command_enable, pJson["rx2txCommandEnable"], "qint32", ""); + + ::SWGSDRangel::setValue(&rx2tx_command, pJson["rx2txCommand"], "QString", "QString"); + + ::SWGSDRangel::setValue(&tx2rx_gpio_enable, pJson["tx2rxGPIOEnable"], "qint32", ""); + + ::SWGSDRangel::setValue(&tx2rx_gpio_mask, pJson["tx2rxGPIOMask"], "qint32", ""); + + ::SWGSDRangel::setValue(&tx2rx_gpio_values, pJson["tx2rxGPIOValues"], "qint32", ""); + + ::SWGSDRangel::setValue(&tx2rx_command_enable, pJson["tx2rxCommandEnable"], "qint32", ""); + + ::SWGSDRangel::setValue(&tx2rx_command, pJson["tx2rxCommand"], "QString", "QString"); + ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", ""); ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString"); @@ -229,6 +310,39 @@ SWGSimplePTTSettings::asJsonObject() { if(audio_device_name != nullptr && *audio_device_name != QString("")){ toJsonValue(QString("audioDeviceName"), audio_device_name, obj, QString("QString")); } + if(m_gpio_control_isSet){ + obj->insert("gpioControl", QJsonValue(gpio_control)); + } + if(m_rx2tx_gpio_enable_isSet){ + obj->insert("rx2txGPIOEnable", QJsonValue(rx2tx_gpio_enable)); + } + if(m_rx2tx_gpio_mask_isSet){ + obj->insert("rx2txGPIOMask", QJsonValue(rx2tx_gpio_mask)); + } + if(m_rx2tx_gpio_values_isSet){ + obj->insert("rx2txGPIOValues", QJsonValue(rx2tx_gpio_values)); + } + if(m_rx2tx_command_enable_isSet){ + obj->insert("rx2txCommandEnable", QJsonValue(rx2tx_command_enable)); + } + if(rx2tx_command != nullptr && *rx2tx_command != QString("")){ + toJsonValue(QString("rx2txCommand"), rx2tx_command, obj, QString("QString")); + } + if(m_tx2rx_gpio_enable_isSet){ + obj->insert("tx2rxGPIOEnable", QJsonValue(tx2rx_gpio_enable)); + } + if(m_tx2rx_gpio_mask_isSet){ + obj->insert("tx2rxGPIOMask", QJsonValue(tx2rx_gpio_mask)); + } + if(m_tx2rx_gpio_values_isSet){ + obj->insert("tx2rxGPIOValues", QJsonValue(tx2rx_gpio_values)); + } + if(m_tx2rx_command_enable_isSet){ + obj->insert("tx2rxCommandEnable", QJsonValue(tx2rx_command_enable)); + } + if(tx2rx_command != nullptr && *tx2rx_command != QString("")){ + toJsonValue(QString("tx2rxCommand"), tx2rx_command, obj, QString("QString")); + } if(m_use_reverse_api_isSet){ obj->insert("useReverseAPI", QJsonValue(use_reverse_api)); } @@ -361,6 +475,116 @@ SWGSimplePTTSettings::setAudioDeviceName(QString* audio_device_name) { this->m_audio_device_name_isSet = true; } +qint32 +SWGSimplePTTSettings::getGpioControl() { + return gpio_control; +} +void +SWGSimplePTTSettings::setGpioControl(qint32 gpio_control) { + this->gpio_control = gpio_control; + this->m_gpio_control_isSet = true; +} + +qint32 +SWGSimplePTTSettings::getRx2txGpioEnable() { + return rx2tx_gpio_enable; +} +void +SWGSimplePTTSettings::setRx2txGpioEnable(qint32 rx2tx_gpio_enable) { + this->rx2tx_gpio_enable = rx2tx_gpio_enable; + this->m_rx2tx_gpio_enable_isSet = true; +} + +qint32 +SWGSimplePTTSettings::getRx2txGpioMask() { + return rx2tx_gpio_mask; +} +void +SWGSimplePTTSettings::setRx2txGpioMask(qint32 rx2tx_gpio_mask) { + this->rx2tx_gpio_mask = rx2tx_gpio_mask; + this->m_rx2tx_gpio_mask_isSet = true; +} + +qint32 +SWGSimplePTTSettings::getRx2txGpioValues() { + return rx2tx_gpio_values; +} +void +SWGSimplePTTSettings::setRx2txGpioValues(qint32 rx2tx_gpio_values) { + this->rx2tx_gpio_values = rx2tx_gpio_values; + this->m_rx2tx_gpio_values_isSet = true; +} + +qint32 +SWGSimplePTTSettings::getRx2txCommandEnable() { + return rx2tx_command_enable; +} +void +SWGSimplePTTSettings::setRx2txCommandEnable(qint32 rx2tx_command_enable) { + this->rx2tx_command_enable = rx2tx_command_enable; + this->m_rx2tx_command_enable_isSet = true; +} + +QString* +SWGSimplePTTSettings::getRx2txCommand() { + return rx2tx_command; +} +void +SWGSimplePTTSettings::setRx2txCommand(QString* rx2tx_command) { + this->rx2tx_command = rx2tx_command; + this->m_rx2tx_command_isSet = true; +} + +qint32 +SWGSimplePTTSettings::getTx2rxGpioEnable() { + return tx2rx_gpio_enable; +} +void +SWGSimplePTTSettings::setTx2rxGpioEnable(qint32 tx2rx_gpio_enable) { + this->tx2rx_gpio_enable = tx2rx_gpio_enable; + this->m_tx2rx_gpio_enable_isSet = true; +} + +qint32 +SWGSimplePTTSettings::getTx2rxGpioMask() { + return tx2rx_gpio_mask; +} +void +SWGSimplePTTSettings::setTx2rxGpioMask(qint32 tx2rx_gpio_mask) { + this->tx2rx_gpio_mask = tx2rx_gpio_mask; + this->m_tx2rx_gpio_mask_isSet = true; +} + +qint32 +SWGSimplePTTSettings::getTx2rxGpioValues() { + return tx2rx_gpio_values; +} +void +SWGSimplePTTSettings::setTx2rxGpioValues(qint32 tx2rx_gpio_values) { + this->tx2rx_gpio_values = tx2rx_gpio_values; + this->m_tx2rx_gpio_values_isSet = true; +} + +qint32 +SWGSimplePTTSettings::getTx2rxCommandEnable() { + return tx2rx_command_enable; +} +void +SWGSimplePTTSettings::setTx2rxCommandEnable(qint32 tx2rx_command_enable) { + this->tx2rx_command_enable = tx2rx_command_enable; + this->m_tx2rx_command_enable_isSet = true; +} + +QString* +SWGSimplePTTSettings::getTx2rxCommand() { + return tx2rx_command; +} +void +SWGSimplePTTSettings::setTx2rxCommand(QString* tx2rx_command) { + this->tx2rx_command = tx2rx_command; + this->m_tx2rx_command_isSet = true; +} + qint32 SWGSimplePTTSettings::getUseReverseApi() { return use_reverse_api; @@ -459,6 +683,39 @@ SWGSimplePTTSettings::isSet(){ if(audio_device_name && *audio_device_name != QString("")){ isObjectUpdated = true; break; } + if(m_gpio_control_isSet){ + isObjectUpdated = true; break; + } + if(m_rx2tx_gpio_enable_isSet){ + isObjectUpdated = true; break; + } + if(m_rx2tx_gpio_mask_isSet){ + isObjectUpdated = true; break; + } + if(m_rx2tx_gpio_values_isSet){ + isObjectUpdated = true; break; + } + if(m_rx2tx_command_enable_isSet){ + isObjectUpdated = true; break; + } + if(rx2tx_command && *rx2tx_command != QString("")){ + isObjectUpdated = true; break; + } + if(m_tx2rx_gpio_enable_isSet){ + isObjectUpdated = true; break; + } + if(m_tx2rx_gpio_mask_isSet){ + isObjectUpdated = true; break; + } + if(m_tx2rx_gpio_values_isSet){ + isObjectUpdated = true; break; + } + if(m_tx2rx_command_enable_isSet){ + isObjectUpdated = true; break; + } + if(tx2rx_command && *tx2rx_command != QString("")){ + isObjectUpdated = true; break; + } if(m_use_reverse_api_isSet){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGSimplePTTSettings.h b/swagger/sdrangel/code/qt5/client/SWGSimplePTTSettings.h index 0b8f7bf75..597a80cd4 100644 --- a/swagger/sdrangel/code/qt5/client/SWGSimplePTTSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGSimplePTTSettings.h @@ -76,6 +76,39 @@ public: QString* getAudioDeviceName(); void setAudioDeviceName(QString* audio_device_name); + qint32 getGpioControl(); + void setGpioControl(qint32 gpio_control); + + qint32 getRx2txGpioEnable(); + void setRx2txGpioEnable(qint32 rx2tx_gpio_enable); + + qint32 getRx2txGpioMask(); + void setRx2txGpioMask(qint32 rx2tx_gpio_mask); + + qint32 getRx2txGpioValues(); + void setRx2txGpioValues(qint32 rx2tx_gpio_values); + + qint32 getRx2txCommandEnable(); + void setRx2txCommandEnable(qint32 rx2tx_command_enable); + + QString* getRx2txCommand(); + void setRx2txCommand(QString* rx2tx_command); + + qint32 getTx2rxGpioEnable(); + void setTx2rxGpioEnable(qint32 tx2rx_gpio_enable); + + qint32 getTx2rxGpioMask(); + void setTx2rxGpioMask(qint32 tx2rx_gpio_mask); + + qint32 getTx2rxGpioValues(); + void setTx2rxGpioValues(qint32 tx2rx_gpio_values); + + qint32 getTx2rxCommandEnable(); + void setTx2rxCommandEnable(qint32 tx2rx_command_enable); + + QString* getTx2rxCommand(); + void setTx2rxCommand(QString* tx2rx_command); + qint32 getUseReverseApi(); void setUseReverseApi(qint32 use_reverse_api); @@ -131,6 +164,39 @@ private: QString* audio_device_name; bool m_audio_device_name_isSet; + qint32 gpio_control; + bool m_gpio_control_isSet; + + qint32 rx2tx_gpio_enable; + bool m_rx2tx_gpio_enable_isSet; + + qint32 rx2tx_gpio_mask; + bool m_rx2tx_gpio_mask_isSet; + + qint32 rx2tx_gpio_values; + bool m_rx2tx_gpio_values_isSet; + + qint32 rx2tx_command_enable; + bool m_rx2tx_command_enable_isSet; + + QString* rx2tx_command; + bool m_rx2tx_command_isSet; + + qint32 tx2rx_gpio_enable; + bool m_tx2rx_gpio_enable_isSet; + + qint32 tx2rx_gpio_mask; + bool m_tx2rx_gpio_mask_isSet; + + qint32 tx2rx_gpio_values; + bool m_tx2rx_gpio_values_isSet; + + qint32 tx2rx_command_enable; + bool m_tx2rx_command_enable_isSet; + + QString* tx2rx_command; + bool m_tx2rx_command_isSet; + qint32 use_reverse_api; bool m_use_reverse_api_isSet;