mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-20 06:38:36 -04:00
Audio CAT SISO: CAT serial settings dialog and web API updates
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -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>
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user