Audio CAT SISO: CAT serial settings dialog and web API updates

This commit is contained in:
f4exb 2023-06-08 05:04:51 +02:00
parent d02fe23263
commit b392c34fe5
16 changed files with 1032 additions and 0 deletions

View File

@ -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")

View File

@ -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<QString>& 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)

View File

@ -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 <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "audiocatsisosettings.h"
#include "audiocatsisocatdialog.h"
AudioCATSISOCATDialog::AudioCATSISOCATDialog(AudioCATSISOSettings& settings, QList<QString>& 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");
}
}

View File

@ -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 <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDE_AUDIOCATSISPCATDIALOG_H
#define INCLUDE_AUDIOCATSISPCATDIALOG_H
#include <QDialog>
#include "ui_audiocatsisocatdialog.h"
class AudioCATSISOSettings;
namespace Ui {
class AudioCATSISOCATDialog;
}
class AudioCATSISOCATDialog : public QDialog {
Q_OBJECT
public:
AudioCATSISOCATDialog(AudioCATSISOSettings& settings, QList<QString>& 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<QString>& m_settingsKeys;
};
#endif // INCLUDE_AUDIOCATSISPCATDIALOG_H

View File

@ -0,0 +1,296 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AudioCATSISOCATDialog</class>
<widget class="QDialog" name="AudioCATSISOCATDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>319</width>
<height>256</height>
</rect>
</property>
<property name="font">
<font>
<family>Liberation Sans</family>
<pointsize>9</pointsize>
</font>
</property>
<property name="windowTitle">
<string>CAT Settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="serialGroup">
<property name="title">
<string>Serial settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="3">
<widget class="QComboBox" name="stopBits">
<property name="toolTip">
<string>Modulaton type.</string>
</property>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
</widget>
</item>
<item row="0" column="3">
<widget class="QComboBox" name="handshake">
<property name="toolTip">
<string>Modulaton type.</string>
</property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>XON/XOFF</string>
</property>
</item>
<item>
<property name="text">
<string>Hardware</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="dataBits">
<property name="toolTip">
<string>Modulaton type.</string>
</property>
<item>
<property name="text">
<string>7</string>
</property>
</item>
<item>
<property name="text">
<string>8</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="baudRateLabel">
<property name="text">
<string>Baud rate</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="stopBitsLabel">
<property name="text">
<string>Stop bits</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="handshakeLabel">
<property name="text">
<string>Handshake</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="baudRate">
<property name="toolTip">
<string>Modulaton type.</string>
</property>
<item>
<property name="text">
<string>1200</string>
</property>
</item>
<item>
<property name="text">
<string>2400</string>
</property>
</item>
<item>
<property name="text">
<string>4800</string>
</property>
</item>
<item>
<property name="text">
<string>9600</string>
</property>
</item>
<item>
<property name="text">
<string>19200</string>
</property>
</item>
<item>
<property name="text">
<string>38400</string>
</property>
</item>
<item>
<property name="text">
<string>57600</string>
</property>
</item>
<item>
<property name="text">
<string>115200</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="baudLabel">
<property name="text">
<string>Data bits</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="pttGroup">
<property name="title">
<string>PTT </string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="3">
<widget class="QComboBox" name="rtsHigh">
<property name="toolTip">
<string>Modulaton type.</string>
</property>
<item>
<property name="text">
<string>Low</string>
</property>
</item>
<item>
<property name="text">
<string>High</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="dtrHigh">
<property name="toolTip">
<string>Modulaton type.</string>
</property>
<item>
<property name="text">
<string>Low</string>
</property>
</item>
<item>
<property name="text">
<string>High</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="pttMethodLabel">
<property name="text">
<string>Method</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="rtsHighLabel">
<property name="text">
<string>RTS</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="pttMethod">
<property name="toolTip">
<string>Modulaton type.</string>
</property>
<item>
<property name="text">
<string>CAT</string>
</property>
</item>
<item>
<property name="text">
<string>DTR</string>
</property>
</item>
<item>
<property name="text">
<string>RTS</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="dtrHighLabel">
<property name="text">
<string>DTR</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AudioCATSISOCATDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>159</x>
<y>233</y>
</hint>
<hint type="destinationlabel">
<x>159</x>
<y>127</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AudioCATSISOCATDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>159</x>
<y>233</y>
</hint>
<hint type="destinationlabel">
<x>159</x>
<y>127</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -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<int>::of(&QComboBox::currentIndexChanged), this, &AudioCATSISOGUI::on_fcPosRx_currentIndexChanged);
QObject::connect(ui->catDevice, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &AudioCATSISOGUI::on_catDevice_currentIndexChanged);
QObject::connect(ui->catType, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &AudioCATSISOGUI::on_catType_currentIndexChanged);
QObject::connect(ui->catSettings, &QPushButton::clicked, this, &AudioCATSISOGUI::on_catSettings_clicked);
}

View File

@ -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();

View File

@ -170,6 +170,16 @@
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="ptt">
<property name="toolTip">
<string>Push To Talk (PTT)</string>
</property>
<property name="text">
<string>PTT</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
@ -754,6 +764,31 @@
</item>
<item>
<layout class="QHBoxLayout" name="catLayout">
<item>
<widget class="QLabel" name="catStatusIndicator">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>14</width>
<height>14</height>
</size>
</property>
<property name="toolTip">
<string>Idle</string>
</property>
<property name="styleSheet">
<string notr="true">QLabel { background-color: gray; border-radius: 7px; }</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="catDeviceLabel">
<property name="sizePolicy">
@ -813,6 +848,26 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="catConnect">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>CAT (re)connect</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/arrow_left.png</normaloff>:/arrow_left.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@ -15,10 +15,49 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include <hamlib/rig.h>
#include <QtGlobal>
#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;
}

View File

@ -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;

View File

@ -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

View File

@ -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());

View File

@ -94,6 +94,7 @@ const QMap<QString, QString> 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<QString, QString> WebAPIUtils::m_sinkDeviceHwIdToActionsKey = {
};
const QMap<QString, QString> WebAPIUtils::m_mimoDeviceHwIdToSettingsKey = {
{"AudioCATSISO", "audioCATSISOSettings"},
{"BladeRF2", "bladeRF2MIMOSettings"},
{"MetisMISO", "metisMISOSettings"},
{"TestMI", "testMISettings"},

View File

@ -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

View File

@ -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;
}

View File

@ -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;