2020-11-09 05:35:18 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2023-11-18 06:02:48 -05:00
|
|
|
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
|
|
|
// written by Christian Daniel //
|
|
|
|
// Copyright (C) 2015-2023 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
|
|
|
// Copyright (C) 2015 John Greb <hexameron@spam.no> //
|
|
|
|
// Copyright (C) 2021-2023 Jon Beniston, M7RCE <jon@beniston.com> //
|
2020-11-09 05:35:18 -05:00
|
|
|
// //
|
|
|
|
// 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 "device/deviceuiset.h"
|
|
|
|
#include <QScrollBar>
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QDateTime>
|
|
|
|
|
|
|
|
#include "ui_chirpchatdemodgui.h"
|
|
|
|
#include "dsp/spectrumvis.h"
|
|
|
|
#include "dsp/dspengine.h"
|
|
|
|
#include "dsp/dspcommands.h"
|
|
|
|
#include "gui/glspectrum.h"
|
|
|
|
#include "gui/glspectrumgui.h"
|
|
|
|
#include "gui/basicchannelsettingsdialog.h"
|
2022-12-20 05:31:15 -05:00
|
|
|
#include "gui/dialpopup.h"
|
|
|
|
#include "gui/dialogpositioner.h"
|
2020-11-09 05:35:18 -05:00
|
|
|
#include "plugin/pluginapi.h"
|
|
|
|
#include "util/db.h"
|
|
|
|
#include "maincore.h"
|
|
|
|
|
|
|
|
#include "chirpchatdemod.h"
|
2024-04-03 19:42:51 -04:00
|
|
|
#include "chirpchatdemodmsg.h"
|
2020-11-09 05:35:18 -05:00
|
|
|
#include "chirpchatdemodgui.h"
|
|
|
|
|
|
|
|
ChirpChatDemodGUI* ChirpChatDemodGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)
|
|
|
|
{
|
|
|
|
ChirpChatDemodGUI* gui = new ChirpChatDemodGUI(pluginAPI, deviceUISet, rxChannel);
|
|
|
|
return gui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::destroy()
|
|
|
|
{
|
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::resetToDefaults()
|
|
|
|
{
|
|
|
|
m_settings.resetToDefaults();
|
|
|
|
displaySettings();
|
|
|
|
applySettings(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray ChirpChatDemodGUI::serialize() const
|
|
|
|
{
|
|
|
|
return m_settings.serialize();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ChirpChatDemodGUI::deserialize(const QByteArray& data)
|
|
|
|
{
|
|
|
|
resetLoRaStatus();
|
|
|
|
|
|
|
|
if (m_settings.deserialize(data))
|
|
|
|
{
|
|
|
|
displaySettings();
|
|
|
|
applySettings(true);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
resetToDefaults();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ChirpChatDemodGUI::handleMessage(const Message& message)
|
|
|
|
{
|
|
|
|
if (DSPSignalNotification::match(message))
|
|
|
|
{
|
|
|
|
DSPSignalNotification& notif = (DSPSignalNotification&) message;
|
2022-04-13 05:08:21 -04:00
|
|
|
m_deviceCenterFrequency = notif.getCenterFrequency();
|
2020-11-09 05:35:18 -05:00
|
|
|
int basebandSampleRate = notif.getSampleRate();
|
|
|
|
qDebug() << "ChirpChatDemodGUI::handleMessage: DSPSignalNotification: m_basebandSampleRate: " << basebandSampleRate;
|
|
|
|
|
|
|
|
if (basebandSampleRate != m_basebandSampleRate)
|
|
|
|
{
|
|
|
|
m_basebandSampleRate = basebandSampleRate;
|
|
|
|
setBandwidths();
|
|
|
|
}
|
|
|
|
|
2022-04-13 05:08:21 -04:00
|
|
|
ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2);
|
|
|
|
ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2));
|
|
|
|
updateAbsoluteCenterFrequency();
|
|
|
|
|
2020-11-09 05:35:18 -05:00
|
|
|
return true;
|
|
|
|
}
|
2024-04-03 19:42:51 -04:00
|
|
|
else if (ChirpChatDemodMsg::MsgReportDecodeBytes::match(message))
|
2020-11-09 05:35:18 -05:00
|
|
|
{
|
|
|
|
if (m_settings.m_codingScheme == ChirpChatDemodSettings::CodingLoRa) {
|
|
|
|
showLoRaMessage(message);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2024-04-03 19:42:51 -04:00
|
|
|
else if (ChirpChatDemodMsg::MsgReportDecodeString::match(message))
|
2020-11-09 05:35:18 -05:00
|
|
|
{
|
|
|
|
if ((m_settings.m_codingScheme == ChirpChatDemodSettings::CodingASCII)
|
2024-04-04 19:03:24 -04:00
|
|
|
|| (m_settings.m_codingScheme == ChirpChatDemodSettings::CodingTTY)) {
|
|
|
|
showTextMessage(message);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (ChirpChatDemodMsg::MsgReportDecodeFT::match(message))
|
|
|
|
{
|
|
|
|
if (m_settings.m_codingScheme == ChirpChatDemodSettings::CodingFT) {
|
|
|
|
showFTMessage(message);
|
2020-11-09 05:35:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (ChirpChatDemod::MsgConfigureChirpChatDemod::match(message))
|
|
|
|
{
|
|
|
|
qDebug("ChirpChatDemodGUI::handleMessage: NFMDemod::MsgConfigureChirpChatDemod");
|
|
|
|
const ChirpChatDemod::MsgConfigureChirpChatDemod& cfg = (ChirpChatDemod::MsgConfigureChirpChatDemod&) message;
|
|
|
|
m_settings = cfg.getSettings();
|
|
|
|
blockApplySettings(true);
|
2021-11-30 18:20:14 -05:00
|
|
|
ui->spectrumGUI->updateSettings();
|
2021-12-02 17:54:39 -05:00
|
|
|
m_channelMarker.updateSettings(static_cast<const ChannelMarker*>(m_settings.m_channelMarker));
|
2020-11-09 05:35:18 -05:00
|
|
|
displaySettings();
|
|
|
|
blockApplySettings(false);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::handleInputMessages()
|
|
|
|
{
|
|
|
|
Message* message;
|
|
|
|
|
|
|
|
while ((message = getInputMessageQueue()->pop()) != 0)
|
|
|
|
{
|
|
|
|
if (handleMessage(*message)) {
|
|
|
|
delete message;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::channelMarkerChangedByCursor()
|
|
|
|
{
|
|
|
|
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
|
|
|
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_deltaFrequency_changed(qint64 value)
|
|
|
|
{
|
|
|
|
m_channelMarker.setCenterFrequency(value);
|
|
|
|
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
2022-04-13 05:08:21 -04:00
|
|
|
updateAbsoluteCenterFrequency();
|
2020-11-09 05:35:18 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::channelMarkerHighlightedByCursor()
|
|
|
|
{
|
2022-04-25 18:42:26 -04:00
|
|
|
setHighlighted(m_channelMarker.getHighlighted());
|
2020-11-09 05:35:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_BW_valueChanged(int value)
|
|
|
|
{
|
|
|
|
if (value < 0) {
|
|
|
|
m_settings.m_bandwidthIndex = 0;
|
|
|
|
} else if (value < ChirpChatDemodSettings::nbBandwidths) {
|
|
|
|
m_settings.m_bandwidthIndex = value;
|
|
|
|
} else {
|
|
|
|
m_settings.m_bandwidthIndex = ChirpChatDemodSettings::nbBandwidths - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int thisBW = ChirpChatDemodSettings::bandwidths[value];
|
|
|
|
ui->BWText->setText(QString("%1 Hz").arg(thisBW));
|
|
|
|
m_channelMarker.setBandwidth(thisBW);
|
|
|
|
ui->glSpectrum->setSampleRate(thisBW);
|
|
|
|
ui->glSpectrum->setCenterFrequency(thisBW/2);
|
|
|
|
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_Spread_valueChanged(int value)
|
|
|
|
{
|
|
|
|
m_settings.m_spreadFactor = value;
|
|
|
|
ui->SpreadText->setText(tr("%1").arg(value));
|
|
|
|
ui->spectrumGUI->setFFTSize(m_settings.m_spreadFactor);
|
|
|
|
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_deBits_valueChanged(int value)
|
|
|
|
{
|
|
|
|
m_settings.m_deBits = value;
|
|
|
|
ui->deBitsText->setText(tr("%1").arg(m_settings.m_deBits));
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_fftWindow_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
m_settings.m_fftWindow = (FFTWindow::Function) index;
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_preambleChirps_valueChanged(int value)
|
|
|
|
{
|
|
|
|
m_settings.m_preambleChirps = value;
|
|
|
|
ui->preambleChirpsText->setText(tr("%1").arg(m_settings.m_preambleChirps));
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_scheme_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
m_settings.m_codingScheme = (ChirpChatDemodSettings::CodingScheme) index;
|
|
|
|
|
|
|
|
if (m_settings.m_codingScheme != ChirpChatDemodSettings::CodingLoRa) {
|
|
|
|
resetLoRaStatus();
|
|
|
|
}
|
|
|
|
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_mute_toggled(bool checked)
|
|
|
|
{
|
|
|
|
m_settings.m_decodeActive = !checked;
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_clear_clicked(bool checked)
|
|
|
|
{
|
|
|
|
(void) checked;
|
|
|
|
ui->messageText->clear();
|
|
|
|
ui->messageText->clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_eomSquelch_valueChanged(int value)
|
|
|
|
{
|
|
|
|
m_settings.m_eomSquelchTenths = value;
|
|
|
|
displaySquelch();
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_messageLength_valueChanged(int value)
|
|
|
|
{
|
|
|
|
m_settings.m_nbSymbolsMax = value;
|
|
|
|
ui->messageLengthText->setText(tr("%1").arg(m_settings.m_nbSymbolsMax));
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_messageLengthAuto_stateChanged(int state)
|
|
|
|
{
|
|
|
|
m_settings.m_autoNbSymbolsMax = (state == Qt::Checked);
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_header_stateChanged(int state)
|
|
|
|
{
|
|
|
|
m_settings.m_hasHeader = (state == Qt::Checked);
|
|
|
|
|
|
|
|
if (!m_settings.m_hasHeader) // put back values from settings
|
|
|
|
{
|
|
|
|
ui->fecParity->blockSignals(true);
|
|
|
|
ui->crc->blockSignals(true);
|
|
|
|
ui->fecParity->setValue(m_settings.m_nbParityBits);
|
|
|
|
ui->fecParityText->setText(tr("%1").arg(m_settings.m_nbParityBits));
|
|
|
|
ui->crc->setChecked(m_settings.m_hasCRC);
|
|
|
|
ui->fecParity->blockSignals(false);
|
|
|
|
ui->crc->blockSignals(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->fecParity->setEnabled(state != Qt::Checked);
|
|
|
|
ui->crc->setEnabled(state != Qt::Checked);
|
2024-04-06 04:50:17 -04:00
|
|
|
ui->packetLength->setEnabled(state != Qt::Checked);
|
2020-11-09 05:35:18 -05:00
|
|
|
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_fecParity_valueChanged(int value)
|
|
|
|
{
|
|
|
|
m_settings.m_nbParityBits = value;
|
|
|
|
ui->fecParityText->setText(tr("%1").arg(m_settings.m_nbParityBits));
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_crc_stateChanged(int state)
|
|
|
|
{
|
|
|
|
m_settings.m_hasCRC = (state == Qt::Checked);
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_packetLength_valueChanged(int value)
|
|
|
|
{
|
|
|
|
m_settings.m_packetLength = value;
|
|
|
|
ui->packetLengthText->setText(tr("%1").arg(m_settings.m_packetLength));
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_udpSend_stateChanged(int state)
|
|
|
|
{
|
|
|
|
m_settings.m_sendViaUDP = (state == Qt::Checked);
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_udpAddress_editingFinished()
|
|
|
|
{
|
|
|
|
m_settings.m_udpAddress = ui->udpAddress->text();
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::on_udpPort_editingFinished()
|
|
|
|
{
|
|
|
|
bool ok;
|
|
|
|
quint16 udpPort = ui->udpPort->text().toInt(&ok);
|
|
|
|
|
|
|
|
if((!ok) || (udpPort < 1024)) {
|
|
|
|
udpPort = 9998;
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->udpPort->setText(tr("%1").arg(m_settings.m_udpPort));
|
|
|
|
m_settings.m_udpPort = udpPort;
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
|
|
|
{
|
|
|
|
(void) widget;
|
|
|
|
(void) rollDown;
|
2021-11-24 04:50:42 -05:00
|
|
|
|
dd maximize button to MainSpectrum and expandible Channels and Features.
Add sizeToContents in ChannelGUI and FeatureGUI, called when widget is
rolled, so we can remove resizing code from all of the individual
channels and features.
In RollupContents, use minimumSizeHint for calculated size, so that
minimumWidth can come from .ui file.
In DeviceGUI::sizeToContents(), call adjustSize(), so Device GUIs start
out at minimum needed size (which should restore appearance prior to
last patch).
In stackSubWindows, use available space for channels if no
spectrum/features present.
In stackSubWindows, fix spectrum from being sized too big, resulting in
scroll bars appearing.
Reset user-defined channel width in stackSubWindows, when channels are
removed.
Don't stack maximized windows.
There's one hack in Channel/FeatureGUI::maximizeWindow(). It seems that
when maximimzing a window, QOpenGLWidgets aren't always paint properly
immediately afterwards, so the code forces an additional update. I can't
see why the first call to paintGL doesn't work.
2022-11-11 07:24:27 -05:00
|
|
|
getRollupContents()->saveState(m_rollupState);
|
2021-11-24 04:50:42 -05:00
|
|
|
applySettings();
|
2020-11-09 05:35:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::onMenuDialogCalled(const QPoint &p)
|
|
|
|
{
|
|
|
|
if (m_contextMenuType == ContextMenuChannelSettings)
|
|
|
|
{
|
|
|
|
BasicChannelSettingsDialog dialog(&m_channelMarker, this);
|
|
|
|
dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
|
|
|
|
dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress);
|
|
|
|
dialog.setReverseAPIPort(m_settings.m_reverseAPIPort);
|
|
|
|
dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex);
|
|
|
|
dialog.setReverseAPIChannelIndex(m_settings.m_reverseAPIChannelIndex);
|
2022-04-17 19:42:03 -04:00
|
|
|
dialog.setDefaultTitle(m_displayedName);
|
|
|
|
|
|
|
|
if (m_deviceUISet->m_deviceMIMOEngine)
|
|
|
|
{
|
|
|
|
dialog.setNumberOfStreams(m_chirpChatDemod->getNumberOfDeviceStreams());
|
|
|
|
dialog.setStreamIndex(m_settings.m_streamIndex);
|
|
|
|
}
|
|
|
|
|
2020-11-09 05:35:18 -05:00
|
|
|
dialog.move(p);
|
2022-12-20 05:31:15 -05:00
|
|
|
new DialogPositioner(&dialog, false);
|
2020-11-09 05:35:18 -05:00
|
|
|
dialog.exec();
|
|
|
|
|
|
|
|
m_settings.m_rgbColor = m_channelMarker.getColor().rgb();
|
|
|
|
m_settings.m_title = m_channelMarker.getTitle();
|
|
|
|
m_settings.m_useReverseAPI = dialog.useReverseAPI();
|
|
|
|
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
|
|
|
|
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
|
|
|
|
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
|
|
|
|
m_settings.m_reverseAPIChannelIndex = dialog.getReverseAPIChannelIndex();
|
|
|
|
|
|
|
|
setWindowTitle(m_settings.m_title);
|
2022-04-12 10:20:45 -04:00
|
|
|
setTitle(m_channelMarker.getTitle());
|
2020-11-09 05:35:18 -05:00
|
|
|
setTitleColor(m_settings.m_rgbColor);
|
|
|
|
|
2022-04-17 19:42:03 -04:00
|
|
|
if (m_deviceUISet->m_deviceMIMOEngine)
|
|
|
|
{
|
|
|
|
m_settings.m_streamIndex = dialog.getSelectedStreamIndex();
|
|
|
|
m_channelMarker.clearStreamIndexes();
|
|
|
|
m_channelMarker.addStreamIndex(m_settings.m_streamIndex);
|
|
|
|
updateIndexLabel();
|
|
|
|
}
|
2020-11-09 05:35:18 -05:00
|
|
|
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
resetContextMenuType();
|
|
|
|
}
|
|
|
|
|
|
|
|
ChirpChatDemodGUI::ChirpChatDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent) :
|
|
|
|
ChannelGUI(parent),
|
|
|
|
ui(new Ui::ChirpChatDemodGUI),
|
|
|
|
m_pluginAPI(pluginAPI),
|
|
|
|
m_deviceUISet(deviceUISet),
|
|
|
|
m_channelMarker(this),
|
2022-04-13 05:08:21 -04:00
|
|
|
m_deviceCenterFrequency(0),
|
2020-11-09 05:35:18 -05:00
|
|
|
m_basebandSampleRate(250000),
|
|
|
|
m_doApplySettings(true),
|
|
|
|
m_tickCount(0)
|
|
|
|
{
|
|
|
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
2022-04-24 06:28:56 -04:00
|
|
|
m_helpURL = "plugins/channelrx/demodchirpchat/readme.md";
|
|
|
|
RollupContents *rollupContents = getRollupContents();
|
|
|
|
ui->setupUi(rollupContents);
|
|
|
|
setSizePolicy(rollupContents->sizePolicy());
|
|
|
|
rollupContents->arrangeRollups();
|
|
|
|
connect(rollupContents, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
2020-11-09 05:35:18 -05:00
|
|
|
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
|
|
|
|
|
|
|
m_chirpChatDemod = (ChirpChatDemod*) rxChannel;
|
|
|
|
m_spectrumVis = m_chirpChatDemod->getSpectrumVis();
|
|
|
|
m_spectrumVis->setGLSpectrum(ui->glSpectrum);
|
|
|
|
m_chirpChatDemod->setMessageQueueToGUI(getInputMessageQueue());
|
|
|
|
|
|
|
|
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
|
|
|
|
2023-04-09 05:47:50 -04:00
|
|
|
SpectrumSettings spectrumSettings = m_spectrumVis->getSettings();
|
|
|
|
spectrumSettings.m_displayWaterfall = true;
|
|
|
|
spectrumSettings.m_displayMaxHold = true;
|
|
|
|
SpectrumVis::MsgConfigureSpectrumVis *msg = SpectrumVis::MsgConfigureSpectrumVis::create(spectrumSettings, false);
|
|
|
|
m_spectrumVis->getInputMessageQueue()->push(msg);
|
2020-11-09 05:35:18 -05:00
|
|
|
|
|
|
|
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
|
|
|
|
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
|
|
|
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
|
|
|
|
|
|
|
|
ui->messageText->setReadOnly(true);
|
|
|
|
ui->messageText->setReadOnly(true);
|
|
|
|
|
|
|
|
m_channelMarker.setMovable(true);
|
|
|
|
m_channelMarker.setVisible(true);
|
|
|
|
|
|
|
|
connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
|
|
|
|
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
|
|
|
|
|
|
|
|
m_deviceUISet->addChannelMarker(&m_channelMarker);
|
|
|
|
|
|
|
|
ui->spectrumGUI->setBuddies(m_spectrumVis, ui->glSpectrum);
|
|
|
|
|
|
|
|
m_settings.setChannelMarker(&m_channelMarker);
|
|
|
|
m_settings.setSpectrumGUI(ui->spectrumGUI);
|
2022-01-08 23:27:12 -05:00
|
|
|
m_settings.setRollupState(&m_rollupState);
|
2020-11-09 05:35:18 -05:00
|
|
|
|
|
|
|
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
|
|
|
|
|
|
|
setBandwidths();
|
|
|
|
displaySettings();
|
2022-04-12 10:20:45 -04:00
|
|
|
makeUIConnections();
|
2020-11-09 05:35:18 -05:00
|
|
|
resetLoRaStatus();
|
|
|
|
applySettings(true);
|
2022-12-20 05:31:15 -05:00
|
|
|
DialPopup::addPopupsToChildDials(this);
|
2023-11-13 15:51:03 -05:00
|
|
|
m_resizer.enableChildMouseTracking();
|
2020-11-09 05:35:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
ChirpChatDemodGUI::~ChirpChatDemodGUI()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::blockApplySettings(bool block)
|
|
|
|
{
|
|
|
|
m_doApplySettings = !block;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::applySettings(bool force)
|
|
|
|
{
|
|
|
|
if (m_doApplySettings)
|
|
|
|
{
|
|
|
|
setTitleColor(m_channelMarker.getColor());
|
|
|
|
ChirpChatDemod::MsgConfigureChirpChatDemod* message = ChirpChatDemod::MsgConfigureChirpChatDemod::create( m_settings, force);
|
|
|
|
m_chirpChatDemod->getInputMessageQueue()->push(message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::displaySettings()
|
|
|
|
{
|
|
|
|
int thisBW = ChirpChatDemodSettings::bandwidths[m_settings.m_bandwidthIndex];
|
|
|
|
|
|
|
|
m_channelMarker.blockSignals(true);
|
|
|
|
m_channelMarker.setTitle(m_settings.m_title);
|
|
|
|
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
|
|
|
|
m_channelMarker.setBandwidth(thisBW);
|
|
|
|
m_channelMarker.blockSignals(false);
|
|
|
|
m_channelMarker.setColor(m_settings.m_rgbColor);
|
|
|
|
setTitleColor(m_settings.m_rgbColor);
|
2022-04-12 10:20:45 -04:00
|
|
|
setTitle(m_channelMarker.getTitle());
|
2020-11-09 05:35:18 -05:00
|
|
|
|
|
|
|
ui->glSpectrum->setSampleRate(thisBW);
|
|
|
|
ui->glSpectrum->setCenterFrequency(thisBW/2);
|
|
|
|
|
|
|
|
ui->fecParity->setEnabled(!m_settings.m_hasHeader);
|
|
|
|
ui->crc->setEnabled(!m_settings.m_hasHeader);
|
|
|
|
ui->packetLength->setEnabled(!m_settings.m_hasHeader);
|
|
|
|
|
|
|
|
blockApplySettings(true);
|
|
|
|
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
|
|
|
ui->BWText->setText(QString("%1 Hz").arg(thisBW));
|
|
|
|
ui->BW->setValue(m_settings.m_bandwidthIndex);
|
|
|
|
ui->Spread->setValue(m_settings.m_spreadFactor);
|
|
|
|
ui->SpreadText->setText(tr("%1").arg(m_settings.m_spreadFactor));
|
|
|
|
ui->deBits->setValue(m_settings.m_deBits);
|
|
|
|
ui->fftWindow->setCurrentIndex((int) m_settings.m_fftWindow);
|
|
|
|
ui->deBitsText->setText(tr("%1").arg(m_settings.m_deBits));
|
|
|
|
ui->preambleChirps->setValue(m_settings.m_preambleChirps);
|
|
|
|
ui->preambleChirpsText->setText(tr("%1").arg(m_settings.m_preambleChirps));
|
|
|
|
ui->scheme->setCurrentIndex((int) m_settings.m_codingScheme);
|
|
|
|
ui->messageLengthText->setText(tr("%1").arg(m_settings.m_nbSymbolsMax));
|
|
|
|
ui->messageLength->setValue(m_settings.m_nbSymbolsMax);
|
|
|
|
ui->udpSend->setChecked(m_settings.m_sendViaUDP);
|
|
|
|
ui->udpAddress->setText(m_settings.m_udpAddress);
|
|
|
|
ui->udpPort->setText(tr("%1").arg(m_settings.m_udpPort));
|
|
|
|
ui->header->setChecked(m_settings.m_hasHeader);
|
|
|
|
|
|
|
|
if (!m_settings.m_hasHeader)
|
|
|
|
{
|
|
|
|
ui->fecParity->setValue(m_settings.m_nbParityBits);
|
|
|
|
ui->fecParityText->setText(tr("%1").arg(m_settings.m_nbParityBits));
|
|
|
|
ui->crc->setChecked(m_settings.m_hasCRC);
|
|
|
|
ui->packetLength->setValue(m_settings.m_packetLength);
|
|
|
|
ui->spectrumGUI->setFFTSize(m_settings.m_spreadFactor);
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->messageLengthAuto->setChecked(m_settings.m_autoNbSymbolsMax);
|
|
|
|
|
|
|
|
displaySquelch();
|
2022-04-17 19:42:03 -04:00
|
|
|
updateIndexLabel();
|
2020-11-09 05:35:18 -05:00
|
|
|
|
2022-04-12 10:20:45 -04:00
|
|
|
getRollupContents()->restoreState(m_rollupState);
|
2022-04-13 05:08:21 -04:00
|
|
|
updateAbsoluteCenterFrequency();
|
2020-11-09 05:35:18 -05:00
|
|
|
blockApplySettings(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::displaySquelch()
|
|
|
|
{
|
|
|
|
ui->eomSquelch->setValue(m_settings.m_eomSquelchTenths);
|
|
|
|
|
|
|
|
if (m_settings.m_eomSquelchTenths == ui->eomSquelch->maximum()) {
|
|
|
|
ui->eomSquelchText->setText("---");
|
|
|
|
} else {
|
|
|
|
ui->eomSquelchText->setText(tr("%1").arg(m_settings.m_eomSquelchTenths / 10.0, 0, 'f', 1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::displayLoRaStatus(int headerParityStatus, bool headerCRCStatus, int payloadParityStatus, bool payloadCRCStatus)
|
|
|
|
{
|
2024-04-04 19:03:24 -04:00
|
|
|
if (m_settings.m_hasHeader && (headerParityStatus == (int) ChirpChatDemodSettings::ParityOK)) {
|
2020-11-09 05:35:18 -05:00
|
|
|
ui->headerHammingStatus->setStyleSheet("QLabel { background-color : green; }");
|
2024-04-04 19:03:24 -04:00
|
|
|
} else if (m_settings.m_hasHeader && (headerParityStatus == (int) ChirpChatDemodSettings::ParityError)) {
|
2020-11-09 05:35:18 -05:00
|
|
|
ui->headerHammingStatus->setStyleSheet("QLabel { background-color : red; }");
|
2024-04-04 19:03:24 -04:00
|
|
|
} else if (m_settings.m_hasHeader && (headerParityStatus == (int) ChirpChatDemodSettings::ParityCorrected)) {
|
2020-11-09 05:35:18 -05:00
|
|
|
ui->headerHammingStatus->setStyleSheet("QLabel { background-color : blue; }");
|
|
|
|
} else {
|
|
|
|
ui->headerHammingStatus->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_settings.m_hasHeader && headerCRCStatus) {
|
|
|
|
ui->headerCRCStatus->setStyleSheet("QLabel { background-color : green; }");
|
|
|
|
} else if (m_settings.m_hasHeader && !headerCRCStatus) {
|
|
|
|
ui->headerCRCStatus->setStyleSheet("QLabel { background-color : red; }");
|
|
|
|
} else {
|
|
|
|
ui->headerCRCStatus->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
|
2024-04-04 19:03:24 -04:00
|
|
|
if (payloadParityStatus == (int) ChirpChatDemodSettings::ParityOK) {
|
2020-11-09 05:35:18 -05:00
|
|
|
ui->payloadFECStatus->setStyleSheet("QLabel { background-color : green; }");
|
2024-04-04 19:03:24 -04:00
|
|
|
} else if (payloadParityStatus == (int) ChirpChatDemodSettings::ParityError) {
|
2020-11-09 05:35:18 -05:00
|
|
|
ui->payloadFECStatus->setStyleSheet("QLabel { background-color : red; }");
|
2024-04-04 19:03:24 -04:00
|
|
|
} else if (payloadParityStatus == (int) ChirpChatDemodSettings::ParityCorrected) {
|
2020-11-09 05:35:18 -05:00
|
|
|
ui->payloadFECStatus->setStyleSheet("QLabel { background-color : blue; }");
|
|
|
|
} else {
|
|
|
|
ui->payloadFECStatus->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (payloadCRCStatus) {
|
|
|
|
ui->payloadCRCStatus->setStyleSheet("QLabel { background-color : green; }");
|
|
|
|
} else {
|
|
|
|
ui->payloadCRCStatus->setStyleSheet("QLabel { background-color : red; }");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::resetLoRaStatus()
|
|
|
|
{
|
|
|
|
ui->headerHammingStatus->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
ui->headerCRCStatus->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
ui->payloadFECStatus->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
ui->payloadCRCStatus->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
ui->nbSymbolsText->setText("---");
|
|
|
|
ui->nbCodewordsText->setText("---");
|
|
|
|
}
|
|
|
|
|
2024-04-04 19:03:24 -04:00
|
|
|
void ChirpChatDemodGUI::displayFTStatus(int payloadParityStatus, bool payloadCRCStatus)
|
|
|
|
{
|
|
|
|
if (payloadParityStatus == (int) ChirpChatDemodSettings::ParityOK) {
|
|
|
|
ui->payloadFECStatus->setStyleSheet("QLabel { background-color : green; }");
|
|
|
|
} else if (payloadParityStatus == (int) ChirpChatDemodSettings::ParityError) {
|
|
|
|
ui->payloadFECStatus->setStyleSheet("QLabel { background-color : red; }");
|
|
|
|
} else if (payloadParityStatus == (int) ChirpChatDemodSettings::ParityCorrected) {
|
|
|
|
ui->payloadFECStatus->setStyleSheet("QLabel { background-color : blue; }");
|
|
|
|
} else {
|
|
|
|
ui->payloadFECStatus->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (payloadCRCStatus) {
|
|
|
|
ui->payloadCRCStatus->setStyleSheet("QLabel { background-color : green; }");
|
|
|
|
} else {
|
|
|
|
ui->payloadCRCStatus->setStyleSheet("QLabel { background-color : red; }");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-09 05:35:18 -05:00
|
|
|
void ChirpChatDemodGUI::setBandwidths()
|
|
|
|
{
|
|
|
|
int maxBandwidth = m_basebandSampleRate/ChirpChatDemodSettings::oversampling;
|
|
|
|
int maxIndex = 0;
|
|
|
|
|
|
|
|
for (; (maxIndex < ChirpChatDemodSettings::nbBandwidths) && (ChirpChatDemodSettings::bandwidths[maxIndex] <= maxBandwidth); maxIndex++)
|
|
|
|
{}
|
|
|
|
|
|
|
|
if (maxIndex != 0)
|
|
|
|
{
|
|
|
|
qDebug("ChirpChatDemodGUI::setBandwidths: avl: %d max: %d", maxBandwidth, ChirpChatDemodSettings::bandwidths[maxIndex-1]);
|
|
|
|
ui->BW->setMaximum(maxIndex - 1);
|
|
|
|
int index = ui->BW->value();
|
|
|
|
ui->BWText->setText(QString("%1 Hz").arg(ChirpChatDemodSettings::bandwidths[index]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::showLoRaMessage(const Message& message)
|
|
|
|
{
|
2024-04-03 19:42:51 -04:00
|
|
|
const ChirpChatDemodMsg::MsgReportDecodeBytes& msg = (ChirpChatDemodMsg::MsgReportDecodeBytes&) message;
|
2020-11-09 05:35:18 -05:00
|
|
|
QByteArray bytes = msg.getBytes();
|
|
|
|
QString syncWordStr((tr("%1").arg(msg.getSyncWord(), 2, 16, QChar('0'))));
|
|
|
|
|
|
|
|
ui->sText->setText(tr("%1").arg(msg.getSingalDb(), 0, 'f', 1));
|
|
|
|
ui->snrText->setText(tr("%1").arg(msg.getSingalDb() - msg.getNoiseDb(), 0, 'f', 1));
|
|
|
|
unsigned int packetLength;
|
|
|
|
|
|
|
|
if (m_settings.m_hasHeader)
|
|
|
|
{
|
|
|
|
ui->fecParity->setValue(msg.getNbParityBits());
|
|
|
|
ui->fecParityText->setText(tr("%1").arg(msg.getNbParityBits()));
|
|
|
|
ui->crc->setChecked(msg.getHasCRC());
|
|
|
|
ui->packetLength->setValue(msg.getPacketSize());
|
|
|
|
ui->packetLengthText->setText(tr("%1").arg(msg.getPacketSize()));
|
|
|
|
packetLength = msg.getPacketSize();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
packetLength = m_settings.m_packetLength;
|
|
|
|
}
|
|
|
|
|
|
|
|
QDateTime dt = QDateTime::currentDateTime();
|
|
|
|
QString dateStr = dt.toString("HH:mm:ss");
|
|
|
|
|
|
|
|
if (msg.getEarlyEOM())
|
|
|
|
{
|
|
|
|
QString loRaStatus = tr("%1 %2 S:%3 SN:%4 HF:%5 HC:%6 EOM:too early")
|
|
|
|
.arg(dateStr)
|
|
|
|
.arg(syncWordStr)
|
|
|
|
.arg(msg.getSingalDb(), 0, 'f', 1)
|
|
|
|
.arg(msg.getSingalDb() - msg.getNoiseDb(), 0, 'f', 1)
|
|
|
|
.arg(getParityStr(msg.getHeaderParityStatus()))
|
|
|
|
.arg(msg.getHeaderCRCStatus() ? "ok" : "err");
|
|
|
|
|
|
|
|
displayStatus(loRaStatus);
|
2024-04-04 19:03:24 -04:00
|
|
|
displayLoRaStatus(msg.getHeaderParityStatus(), msg.getHeaderCRCStatus(), (int) ChirpChatDemodSettings::ParityUndefined, true);
|
2020-11-09 05:35:18 -05:00
|
|
|
ui->payloadCRCStatus->setStyleSheet("QLabel { background:rgb(79,79,79); }"); // reset payload CRC
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
QString loRaHeader = tr("%1 %2 S:%3 SN:%4 HF:%5 HC:%6 FEC:%7 CRC:%8")
|
|
|
|
.arg(dateStr)
|
|
|
|
.arg(syncWordStr)
|
|
|
|
.arg(msg.getSingalDb(), 0, 'f', 1)
|
|
|
|
.arg(msg.getSingalDb() - msg.getNoiseDb(), 0, 'f', 1)
|
|
|
|
.arg(getParityStr(msg.getHeaderParityStatus()))
|
|
|
|
.arg(msg.getHeaderCRCStatus() ? "ok" : "err")
|
|
|
|
.arg(getParityStr(msg.getPayloadParityStatus()))
|
|
|
|
.arg(msg.getPayloadCRCStatus() ? "ok" : "err");
|
|
|
|
|
|
|
|
displayStatus(loRaHeader);
|
|
|
|
displayBytes(bytes);
|
|
|
|
|
|
|
|
QByteArray bytesCopy(bytes);
|
|
|
|
bytesCopy.truncate(packetLength);
|
|
|
|
bytesCopy.replace('\0', " ");
|
|
|
|
QString str = QString(bytesCopy.toStdString().c_str());
|
|
|
|
QString textHeader(tr("%1 (%2)").arg(dateStr).arg(syncWordStr));
|
|
|
|
|
|
|
|
displayText(str);
|
|
|
|
displayLoRaStatus(msg.getHeaderParityStatus(), msg.getHeaderCRCStatus(), msg.getPayloadParityStatus(), msg.getPayloadCRCStatus());
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->nbSymbolsText->setText(tr("%1").arg(msg.getNbSymbols()));
|
|
|
|
ui->nbCodewordsText->setText(tr("%1").arg(msg.getNbCodewords()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::showTextMessage(const Message& message)
|
|
|
|
{
|
2024-04-03 19:42:51 -04:00
|
|
|
const ChirpChatDemodMsg::MsgReportDecodeString& msg = (ChirpChatDemodMsg::MsgReportDecodeString&) message;
|
2020-11-09 05:35:18 -05:00
|
|
|
|
|
|
|
QDateTime dt = QDateTime::currentDateTime();
|
|
|
|
QString dateStr = dt.toString("HH:mm:ss");
|
|
|
|
ui->sText->setText(tr("%1").arg(msg.getSingalDb(), 0, 'f', 1));
|
|
|
|
ui->snrText->setText(tr("%1").arg(msg.getSingalDb() - msg.getNoiseDb(), 0, 'f', 1));
|
|
|
|
|
|
|
|
QString status = tr("%1 S:%2 SN:%3")
|
|
|
|
.arg(dateStr)
|
|
|
|
.arg(msg.getSingalDb(), 0, 'f', 1)
|
|
|
|
.arg(msg.getSingalDb() - msg.getNoiseDb(), 0, 'f', 1);
|
|
|
|
|
|
|
|
displayStatus(status);
|
|
|
|
displayText(msg.getString());
|
|
|
|
}
|
|
|
|
|
2024-04-04 19:03:24 -04:00
|
|
|
void ChirpChatDemodGUI::showFTMessage(const Message& message)
|
|
|
|
{
|
|
|
|
const ChirpChatDemodMsg::MsgReportDecodeFT& msg = (ChirpChatDemodMsg::MsgReportDecodeFT&) message;
|
|
|
|
|
|
|
|
QDateTime dt = QDateTime::currentDateTime();
|
|
|
|
QString dateStr = dt.toString("HH:mm:ss");
|
|
|
|
ui->sText->setText(tr("%1").arg(msg.getSingalDb(), 0, 'f', 1));
|
|
|
|
ui->snrText->setText(tr("%1").arg(msg.getSingalDb() - msg.getNoiseDb(), 0, 'f', 1));
|
|
|
|
|
|
|
|
QString status = tr("%1 S:%2 SN:%3 FEC:%4 CRC:%5")
|
|
|
|
.arg(dateStr)
|
|
|
|
.arg(msg.getSingalDb(), 0, 'f', 1)
|
|
|
|
.arg(msg.getSingalDb() - msg.getNoiseDb(), 0, 'f', 1)
|
|
|
|
.arg(getParityStr(msg.getPayloadParityStatus()))
|
|
|
|
.arg(msg.getPayloadCRCStatus() ? "ok" : "err");
|
|
|
|
|
|
|
|
displayStatus(status);
|
|
|
|
displayText(msg.getMessage()); // We do not show constituents of the message (call1, ...)
|
|
|
|
displayFTStatus(msg.getPayloadParityStatus(), msg.getPayloadCRCStatus());
|
|
|
|
}
|
|
|
|
|
2020-11-09 05:35:18 -05:00
|
|
|
void ChirpChatDemodGUI::displayText(const QString& text)
|
|
|
|
{
|
|
|
|
QTextCursor cursor = ui->messageText->textCursor();
|
|
|
|
cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
|
|
|
|
if (!ui->messageText->document()->isEmpty()) {
|
|
|
|
cursor.insertText("\n");
|
|
|
|
}
|
|
|
|
cursor.insertText(tr("TXT|%1").arg(text));
|
|
|
|
ui->messageText->verticalScrollBar()->setValue(ui->messageText->verticalScrollBar()->maximum());
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::displayBytes(const QByteArray& bytes)
|
|
|
|
{
|
|
|
|
QTextCursor cursor = ui->messageText->textCursor();
|
|
|
|
cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
|
|
|
|
|
|
|
|
if (!ui->messageText->document()->isEmpty()) {
|
|
|
|
cursor.insertText("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray::const_iterator it = bytes.begin();
|
|
|
|
unsigned int i = 0;
|
|
|
|
|
|
|
|
for (;it != bytes.end(); ++it, i++)
|
|
|
|
{
|
|
|
|
unsigned char b = *it;
|
|
|
|
|
|
|
|
if (i%16 == 0) {
|
|
|
|
cursor.insertText(tr("%1|").arg(i, 3, 10, QChar('0')));
|
|
|
|
}
|
|
|
|
|
|
|
|
cursor.insertText(tr("%1").arg(b, 2, 16, QChar('0')));
|
|
|
|
|
|
|
|
if (i%16 == 15) {
|
|
|
|
cursor.insertText("\n");
|
|
|
|
} else if (i%4 == 3) {
|
|
|
|
cursor.insertText("|");
|
|
|
|
} else {
|
|
|
|
cursor.insertText(" ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->messageText->verticalScrollBar()->setValue(ui->messageText->verticalScrollBar()->maximum());
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::displayStatus(const QString& status)
|
|
|
|
{
|
|
|
|
QTextCursor cursor = ui->messageText->textCursor();
|
|
|
|
cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
|
|
|
|
|
|
|
|
if (!ui->messageText->document()->isEmpty()) {
|
|
|
|
cursor.insertText("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
cursor.insertText(tr(">%1").arg(status));
|
|
|
|
ui->messageText->verticalScrollBar()->setValue(ui->messageText->verticalScrollBar()->maximum());
|
|
|
|
}
|
|
|
|
|
|
|
|
QString ChirpChatDemodGUI::getParityStr(int parityStatus)
|
|
|
|
{
|
2024-04-04 19:03:24 -04:00
|
|
|
if (parityStatus == (int) ChirpChatDemodSettings::ParityError) {
|
2020-11-09 05:35:18 -05:00
|
|
|
return "err";
|
2024-04-04 19:03:24 -04:00
|
|
|
} else if (parityStatus == (int) ChirpChatDemodSettings::ParityCorrected) {
|
2020-11-09 05:35:18 -05:00
|
|
|
return "fix";
|
2024-04-04 19:03:24 -04:00
|
|
|
} else if (parityStatus == (int) ChirpChatDemodSettings::ParityOK) {
|
2020-11-09 05:35:18 -05:00
|
|
|
return "ok";
|
|
|
|
} else {
|
|
|
|
return "n/a";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChirpChatDemodGUI::tick()
|
|
|
|
{
|
|
|
|
if (m_tickCount < 10)
|
|
|
|
{
|
|
|
|
m_tickCount++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_tickCount = 0;
|
|
|
|
|
|
|
|
ui->nText->setText(tr("%1").arg(CalcDb::dbPower(m_chirpChatDemod->getCurrentNoiseLevel()), 0, 'f', 1));
|
|
|
|
ui->channelPower->setText(tr("%1 dB").arg(CalcDb::dbPower(m_chirpChatDemod->getTotalPower()), 0, 'f', 1));
|
|
|
|
|
|
|
|
if (m_chirpChatDemod->getDemodActive()) {
|
|
|
|
ui->mute->setStyleSheet("QToolButton { background-color : green; }");
|
|
|
|
} else {
|
|
|
|
ui->mute->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-12 10:20:45 -04:00
|
|
|
void ChirpChatDemodGUI::makeUIConnections()
|
|
|
|
{
|
|
|
|
QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &ChirpChatDemodGUI::on_deltaFrequency_changed);
|
|
|
|
QObject::connect(ui->BW, &QSlider::valueChanged, this, &ChirpChatDemodGUI::on_BW_valueChanged);
|
|
|
|
QObject::connect(ui->Spread, &QSlider::valueChanged, this, &ChirpChatDemodGUI::on_Spread_valueChanged);
|
|
|
|
QObject::connect(ui->deBits, &QSlider::valueChanged, this, &ChirpChatDemodGUI::on_deBits_valueChanged);
|
|
|
|
QObject::connect(ui->fftWindow, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ChirpChatDemodGUI::on_fftWindow_currentIndexChanged);
|
|
|
|
QObject::connect(ui->preambleChirps, &QSlider::valueChanged, this, &ChirpChatDemodGUI::on_preambleChirps_valueChanged);
|
|
|
|
QObject::connect(ui->scheme, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ChirpChatDemodGUI::on_scheme_currentIndexChanged);
|
|
|
|
QObject::connect(ui->mute, &QToolButton::toggled, this, &ChirpChatDemodGUI::on_mute_toggled);
|
|
|
|
QObject::connect(ui->clear, &QPushButton::clicked, this, &ChirpChatDemodGUI::on_clear_clicked);
|
|
|
|
QObject::connect(ui->eomSquelch, &QDial::valueChanged, this, &ChirpChatDemodGUI::on_eomSquelch_valueChanged);
|
|
|
|
QObject::connect(ui->messageLength, &QDial::valueChanged, this, &ChirpChatDemodGUI::on_messageLength_valueChanged);
|
|
|
|
QObject::connect(ui->messageLengthAuto, &QCheckBox::stateChanged, this, &ChirpChatDemodGUI::on_messageLengthAuto_stateChanged);
|
|
|
|
QObject::connect(ui->header, &QCheckBox::stateChanged, this, &ChirpChatDemodGUI::on_header_stateChanged);
|
|
|
|
QObject::connect(ui->fecParity, &QDial::valueChanged, this, &ChirpChatDemodGUI::on_fecParity_valueChanged);
|
|
|
|
QObject::connect(ui->crc, &QCheckBox::stateChanged, this, &ChirpChatDemodGUI::on_crc_stateChanged);
|
|
|
|
QObject::connect(ui->packetLength, &QDial::valueChanged, this, &ChirpChatDemodGUI::on_packetLength_valueChanged);
|
|
|
|
QObject::connect(ui->udpSend, &QCheckBox::stateChanged, this, &ChirpChatDemodGUI::on_udpSend_stateChanged);
|
|
|
|
QObject::connect(ui->udpAddress, &QLineEdit::editingFinished, this, &ChirpChatDemodGUI::on_udpAddress_editingFinished);
|
|
|
|
QObject::connect(ui->udpPort, &QLineEdit::editingFinished, this, &ChirpChatDemodGUI::on_udpPort_editingFinished);
|
|
|
|
}
|
2022-04-13 05:08:21 -04:00
|
|
|
|
|
|
|
void ChirpChatDemodGUI::updateAbsoluteCenterFrequency()
|
|
|
|
{
|
|
|
|
setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset);
|
|
|
|
}
|