From b392c34fe52bb2175b09d5843c552f50458eca66 Mon Sep 17 00:00:00 2001 From: f4exb Date: Thu, 8 Jun 2023 05:04:51 +0200 Subject: [PATCH] Audio CAT SISO: CAT serial settings dialog and web API updates --- .../samplemimo/audiocatsiso/CMakeLists.txt | 3 + .../samplemimo/audiocatsiso/audiocatsiso.cpp | 53 ++++ .../audiocatsiso/audiocatsisocatdialog.cpp | 125 ++++++++ .../audiocatsiso/audiocatsisocatdialog.h | 54 ++++ .../audiocatsiso/audiocatsisocatdialog.ui | 296 ++++++++++++++++++ .../audiocatsiso/audiocatsisogui.cpp | 11 + .../samplemimo/audiocatsiso/audiocatsisogui.h | 1 + .../audiocatsiso/audiocatsisogui.ui | 55 ++++ .../audiocatsiso/audiocatsisosettings.cpp | 111 +++++++ .../audiocatsiso/audiocatsisosettings.h | 13 + .../doc/swagger/include/AudioCATSISO.yaml | 50 +++ sdrbase/webapi/webapirequestmapper.cpp | 5 + sdrbase/webapi/webapiutils.cpp | 2 + .../api/swagger/include/AudioCATSISO.yaml | 50 +++ .../qt5/client/SWGAudioCATSISOSettings.cpp | 161 ++++++++++ .../code/qt5/client/SWGAudioCATSISOSettings.h | 42 +++ 16 files changed, 1032 insertions(+) create mode 100644 plugins/samplemimo/audiocatsiso/audiocatsisocatdialog.cpp create mode 100644 plugins/samplemimo/audiocatsiso/audiocatsisocatdialog.h create mode 100644 plugins/samplemimo/audiocatsiso/audiocatsisocatdialog.ui diff --git a/plugins/samplemimo/audiocatsiso/CMakeLists.txt b/plugins/samplemimo/audiocatsiso/CMakeLists.txt index 04dc2a55a..50508d7ed 100644 --- a/plugins/samplemimo/audiocatsiso/CMakeLists.txt +++ b/plugins/samplemimo/audiocatsiso/CMakeLists.txt @@ -31,10 +31,13 @@ if (NOT SERVER_MODE) ${audiocatsiso_SOURCES} audiocatsisogui.cpp audiocatsisogui.ui + audiocatsisocatdialog.cpp + audiocatsisocatdialog.ui ) set(audiocatsiso_HEADERS ${audiocatsiso_HEADERS} audiocatsisogui.h + audiocatsisocatdialog.h ) set(TARGET_NAME mimoaudiocatsiso) set(TARGET_LIB "Qt::Widgets") diff --git a/plugins/samplemimo/audiocatsiso/audiocatsiso.cpp b/plugins/samplemimo/audiocatsiso/audiocatsiso.cpp index ff631454d..a2c97ecc9 100644 --- a/plugins/samplemimo/audiocatsiso/audiocatsiso.cpp +++ b/plugins/samplemimo/audiocatsiso/audiocatsiso.cpp @@ -640,6 +640,28 @@ void AudioCATSISO::webapiUpdateDeviceSettings( settings.m_txVolume = response.getAudioCatsisoSettings()->getTxVolume(); } + if (deviceSettingsKeys.contains("catSpeedIndex")) { + settings.m_catSpeedIndex = response.getAudioCatsisoSettings()->getCatSpeedIndex(); + } + if (deviceSettingsKeys.contains("catHandshakeIndex")) { + settings.m_catHandshakeIndex = response.getAudioCatsisoSettings()->getCatHandshakeIndex(); + } + if (deviceSettingsKeys.contains("catDataBitsIndex")) { + settings.m_catDataBitsIndex = response.getAudioCatsisoSettings()->getCatDataBitsIndex(); + } + if (deviceSettingsKeys.contains("catStopBitsIndex")) { + settings.m_catStopBitsIndex = response.getAudioCatsisoSettings()->getCatStopBitsIndex(); + } + if (deviceSettingsKeys.contains("catPTTMethodIndex")) { + settings.m_catPTTMethodIndex = response.getAudioCatsisoSettings()->getCatPttMethodIndex(); + } + if (deviceSettingsKeys.contains("catPTTMethodIndex")) { + settings.m_catDTRHigh = response.getAudioCatsisoSettings()->getCatDtrHigh() != 0; + } + if (deviceSettingsKeys.contains("catRTSHigh")) { + settings.m_catRTSHigh = response.getAudioCatsisoSettings()->getCatRtsHigh() != 0; + } + if (deviceSettingsKeys.contains("streamIndex")) { settings.m_streamIndex = response.getAudioCatsisoSettings()->getStreamIndex(); } @@ -689,6 +711,15 @@ void AudioCATSISO::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& re response.getAudioCatsisoSettings()->setStreamIndex(settings.m_streamIndex); response.getAudioCatsisoSettings()->setSpectrumStreamIndex(settings.m_spectrumStreamIndex); response.getAudioCatsisoSettings()->setTxEnable(settings.m_txEnable ? 1 : 0); + + response.getAudioCatsisoSettings()->setCatSpeedIndex(settings.m_catSpeedIndex); + response.getAudioCatsisoSettings()->setCatHandshakeIndex(settings.m_catHandshakeIndex); + response.getAudioCatsisoSettings()->setCatDataBitsIndex(settings.m_catDataBitsIndex); + response.getAudioCatsisoSettings()->setCatStopBitsIndex(settings.m_catStopBitsIndex); + response.getAudioCatsisoSettings()->setCatStopBitsIndex(settings.m_catPTTMethodIndex); + response.getAudioCatsisoSettings()->setCatDtrHigh(settings.m_catDTRHigh ? 1 : 0); + response.getAudioCatsisoSettings()->setCatRtsHigh(settings.m_catRTSHigh ? 1 : 0); + response.getAudioCatsisoSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0); if (response.getAudioCatsisoSettings()->getReverseApiAddress()) { @@ -781,6 +812,28 @@ void AudioCATSISO::webapiReverseSendSettings(const QList& deviceSetting swgAudioCATSISOSettings->setTxEnable(settings.m_txEnable ? 1 : 0); } + if (deviceSettingsKeys.contains("catSpeedIndex")) { + swgAudioCATSISOSettings->setCatSpeedIndex(settings.m_catSpeedIndex); + } + if (deviceSettingsKeys.contains("catHandshakeIndex")) { + swgAudioCATSISOSettings->setCatHandshakeIndex(settings.m_catHandshakeIndex); + } + if (deviceSettingsKeys.contains("catDataBitsIndex")) { + swgAudioCATSISOSettings->setCatDataBitsIndex(settings.m_catDataBitsIndex); + } + if (deviceSettingsKeys.contains("catStopBitsIndex")) { + swgAudioCATSISOSettings->setCatStopBitsIndex(settings.m_catStopBitsIndex); + } + if (deviceSettingsKeys.contains("catPTTMethodIndex")) { + swgAudioCATSISOSettings->setCatPttMethodIndex(settings.m_catPTTMethodIndex); + } + if (deviceSettingsKeys.contains("m_catDTRHigh")) { + swgAudioCATSISOSettings->setCatDtrHigh(settings.m_catDTRHigh ? 1 : 0); + } + if (deviceSettingsKeys.contains("catRTSHigh")) { + swgAudioCATSISOSettings->setCatRtsHigh(settings.m_catRTSHigh ? 1 : 0); + } + QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings") .arg(settings.m_reverseAPIAddress) .arg(settings.m_reverseAPIPort) diff --git a/plugins/samplemimo/audiocatsiso/audiocatsisocatdialog.cpp b/plugins/samplemimo/audiocatsiso/audiocatsisocatdialog.cpp new file mode 100644 index 000000000..6f73a0101 --- /dev/null +++ b/plugins/samplemimo/audiocatsiso/audiocatsisocatdialog.cpp @@ -0,0 +1,125 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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 "audiocatsisosettings.h" +#include "audiocatsisocatdialog.h" + +AudioCATSISOCATDialog::AudioCATSISOCATDialog(AudioCATSISOSettings& settings, QList& settingsKeys, QWidget* parent) : + QDialog(parent), + ui(new Ui::AudioCATSISOCATDialog), + m_settings(settings), + m_settingsKeys(settingsKeys) +{ + ui->setupUi(this); + + ui->baudRate->blockSignals(true); + ui->handshake->blockSignals(true); + ui->dataBits->blockSignals(true); + ui->stopBits->blockSignals(true); + ui->pttMethod->blockSignals(true); + ui->dtrHigh->blockSignals(true); + ui->rtsHigh->blockSignals(true); + + ui->baudRate->setCurrentIndex(m_settings.m_catSpeedIndex); + ui->handshake->setCurrentIndex(m_settings.m_catHandshakeIndex); + ui->dataBits->setCurrentIndex(m_settings.m_catDataBitsIndex); + ui->stopBits->setCurrentIndex(m_settings.m_catStopBitsIndex); + ui->pttMethod->setCurrentIndex(m_settings.m_catPTTMethodIndex); + ui->dtrHigh->setCurrentIndex(m_settings.m_catDTRHigh ? 1 : 0); + ui->rtsHigh->setCurrentIndex(m_settings.m_catRTSHigh ? 1 : 0); + + ui->baudRate->blockSignals(false); + ui->handshake->blockSignals(false); + ui->dataBits->blockSignals(false); + ui->stopBits->blockSignals(false); + ui->pttMethod->blockSignals(false); + ui->dtrHigh->blockSignals(false); + ui->rtsHigh->blockSignals(false); +} + +AudioCATSISOCATDialog::~AudioCATSISOCATDialog() +{ + delete ui; +} + +void AudioCATSISOCATDialog::accept() +{ + QDialog::accept(); +} + +void AudioCATSISOCATDialog::on_baudRate_currentIndexChanged(int index) +{ + m_settings.m_catSpeedIndex = index; + + if (!m_settingsKeys.contains("catSpeedIndex")) { + m_settingsKeys.append("catSpeedIndex"); + } +} + +void AudioCATSISOCATDialog::on_handshake_currentIndexChanged(int index) +{ + m_settings.m_catHandshakeIndex = index; + + if (!m_settingsKeys.contains("catHandshakeIndex")) { + m_settingsKeys.append("catHandshakeIndex"); + } +} + +void AudioCATSISOCATDialog::on_dataBits_currentIndexChanged(int index) +{ + m_settings.m_catDataBitsIndex = index; + + if (!m_settingsKeys.contains("catDataBitsIndex")) { + m_settingsKeys.append("catDataBitsIndex"); + } +} + +void AudioCATSISOCATDialog::on_stopBits_currentIndexChanged(int index) +{ + m_settings.m_catStopBitsIndex = index; + + if (!m_settingsKeys.contains("catStopBitsIndex")) { + m_settingsKeys.append("catStopBitsIndex"); + } +} + +void AudioCATSISOCATDialog::on_pttMethod_currentIndexChanged(int index) +{ + m_settings.m_catPTTMethodIndex = index; + + if (!m_settingsKeys.contains("catPTTMethodIndex")) { + m_settingsKeys.append("catPTTMethodIndex"); + } +} + +void AudioCATSISOCATDialog::on_dtrHigh_currentIndexChanged(int index) +{ + m_settings.m_catDTRHigh = index == 1; + + if (!m_settingsKeys.contains("catDTRHigh")) { + m_settingsKeys.append("catDTRHigh"); + } +} + +void AudioCATSISOCATDialog::on_rtsHigh_currentIndexChanged(int index) +{ + m_settings.m_catRTSHigh = index == 1; + + if (!m_settingsKeys.contains("catRTSHigh")) { + m_settingsKeys.append("catRTSHigh"); + } +} diff --git a/plugins/samplemimo/audiocatsiso/audiocatsisocatdialog.h b/plugins/samplemimo/audiocatsiso/audiocatsisocatdialog.h new file mode 100644 index 000000000..51b844313 --- /dev/null +++ b/plugins/samplemimo/audiocatsiso/audiocatsisocatdialog.h @@ -0,0 +1,54 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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_AUDIOCATSISPCATDIALOG_H +#define INCLUDE_AUDIOCATSISPCATDIALOG_H + +#include + +#include "ui_audiocatsisocatdialog.h" + +class AudioCATSISOSettings; + +namespace Ui { + class AudioCATSISOCATDialog; +} + +class AudioCATSISOCATDialog : public QDialog { + Q_OBJECT + +public: + AudioCATSISOCATDialog(AudioCATSISOSettings& settings, QList& settingsKeys, QWidget* parent = nullptr); + ~AudioCATSISOCATDialog(); + +private slots: + void accept(); + void on_baudRate_currentIndexChanged(int index); + void on_handshake_currentIndexChanged(int index); + void on_dataBits_currentIndexChanged(int index); + void on_stopBits_currentIndexChanged(int index); + void on_pttMethod_currentIndexChanged(int index); + void on_dtrHigh_currentIndexChanged(int index); + void on_rtsHigh_currentIndexChanged(int index); + +private: + Ui::AudioCATSISOCATDialog* ui; + AudioCATSISOSettings& m_settings; + QList& m_settingsKeys; +}; + +#endif // INCLUDE_AUDIOCATSISPCATDIALOG_H diff --git a/plugins/samplemimo/audiocatsiso/audiocatsisocatdialog.ui b/plugins/samplemimo/audiocatsiso/audiocatsisocatdialog.ui new file mode 100644 index 000000000..93d6c8baa --- /dev/null +++ b/plugins/samplemimo/audiocatsiso/audiocatsisocatdialog.ui @@ -0,0 +1,296 @@ + + + AudioCATSISOCATDialog + + + + 0 + 0 + 319 + 256 + + + + + Liberation Sans + 9 + + + + CAT Settings + + + + + + Serial settings + + + + + + Modulaton type. + + + + 1 + + + + + 2 + + + + + + + + Modulaton type. + + + + None + + + + + XON/XOFF + + + + + Hardware + + + + + + + + Modulaton type. + + + + 7 + + + + + 8 + + + + + + + + Baud rate + + + + + + + Stop bits + + + + + + + Handshake + + + + + + + Modulaton type. + + + + 1200 + + + + + 2400 + + + + + 4800 + + + + + 9600 + + + + + 19200 + + + + + 38400 + + + + + 57600 + + + + + 115200 + + + + + + + + Data bits + + + + + + + + + + PTT + + + + + + Modulaton type. + + + + Low + + + + + High + + + + + + + + Modulaton type. + + + + Low + + + + + High + + + + + + + + Method + + + + + + + RTS + + + + + + + Modulaton type. + + + + CAT + + + + + DTR + + + + + RTS + + + + + + + + DTR + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + AudioCATSISOCATDialog + accept() + + + 159 + 233 + + + 159 + 127 + + + + + buttonBox + rejected() + AudioCATSISOCATDialog + reject() + + + 159 + 233 + + + 159 + 127 + + + + + diff --git a/plugins/samplemimo/audiocatsiso/audiocatsisogui.cpp b/plugins/samplemimo/audiocatsiso/audiocatsisogui.cpp index 5f58b3fc7..37d5d6df5 100644 --- a/plugins/samplemimo/audiocatsiso/audiocatsisogui.cpp +++ b/plugins/samplemimo/audiocatsiso/audiocatsisogui.cpp @@ -42,6 +42,7 @@ #include "ui_audiocatsisogui.h" #include "audiocatsisogui.h" +#include "audiocatsisocatdialog.h" AudioCATSISOGUI::AudioCATSISOGUI(DeviceUISet *deviceUISet, QWidget* parent) : DeviceGUI(parent), @@ -377,6 +378,15 @@ void AudioCATSISOGUI::on_catType_currentIndexChanged(int index) sendSettings(); } +void AudioCATSISOGUI::on_catSettings_clicked() +{ + AudioCATSISOCATDialog dialog(m_settings, m_settingsKeys); + + if (dialog.exec() == QDialog::Accepted) { + sendSettings(); + } +} + void AudioCATSISOGUI::displaySettings() { blockApplySettings(true); @@ -676,4 +686,5 @@ void AudioCATSISOGUI::makeUIConnections() QObject::connect(ui->fcPosRx, QOverload::of(&QComboBox::currentIndexChanged), this, &AudioCATSISOGUI::on_fcPosRx_currentIndexChanged); QObject::connect(ui->catDevice, QOverload::of(&QComboBox::currentIndexChanged), this, &AudioCATSISOGUI::on_catDevice_currentIndexChanged); QObject::connect(ui->catType, QOverload::of(&QComboBox::currentIndexChanged), this, &AudioCATSISOGUI::on_catType_currentIndexChanged); + QObject::connect(ui->catSettings, &QPushButton::clicked, this, &AudioCATSISOGUI::on_catSettings_clicked); } diff --git a/plugins/samplemimo/audiocatsiso/audiocatsisogui.h b/plugins/samplemimo/audiocatsiso/audiocatsisogui.h index 9bcc79087..fe1e433a8 100644 --- a/plugins/samplemimo/audiocatsiso/audiocatsisogui.h +++ b/plugins/samplemimo/audiocatsiso/audiocatsisogui.h @@ -99,6 +99,7 @@ private slots: void on_fcPosRx_currentIndexChanged(int index); void on_catDevice_currentIndexChanged(int index); void on_catType_currentIndexChanged(int index); + void on_catSettings_clicked(); void openDeviceSettingsDialog(const QPoint& p); void updateStatus(); void updateHardware(); diff --git a/plugins/samplemimo/audiocatsiso/audiocatsisogui.ui b/plugins/samplemimo/audiocatsiso/audiocatsisogui.ui index 6528c0755..21c8c2540 100644 --- a/plugins/samplemimo/audiocatsiso/audiocatsisogui.ui +++ b/plugins/samplemimo/audiocatsiso/audiocatsisogui.ui @@ -170,6 +170,16 @@ + + + + Push To Talk (PTT) + + + PTT + + + @@ -754,6 +764,31 @@ + + + + + 0 + 0 + + + + + 14 + 14 + + + + Idle + + + QLabel { background-color: gray; border-radius: 7px; } + + + + + + @@ -813,6 +848,26 @@ + + + + + 24 + 24 + + + + CAT (re)connect + + + + + + + :/arrow_left.png:/arrow_left.png + + + diff --git a/plugins/samplemimo/audiocatsiso/audiocatsisosettings.cpp b/plugins/samplemimo/audiocatsiso/audiocatsisosettings.cpp index 4fda6735f..1fb0bc97a 100644 --- a/plugins/samplemimo/audiocatsiso/audiocatsisosettings.cpp +++ b/plugins/samplemimo/audiocatsiso/audiocatsisosettings.cpp @@ -15,10 +15,49 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// +#include + #include #include "util/simpleserializer.h" #include "audiocatsisosettings.h" +const int AudioCATSISOSettings::m_catSpeeds[] = { + 1200, + 2400, + 4800, + 9600, + 19200, + 38400, + 57600, + 115200 +}; + +const int AudioCATSISOSettings::m_catDataBits[] +{ + 7, + 8 +}; + +const int AudioCATSISOSettings::m_catStopBits[] +{ + 1, + 2 +}; + +const int AudioCATSISOSettings::m_catHandshakes[] +{ + RIG_HANDSHAKE_NONE, + RIG_HANDSHAKE_XONXOFF, + RIG_HANDSHAKE_HARDWARE +}; + +const int AudioCATSISOSettings::m_catPTTMethods[] +{ + RIG_PTT_RIG, + RIG_PTT_SERIAL_DTR, + RIG_PTT_SERIAL_RTS +}; + AudioCATSISOSettings::AudioCATSISOSettings() { resetToDefaults(); @@ -45,6 +84,13 @@ void AudioCATSISOSettings::resetToDefaults() m_txEnable = false; m_catDevicePath = ""; m_hamlibModel = 1; // Hamlib dummy model + m_catSpeedIndex = 4; // 19200 + m_catDataBitsIndex = 1; // 8 + m_catStopBitsIndex = 0; // 1 + m_catHandshakeIndex = 0; // None + m_catPTTMethodIndex = 0; // PTT + m_catDTRHigh = true; // High + m_catRTSHigh = true; // High m_useReverseAPI = false; m_reverseAPIAddress = "127.0.0.1"; m_reverseAPIPort = 8888; @@ -72,6 +118,13 @@ AudioCATSISOSettings::AudioCATSISOSettings(const AudioCATSISOSettings& other) m_txEnable = other.m_txEnable; m_catDevicePath = other.m_catDevicePath; m_hamlibModel = other.m_hamlibModel; + m_catSpeedIndex = other.m_catSpeedIndex; + m_catDataBitsIndex = other.m_catDataBitsIndex; + m_catStopBitsIndex = other.m_catStopBitsIndex; + m_catHandshakeIndex = other.m_catHandshakeIndex; + m_catPTTMethodIndex = other.m_catPTTMethodIndex; + m_catDTRHigh = other.m_catDTRHigh; + m_catRTSHigh = other.m_catRTSHigh; m_useReverseAPI = other.m_useReverseAPI; m_reverseAPIAddress = other.m_reverseAPIAddress; m_reverseAPIPort = other.m_reverseAPIPort; @@ -100,6 +153,13 @@ QByteArray AudioCATSISOSettings::serialize() const s.writeString(31, m_catDevicePath); s.writeU32(32, m_hamlibModel); + s.writeS32(33, m_catSpeedIndex); + s.writeS32(34, m_catDataBitsIndex); + s.writeS32(35, m_catStopBitsIndex); + s.writeS32(36, m_catHandshakeIndex); + s.writeS32(37, m_catPTTMethodIndex); + s.writeBool(38, m_catDTRHigh); + s.writeBool(39, m_catRTSHigh); s.writeBool(51, m_useReverseAPI); s.writeString(52, m_reverseAPIAddress); @@ -147,6 +207,13 @@ bool AudioCATSISOSettings::deserialize(const QByteArray& data) d.readString(31, &m_catDevicePath, ""); d.readU32(32, &m_hamlibModel, 1); + d.readS32(33, &m_catSpeedIndex, 4); + d.readS32(34, &m_catDataBitsIndex, 1); + d.readS32(35, &m_catStopBitsIndex, 0); + d.readS32(36, &m_catHandshakeIndex, 0); + d.readS32(37, &m_catPTTMethodIndex, 0); + d.readBool(38, &m_catDTRHigh, true); + d.readBool(39, &m_catRTSHigh, true); d.readBool(51, &m_useReverseAPI, false); d.readString(52, &m_reverseAPIAddress, "127.0.0.1"); @@ -235,6 +302,28 @@ void AudioCATSISOSettings::applySettings(const QStringList& settingsKeys, const if (settingsKeys.contains("hamlibModel")) { m_hamlibModel = settings.m_hamlibModel; } + if (settingsKeys.contains("catSpeedIndex")) { + m_catSpeedIndex = settings.m_catSpeedIndex; + } + if (settingsKeys.contains("catHandshakeIndex")) { + m_catHandshakeIndex = settings.m_catHandshakeIndex; + } + if (settingsKeys.contains("catDataBitsIndex")) { + m_catDataBitsIndex = settings.m_catDataBitsIndex; + } + if (settingsKeys.contains("catStopBitsIndex")) { + m_catStopBitsIndex = settings.m_catStopBitsIndex; + } + if (settingsKeys.contains("catPTTMethodIndex")) { + m_catPTTMethodIndex = settings.m_catPTTMethodIndex; + } + if (settingsKeys.contains("catDTRHigh")) { + m_catDTRHigh = settings.m_catDTRHigh; + } + if (settingsKeys.contains("catRTSHigh")) { + m_catRTSHigh = settings.m_catRTSHigh; + } + if (settingsKeys.contains("useReverseAPI")) { m_useReverseAPI = settings.m_useReverseAPI; } @@ -309,6 +398,28 @@ QString AudioCATSISOSettings::getDebugString(const QStringList& settingsKeys, bo if (settingsKeys.contains("hamlibModel") || force) { ostr << " m_hamlibModel: " << m_hamlibModel; } + if (settingsKeys.contains("catSpeedIndex") || force) { + ostr << " m_catSpeedIndex: " << m_catSpeedIndex; + } + if (settingsKeys.contains("catHandshakeIndex") || force) { + ostr << " m_catHandshakeIndex: " << m_catHandshakeIndex; + } + if (settingsKeys.contains("catStopBits") || force) { + ostr << " m_catStopBits: " << m_catStopBits; + } + if (settingsKeys.contains("catDataBits") || force) { + ostr << " m_catDataBits: " << m_catDataBits; + } + if (settingsKeys.contains("catPTTMethodIndex") || force) { + ostr << " m_catPTTMethodIndex: " << m_catPTTMethodIndex; + } + if (settingsKeys.contains("catDTRHigh") || force) { + ostr << " m_catDTRHigh: " << m_catDTRHigh; + } + if (settingsKeys.contains("catRTSHigh") || force) { + ostr << " m_catRTSHigh: " << m_catRTSHigh; + } + if (settingsKeys.contains("useReverseAPI") || force) { ostr << " m_useReverseAPI: " << m_useReverseAPI; } diff --git a/plugins/samplemimo/audiocatsiso/audiocatsisosettings.h b/plugins/samplemimo/audiocatsiso/audiocatsisosettings.h index 76ca3600c..229bbe660 100644 --- a/plugins/samplemimo/audiocatsiso/audiocatsisosettings.h +++ b/plugins/samplemimo/audiocatsiso/audiocatsisosettings.h @@ -60,6 +60,19 @@ struct AudioCATSISOSettings { QString m_catDevicePath; uint32_t m_hamlibModel; //!< Hamlib model number + int m_catSpeedIndex; + int m_catDataBitsIndex; + int m_catStopBitsIndex; + int m_catHandshakeIndex; + int m_catPTTMethodIndex; + bool m_catDTRHigh; + bool m_catRTSHigh; + + static const int m_catSpeeds[]; + static const int m_catDataBits[]; + static const int m_catStopBits[]; + static const int m_catHandshakes[]; + static const int m_catPTTMethods[]; bool m_useReverseAPI; QString m_reverseAPIAddress; diff --git a/sdrbase/resources/webapi/doc/swagger/include/AudioCATSISO.yaml b/sdrbase/resources/webapi/doc/swagger/include/AudioCATSISO.yaml index e63a9d34f..7ec8b45d2 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/AudioCATSISO.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/AudioCATSISO.yaml @@ -88,6 +88,56 @@ AudioCATSISOSettings: txVolume: type: number format: float + catSpeedIndex: + type: integer + descriptoion: > + CAT serial link baud rate + * 0 - 1200 + * 1 - 2400 + * 2 - 4800 + * 3 - 9800 + * 4 - 19200 (default) + * 5 - 38400 + * 6 - 57600 + * 7 - 115200 + catDataBitsIndex: + type: integer + description: > + CAT serial link data bits + * 0 - 7 + * 1 - 8 (default) + catStopBitsIndex: + type: integer + description: > + CAT serial linkj stop bits + * 0 - 1 (default) + * 1 - 2 + catHandshakeIndex: + type: integer + description: > + CAT serial link handshake type + * 0 - none (default) + * 1 - XON/XOFF + * 2 - hardware + catPTTMethodIndex: + type: integer + description: > + CAT PTT metgod + * 0 - PTT (default) + * 1 - DTR + * 2 - RTS + catDTRHigh: + type: integer + description: > + CAT DTR control + * 0 - low + * 1 - high (default) + catRTSHigh: + type: integer + description: > + CAT RTS control + * 0 - low + * 1 - high (default) useReverseAPI: description: Synchronize with reverse API (1 for yes, 0 for no) type: integer diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index cacb25298..4febce713 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -4850,6 +4850,11 @@ bool WebAPIRequestMapper::getDeviceSettings( deviceSettings->setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings()); deviceSettings->getAirspyHfSettings()->fromJsonObject(settingsJsonObject); } + else if (deviceSettingsKey == "audioCATSISOSettings") + { + deviceSettings->setAudioCatsisoSettings(new SWGSDRangel::SWGAudioCATSISOSettings()); + deviceSettings->getAudioCatsisoSettings()->fromJsonObject(settingsJsonObject); + } else if (deviceSettingsKey == "audioInputSettings") { deviceSettings->setAudioInputSettings(new SWGSDRangel::SWGAudioInputSettings()); diff --git a/sdrbase/webapi/webapiutils.cpp b/sdrbase/webapi/webapiutils.cpp index e148451ae..8860ec507 100644 --- a/sdrbase/webapi/webapiutils.cpp +++ b/sdrbase/webapi/webapiutils.cpp @@ -94,6 +94,7 @@ const QMap WebAPIUtils::m_deviceIdToSettingsKey = { {"sdrangel.samplesink.aaroniartsaoutput", "aaroniaRTSAOutputSettings"}, {"sdrangel.samplesource.airspy", "airspySettings"}, {"sdrangel.samplesource.airspyhf", "airspyHFSettings"}, + {"sdrangel.samplemimo.audiocatsiso", "audioCATSISOSettings"}, {"sdrangel.samplesource.audioinput", "audioInputSettings"}, {"sdrangel.samplesink.audiooutput", "audioOutputSettings"}, {"sdrangel.samplesource.bladerf1input", "bladeRF1InputSettings"}, @@ -282,6 +283,7 @@ const QMap WebAPIUtils::m_sinkDeviceHwIdToActionsKey = { }; const QMap WebAPIUtils::m_mimoDeviceHwIdToSettingsKey = { + {"AudioCATSISO", "audioCATSISOSettings"}, {"BladeRF2", "bladeRF2MIMOSettings"}, {"MetisMISO", "metisMISOSettings"}, {"TestMI", "testMISettings"}, diff --git a/swagger/sdrangel/api/swagger/include/AudioCATSISO.yaml b/swagger/sdrangel/api/swagger/include/AudioCATSISO.yaml index e63a9d34f..7ec8b45d2 100644 --- a/swagger/sdrangel/api/swagger/include/AudioCATSISO.yaml +++ b/swagger/sdrangel/api/swagger/include/AudioCATSISO.yaml @@ -88,6 +88,56 @@ AudioCATSISOSettings: txVolume: type: number format: float + catSpeedIndex: + type: integer + descriptoion: > + CAT serial link baud rate + * 0 - 1200 + * 1 - 2400 + * 2 - 4800 + * 3 - 9800 + * 4 - 19200 (default) + * 5 - 38400 + * 6 - 57600 + * 7 - 115200 + catDataBitsIndex: + type: integer + description: > + CAT serial link data bits + * 0 - 7 + * 1 - 8 (default) + catStopBitsIndex: + type: integer + description: > + CAT serial linkj stop bits + * 0 - 1 (default) + * 1 - 2 + catHandshakeIndex: + type: integer + description: > + CAT serial link handshake type + * 0 - none (default) + * 1 - XON/XOFF + * 2 - hardware + catPTTMethodIndex: + type: integer + description: > + CAT PTT metgod + * 0 - PTT (default) + * 1 - DTR + * 2 - RTS + catDTRHigh: + type: integer + description: > + CAT DTR control + * 0 - low + * 1 - high (default) + catRTSHigh: + type: integer + description: > + CAT RTS control + * 0 - low + * 1 - high (default) useReverseAPI: description: Synchronize with reverse API (1 for yes, 0 for no) type: integer diff --git a/swagger/sdrangel/code/qt5/client/SWGAudioCATSISOSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGAudioCATSISOSettings.cpp index e55ef2eb0..c439f3445 100644 --- a/swagger/sdrangel/code/qt5/client/SWGAudioCATSISOSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGAudioCATSISOSettings.cpp @@ -68,6 +68,20 @@ SWGAudioCATSISOSettings::SWGAudioCATSISOSettings() { m_fc_pos_tx_isSet = false; tx_volume = 0.0f; m_tx_volume_isSet = false; + cat_speed_index = 0; + m_cat_speed_index_isSet = false; + cat_data_bits_index = 0; + m_cat_data_bits_index_isSet = false; + cat_stop_bits_index = 0; + m_cat_stop_bits_index_isSet = false; + cat_handshake_index = 0; + m_cat_handshake_index_isSet = false; + cat_ptt_method_index = 0; + m_cat_ptt_method_index_isSet = false; + cat_dtr_high = 0; + m_cat_dtr_high_isSet = false; + cat_rts_high = 0; + m_cat_rts_high_isSet = false; use_reverse_api = 0; m_use_reverse_api_isSet = false; reverse_api_address = nullptr; @@ -124,6 +138,20 @@ SWGAudioCATSISOSettings::init() { m_fc_pos_tx_isSet = false; tx_volume = 0.0f; m_tx_volume_isSet = false; + cat_speed_index = 0; + m_cat_speed_index_isSet = false; + cat_data_bits_index = 0; + m_cat_data_bits_index_isSet = false; + cat_stop_bits_index = 0; + m_cat_stop_bits_index_isSet = false; + cat_handshake_index = 0; + m_cat_handshake_index_isSet = false; + cat_ptt_method_index = 0; + m_cat_ptt_method_index_isSet = false; + cat_dtr_high = 0; + m_cat_dtr_high_isSet = false; + cat_rts_high = 0; + m_cat_rts_high_isSet = false; use_reverse_api = 0; m_use_reverse_api_isSet = false; reverse_api_address = new QString(""); @@ -161,6 +189,13 @@ SWGAudioCATSISOSettings::cleanup() { + + + + + + + if(reverse_api_address != nullptr) { delete reverse_api_address; } @@ -219,6 +254,20 @@ SWGAudioCATSISOSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&tx_volume, pJson["txVolume"], "float", ""); + ::SWGSDRangel::setValue(&cat_speed_index, pJson["catSpeedIndex"], "qint32", ""); + + ::SWGSDRangel::setValue(&cat_data_bits_index, pJson["catDataBitsIndex"], "qint32", ""); + + ::SWGSDRangel::setValue(&cat_stop_bits_index, pJson["catStopBitsIndex"], "qint32", ""); + + ::SWGSDRangel::setValue(&cat_handshake_index, pJson["catHandshakeIndex"], "qint32", ""); + + ::SWGSDRangel::setValue(&cat_ptt_method_index, pJson["catPTTMethodIndex"], "qint32", ""); + + ::SWGSDRangel::setValue(&cat_dtr_high, pJson["catDTRHigh"], "qint32", ""); + + ::SWGSDRangel::setValue(&cat_rts_high, pJson["catRTSHigh"], "qint32", ""); + ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", ""); ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString"); @@ -303,6 +352,27 @@ SWGAudioCATSISOSettings::asJsonObject() { if(m_tx_volume_isSet){ obj->insert("txVolume", QJsonValue(tx_volume)); } + if(m_cat_speed_index_isSet){ + obj->insert("catSpeedIndex", QJsonValue(cat_speed_index)); + } + if(m_cat_data_bits_index_isSet){ + obj->insert("catDataBitsIndex", QJsonValue(cat_data_bits_index)); + } + if(m_cat_stop_bits_index_isSet){ + obj->insert("catStopBitsIndex", QJsonValue(cat_stop_bits_index)); + } + if(m_cat_handshake_index_isSet){ + obj->insert("catHandshakeIndex", QJsonValue(cat_handshake_index)); + } + if(m_cat_ptt_method_index_isSet){ + obj->insert("catPTTMethodIndex", QJsonValue(cat_ptt_method_index)); + } + if(m_cat_dtr_high_isSet){ + obj->insert("catDTRHigh", QJsonValue(cat_dtr_high)); + } + if(m_cat_rts_high_isSet){ + obj->insert("catRTSHigh", QJsonValue(cat_rts_high)); + } if(m_use_reverse_api_isSet){ obj->insert("useReverseAPI", QJsonValue(use_reverse_api)); } @@ -519,6 +589,76 @@ SWGAudioCATSISOSettings::setTxVolume(float tx_volume) { this->m_tx_volume_isSet = true; } +qint32 +SWGAudioCATSISOSettings::getCatSpeedIndex() { + return cat_speed_index; +} +void +SWGAudioCATSISOSettings::setCatSpeedIndex(qint32 cat_speed_index) { + this->cat_speed_index = cat_speed_index; + this->m_cat_speed_index_isSet = true; +} + +qint32 +SWGAudioCATSISOSettings::getCatDataBitsIndex() { + return cat_data_bits_index; +} +void +SWGAudioCATSISOSettings::setCatDataBitsIndex(qint32 cat_data_bits_index) { + this->cat_data_bits_index = cat_data_bits_index; + this->m_cat_data_bits_index_isSet = true; +} + +qint32 +SWGAudioCATSISOSettings::getCatStopBitsIndex() { + return cat_stop_bits_index; +} +void +SWGAudioCATSISOSettings::setCatStopBitsIndex(qint32 cat_stop_bits_index) { + this->cat_stop_bits_index = cat_stop_bits_index; + this->m_cat_stop_bits_index_isSet = true; +} + +qint32 +SWGAudioCATSISOSettings::getCatHandshakeIndex() { + return cat_handshake_index; +} +void +SWGAudioCATSISOSettings::setCatHandshakeIndex(qint32 cat_handshake_index) { + this->cat_handshake_index = cat_handshake_index; + this->m_cat_handshake_index_isSet = true; +} + +qint32 +SWGAudioCATSISOSettings::getCatPttMethodIndex() { + return cat_ptt_method_index; +} +void +SWGAudioCATSISOSettings::setCatPttMethodIndex(qint32 cat_ptt_method_index) { + this->cat_ptt_method_index = cat_ptt_method_index; + this->m_cat_ptt_method_index_isSet = true; +} + +qint32 +SWGAudioCATSISOSettings::getCatDtrHigh() { + return cat_dtr_high; +} +void +SWGAudioCATSISOSettings::setCatDtrHigh(qint32 cat_dtr_high) { + this->cat_dtr_high = cat_dtr_high; + this->m_cat_dtr_high_isSet = true; +} + +qint32 +SWGAudioCATSISOSettings::getCatRtsHigh() { + return cat_rts_high; +} +void +SWGAudioCATSISOSettings::setCatRtsHigh(qint32 cat_rts_high) { + this->cat_rts_high = cat_rts_high; + this->m_cat_rts_high_isSet = true; +} + qint32 SWGAudioCATSISOSettings::getUseReverseApi() { return use_reverse_api; @@ -624,6 +764,27 @@ SWGAudioCATSISOSettings::isSet(){ if(m_tx_volume_isSet){ isObjectUpdated = true; break; } + if(m_cat_speed_index_isSet){ + isObjectUpdated = true; break; + } + if(m_cat_data_bits_index_isSet){ + isObjectUpdated = true; break; + } + if(m_cat_stop_bits_index_isSet){ + isObjectUpdated = true; break; + } + if(m_cat_handshake_index_isSet){ + isObjectUpdated = true; break; + } + if(m_cat_ptt_method_index_isSet){ + isObjectUpdated = true; break; + } + if(m_cat_dtr_high_isSet){ + isObjectUpdated = true; break; + } + if(m_cat_rts_high_isSet){ + isObjectUpdated = true; break; + } if(m_use_reverse_api_isSet){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGAudioCATSISOSettings.h b/swagger/sdrangel/code/qt5/client/SWGAudioCATSISOSettings.h index 462660a49..fdf7e69a1 100644 --- a/swagger/sdrangel/code/qt5/client/SWGAudioCATSISOSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGAudioCATSISOSettings.h @@ -102,6 +102,27 @@ public: float getTxVolume(); void setTxVolume(float tx_volume); + qint32 getCatSpeedIndex(); + void setCatSpeedIndex(qint32 cat_speed_index); + + qint32 getCatDataBitsIndex(); + void setCatDataBitsIndex(qint32 cat_data_bits_index); + + qint32 getCatStopBitsIndex(); + void setCatStopBitsIndex(qint32 cat_stop_bits_index); + + qint32 getCatHandshakeIndex(); + void setCatHandshakeIndex(qint32 cat_handshake_index); + + qint32 getCatPttMethodIndex(); + void setCatPttMethodIndex(qint32 cat_ptt_method_index); + + qint32 getCatDtrHigh(); + void setCatDtrHigh(qint32 cat_dtr_high); + + qint32 getCatRtsHigh(); + void setCatRtsHigh(qint32 cat_rts_high); + qint32 getUseReverseApi(); void setUseReverseApi(qint32 use_reverse_api); @@ -178,6 +199,27 @@ private: float tx_volume; bool m_tx_volume_isSet; + qint32 cat_speed_index; + bool m_cat_speed_index_isSet; + + qint32 cat_data_bits_index; + bool m_cat_data_bits_index_isSet; + + qint32 cat_stop_bits_index; + bool m_cat_stop_bits_index_isSet; + + qint32 cat_handshake_index; + bool m_cat_handshake_index_isSet; + + qint32 cat_ptt_method_index; + bool m_cat_ptt_method_index_isSet; + + qint32 cat_dtr_high; + bool m_cat_dtr_high_isSet; + + qint32 cat_rts_high; + bool m_cat_rts_high_isSet; + qint32 use_reverse_api; bool m_use_reverse_api_isSet;