mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-04 07:51:14 -05:00
Add PSK31 modulator
This commit is contained in:
parent
df179ddf6b
commit
be0a675c0a
@ -108,6 +108,7 @@ option(ENABLE_CHANNELTX_MOD802.15.4 "Enable channeltx mod802.15.4 plugin" ON)
|
||||
option(ENABLE_CHANNELTX_REMOTESOURCE "Enable channeltx remotesource plugin" ON)
|
||||
option(ENABLE_CHANNELTX_FILESOURCE "Enable channeltx filesource plugin" ON)
|
||||
option(ENABLE_CHANNELTX_MODRTTY "Enable channeltx modrtty plugin" ON)
|
||||
option(ENABLE_CHANNELTX_MODPSK31 "Enable channeltx modpsk31 plugin" ON)
|
||||
|
||||
# Channel MIMO enablers
|
||||
option(ENABLE_CHANNELMIMO "Enable channelmimo plugins" ON)
|
||||
|
@ -1,5 +1,9 @@
|
||||
project(mod)
|
||||
|
||||
if (ENABLE_CHANNELTX_MODPSK31)
|
||||
add_subdirectory(modpsk31)
|
||||
endif()
|
||||
|
||||
if (ENABLE_CHANNELTX_MODRTTY)
|
||||
add_subdirectory(modrtty)
|
||||
endif()
|
||||
|
69
plugins/channeltx/modpsk31/CMakeLists.txt
Normal file
69
plugins/channeltx/modpsk31/CMakeLists.txt
Normal file
@ -0,0 +1,69 @@
|
||||
project(modpsk31)
|
||||
|
||||
set(modpsk31_SOURCES
|
||||
psk31mod.cpp
|
||||
psk31modbaseband.cpp
|
||||
psk31modsource.cpp
|
||||
psk31modplugin.cpp
|
||||
psk31modsettings.cpp
|
||||
psk31modwebapiadapter.cpp
|
||||
)
|
||||
|
||||
set(modpsk31_HEADERS
|
||||
psk31mod.h
|
||||
psk31modbaseband.h
|
||||
psk31modsource.h
|
||||
psk31modplugin.h
|
||||
psk31modsettings.h
|
||||
psk31modwebapiadapter.h
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||
)
|
||||
|
||||
if(NOT SERVER_MODE)
|
||||
set(modpsk31_SOURCES
|
||||
${modpsk31_SOURCES}
|
||||
psk31modgui.cpp
|
||||
psk31modgui.ui
|
||||
psk31modrepeatdialog.cpp
|
||||
psk31modrepeatdialog.ui
|
||||
psk31modtxsettingsdialog.cpp
|
||||
psk31modtxsettingsdialog.ui
|
||||
)
|
||||
set(modpsk31_HEADERS
|
||||
${modpsk31_HEADERS}
|
||||
psk31modgui.h
|
||||
psk31modrepeatdialog.h
|
||||
psk31modtxsettingsdialog.h
|
||||
)
|
||||
set(TARGET_NAME modpsk31)
|
||||
set(TARGET_LIB "Qt::Widgets")
|
||||
set(TARGET_LIB_GUI "sdrgui")
|
||||
set(INSTALL_FOLDER ${INSTALL_PLUGINS_DIR})
|
||||
else()
|
||||
set(TARGET_NAME modpsk31srv)
|
||||
set(TARGET_LIB "")
|
||||
set(TARGET_LIB_GUI "")
|
||||
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR})
|
||||
endif()
|
||||
|
||||
add_library(${TARGET_NAME} SHARED
|
||||
${modpsk31_SOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries(${TARGET_NAME}
|
||||
Qt::Core
|
||||
${TARGET_LIB}
|
||||
sdrbase
|
||||
${TARGET_LIB_GUI}
|
||||
swagger
|
||||
)
|
||||
|
||||
install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER})
|
||||
|
||||
# Install debug symbols
|
||||
if (WIN32)
|
||||
install(FILES $<TARGET_PDB_FILE:${TARGET_NAME}> CONFIGURATIONS Debug RelWithDebInfo DESTINATION ${INSTALL_FOLDER} )
|
||||
endif()
|
871
plugins/channeltx/modpsk31/psk31mod.cpp
Normal file
871
plugins/channeltx/modpsk31/psk31mod.cpp
Normal file
@ -0,0 +1,871 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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 <QTime>
|
||||
#include <QDebug>
|
||||
#include <QMutexLocker>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkDatagram>
|
||||
#include <QNetworkReply>
|
||||
#include <QBuffer>
|
||||
#include <QUdpSocket>
|
||||
#include <QThread>
|
||||
|
||||
#include "SWGChannelSettings.h"
|
||||
#include "SWGWorkspaceInfo.h"
|
||||
#include "SWGChannelReport.h"
|
||||
#include "SWGChannelActions.h"
|
||||
#include "SWGPSK31ModReport.h"
|
||||
#include "SWGPSK31ModActions.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <complex.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "feature/feature.h"
|
||||
#include "util/db.h"
|
||||
#include "util/crc.h"
|
||||
#include "maincore.h"
|
||||
|
||||
#include "psk31modbaseband.h"
|
||||
#include "psk31mod.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(PSK31::MsgConfigurePSK31, Message)
|
||||
MESSAGE_CLASS_DEFINITION(PSK31::MsgTx, Message)
|
||||
MESSAGE_CLASS_DEFINITION(PSK31::MsgReportTx, Message)
|
||||
MESSAGE_CLASS_DEFINITION(PSK31::MsgTXText, Message)
|
||||
|
||||
const char* const PSK31::m_channelIdURI = "sdrangel.channeltx.modpsk31";
|
||||
const char* const PSK31::m_channelId = "PSK31Mod";
|
||||
|
||||
PSK31::PSK31(DeviceAPI *deviceAPI) :
|
||||
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource),
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_spectrumVis(SDR_TX_SCALEF),
|
||||
m_sampleRate(48000),
|
||||
m_udpSocket(nullptr)
|
||||
{
|
||||
setObjectName(m_channelId);
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_basebandSource = new PSK31Baseband();
|
||||
m_basebandSource->setSpectrumSampleSink(&m_spectrumVis);
|
||||
m_basebandSource->setChannel(this);
|
||||
m_basebandSource->moveToThread(m_thread);
|
||||
|
||||
applySettings(m_settings, true);
|
||||
|
||||
m_deviceAPI->addChannelSource(this);
|
||||
m_deviceAPI->addChannelSourceAPI(this);
|
||||
|
||||
m_networkManager = new QNetworkAccessManager();
|
||||
QObject::connect(
|
||||
m_networkManager,
|
||||
&QNetworkAccessManager::finished,
|
||||
this,
|
||||
&PSK31::networkManagerFinished
|
||||
);
|
||||
}
|
||||
|
||||
PSK31::~PSK31()
|
||||
{
|
||||
closeUDP();
|
||||
QObject::connect(
|
||||
m_networkManager,
|
||||
&QNetworkAccessManager::finished,
|
||||
this,
|
||||
&PSK31::networkManagerFinished
|
||||
);
|
||||
delete m_networkManager;
|
||||
m_deviceAPI->removeChannelSourceAPI(this);
|
||||
m_deviceAPI->removeChannelSource(this);
|
||||
delete m_basebandSource;
|
||||
delete m_thread;
|
||||
}
|
||||
|
||||
void PSK31::setDeviceAPI(DeviceAPI *deviceAPI)
|
||||
{
|
||||
if (deviceAPI != m_deviceAPI)
|
||||
{
|
||||
m_deviceAPI->removeChannelSourceAPI(this);
|
||||
m_deviceAPI->removeChannelSource(this);
|
||||
m_deviceAPI = deviceAPI;
|
||||
m_deviceAPI->addChannelSource(this);
|
||||
m_deviceAPI->addChannelSinkAPI(this);
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31::start()
|
||||
{
|
||||
qDebug("PSK31::start");
|
||||
m_basebandSource->reset();
|
||||
m_thread->start();
|
||||
}
|
||||
|
||||
void PSK31::stop()
|
||||
{
|
||||
qDebug("PSK31::stop");
|
||||
m_thread->exit();
|
||||
m_thread->wait();
|
||||
}
|
||||
|
||||
void PSK31::pull(SampleVector::iterator& begin, unsigned int nbSamples)
|
||||
{
|
||||
m_basebandSource->pull(begin, nbSamples);
|
||||
}
|
||||
|
||||
bool PSK31::handleMessage(const Message& cmd)
|
||||
{
|
||||
if (MsgConfigurePSK31::match(cmd))
|
||||
{
|
||||
MsgConfigurePSK31& cfg = (MsgConfigurePSK31&) cmd;
|
||||
qDebug() << "PSK31::handleMessage: MsgConfigurePSK31";
|
||||
|
||||
applySettings(cfg.getSettings(), cfg.getForce());
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MsgTx::match(cmd))
|
||||
{
|
||||
MsgTx* msg = new MsgTx((const MsgTx&)cmd);
|
||||
m_basebandSource->getInputMessageQueue()->push(msg);
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MsgTXText::match(cmd))
|
||||
{
|
||||
MsgTXText* msg = new MsgTXText((const MsgTXText&)cmd);
|
||||
m_basebandSource->getInputMessageQueue()->push(msg);
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (DSPSignalNotification::match(cmd))
|
||||
{
|
||||
// Forward to the source
|
||||
DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
|
||||
DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy
|
||||
qDebug() << "PSK31::handleMessage: DSPSignalNotification";
|
||||
m_basebandSource->getInputMessageQueue()->push(rep);
|
||||
// Forward to GUI if any
|
||||
if (getMessageQueueToGUI()) {
|
||||
getMessageQueueToGUI()->push(new DSPSignalNotification(notif));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MainCore::MsgChannelDemodQuery::match(cmd))
|
||||
{
|
||||
qDebug() << "PSK31::handleMessage: MsgChannelDemodQuery";
|
||||
sendSampleRateToDemodAnalyzer();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31::setCenterFrequency(qint64 frequency)
|
||||
{
|
||||
PSK31Settings settings = m_settings;
|
||||
settings.m_inputFrequencyOffset = frequency;
|
||||
applySettings(settings, false);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigurePSK31 *msgToGUI = MsgConfigurePSK31::create(settings, false);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31::applySettings(const PSK31Settings& settings, bool force)
|
||||
{
|
||||
qDebug() << "PSK31::applySettings:"
|
||||
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
|
||||
<< " m_baud: " << settings.m_baud
|
||||
<< " m_rfBandwidth: " << settings.m_rfBandwidth
|
||||
<< " m_gain: " << settings.m_gain
|
||||
<< " m_channelMute: " << settings.m_channelMute
|
||||
<< " m_repeat: " << settings.m_repeat
|
||||
<< " m_repeatCount: " << settings.m_repeatCount
|
||||
<< " m_text: " << settings.m_text
|
||||
<< " m_prefixCRLF: " << settings.m_prefixCRLF
|
||||
<< " m_postfixCRLF: " << settings.m_postfixCRLF
|
||||
<< " m_useReverseAPI: " << settings.m_useReverseAPI
|
||||
<< " m_reverseAPIAddress: " << settings.m_reverseAPIAddress
|
||||
<< " m_reverseAPIAddress: " << settings.m_reverseAPIPort
|
||||
<< " m_reverseAPIDeviceIndex: " << settings.m_reverseAPIDeviceIndex
|
||||
<< " m_reverseAPIChannelIndex: " << settings.m_reverseAPIChannelIndex
|
||||
<< " force: " << force;
|
||||
|
||||
QList<QString> reverseAPIKeys;
|
||||
|
||||
if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force) {
|
||||
reverseAPIKeys.append("inputFrequencyOffset");
|
||||
}
|
||||
|
||||
if ((settings.m_baud != m_settings.m_baud) || force) {
|
||||
reverseAPIKeys.append("baud");
|
||||
}
|
||||
|
||||
if ((settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force) {
|
||||
reverseAPIKeys.append("rfBandwidth");
|
||||
}
|
||||
|
||||
if ((settings.m_gain != m_settings.m_gain) || force) {
|
||||
reverseAPIKeys.append("gain");
|
||||
}
|
||||
|
||||
if ((settings.m_channelMute != m_settings.m_channelMute) || force) {
|
||||
reverseAPIKeys.append("channelMute");
|
||||
}
|
||||
|
||||
if ((settings.m_repeat != m_settings.m_repeat) || force) {
|
||||
reverseAPIKeys.append("repeat");
|
||||
}
|
||||
|
||||
if ((settings.m_repeatCount != m_settings.m_repeatCount) || force) {
|
||||
reverseAPIKeys.append("repeatCount");
|
||||
}
|
||||
|
||||
if ((settings.m_lpfTaps != m_settings.m_lpfTaps) || force) {
|
||||
reverseAPIKeys.append("lpfTaps");
|
||||
}
|
||||
|
||||
if ((settings.m_rfNoise != m_settings.m_rfNoise) || force) {
|
||||
reverseAPIKeys.append("rfNoise");
|
||||
}
|
||||
|
||||
if ((settings.m_text != m_settings.m_text) || force) {
|
||||
reverseAPIKeys.append("text");
|
||||
}
|
||||
|
||||
if ((settings.m_beta != m_settings.m_beta) || force) {
|
||||
reverseAPIKeys.append("beta");
|
||||
}
|
||||
|
||||
if ((settings.m_symbolSpan != m_settings.m_symbolSpan) || force) {
|
||||
reverseAPIKeys.append("symbolSpan");
|
||||
}
|
||||
|
||||
if ((settings.m_prefixCRLF != m_settings.m_prefixCRLF) || force) {
|
||||
reverseAPIKeys.append("prefixCRLF");
|
||||
}
|
||||
|
||||
if ((settings.m_postfixCRLF != m_settings.m_postfixCRLF) || force) {
|
||||
reverseAPIKeys.append("postfixCRLF");
|
||||
}
|
||||
|
||||
if ((settings.m_udpEnabled != m_settings.m_udpEnabled) || force) {
|
||||
reverseAPIKeys.append("udpEnabled");
|
||||
}
|
||||
|
||||
if ((settings.m_udpAddress != m_settings.m_udpAddress) || force) {
|
||||
reverseAPIKeys.append("udpAddress");
|
||||
}
|
||||
|
||||
if ((settings.m_udpPort != m_settings.m_udpPort) || force) {
|
||||
reverseAPIKeys.append("udpPort");
|
||||
}
|
||||
|
||||
if ( (settings.m_udpEnabled != m_settings.m_udpEnabled)
|
||||
|| (settings.m_udpAddress != m_settings.m_udpAddress)
|
||||
|| (settings.m_udpPort != m_settings.m_udpPort)
|
||||
|| force)
|
||||
{
|
||||
if (settings.m_udpEnabled)
|
||||
openUDP(settings);
|
||||
else
|
||||
closeUDP();
|
||||
}
|
||||
|
||||
if (m_settings.m_streamIndex != settings.m_streamIndex)
|
||||
{
|
||||
if (m_deviceAPI->getSampleMIMO()) // change of stream is possible for MIMO devices only
|
||||
{
|
||||
m_deviceAPI->removeChannelSourceAPI(this);
|
||||
m_deviceAPI->removeChannelSource(this, m_settings.m_streamIndex);
|
||||
m_deviceAPI->addChannelSource(this, settings.m_streamIndex);
|
||||
m_deviceAPI->addChannelSourceAPI(this);
|
||||
}
|
||||
|
||||
reverseAPIKeys.append("streamIndex");
|
||||
}
|
||||
|
||||
PSK31Baseband::MsgConfigurePSK31Baseband *msg = PSK31Baseband::MsgConfigurePSK31Baseband::create(settings, force);
|
||||
m_basebandSource->getInputMessageQueue()->push(msg);
|
||||
|
||||
if (settings.m_useReverseAPI)
|
||||
{
|
||||
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
|
||||
(m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) ||
|
||||
(m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) ||
|
||||
(m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex) ||
|
||||
(m_settings.m_reverseAPIChannelIndex != settings.m_reverseAPIChannelIndex);
|
||||
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
|
||||
}
|
||||
|
||||
QList<ObjectPipe*> pipes;
|
||||
MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes);
|
||||
|
||||
if (pipes.size() > 0) {
|
||||
sendChannelSettings(pipes, reverseAPIKeys, settings, force);
|
||||
}
|
||||
|
||||
m_settings = settings;
|
||||
}
|
||||
|
||||
QByteArray PSK31::serialize() const
|
||||
{
|
||||
return m_settings.serialize();
|
||||
}
|
||||
|
||||
bool PSK31::deserialize(const QByteArray& data)
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
if (!m_settings.deserialize(data))
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigurePSK31 *msg = MsgConfigurePSK31::create(m_settings, true);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void PSK31::sendSampleRateToDemodAnalyzer()
|
||||
{
|
||||
QList<ObjectPipe*> pipes;
|
||||
MainCore::instance()->getMessagePipes().getMessagePipes(this, "reportdemod", pipes);
|
||||
|
||||
if (pipes.size() > 0)
|
||||
{
|
||||
for (const auto& pipe : pipes)
|
||||
{
|
||||
MessageQueue* messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||
MainCore::MsgChannelDemodReport *msg = MainCore::MsgChannelDemodReport::create(
|
||||
this,
|
||||
getSourceChannelSampleRate()
|
||||
);
|
||||
messageQueue->push(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int PSK31::webapiSettingsGet(
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setPSK31Settings(new SWGSDRangel::SWGPSK31ModSettings());
|
||||
response.getPSK31Settings()->init();
|
||||
webapiFormatChannelSettings(response, m_settings);
|
||||
|
||||
return 200;
|
||||
}
|
||||
|
||||
int PSK31::webapiWorkspaceGet(
|
||||
SWGSDRangel::SWGWorkspaceInfo& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setIndex(m_settings.m_workspaceIndex);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int PSK31::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
PSK31Settings settings = m_settings;
|
||||
webapiUpdateChannelSettings(settings, channelSettingsKeys, response);
|
||||
|
||||
MsgConfigurePSK31 *msg = MsgConfigurePSK31::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigurePSK31 *msgToGUI = MsgConfigurePSK31::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatChannelSettings(response, settings);
|
||||
|
||||
return 200;
|
||||
}
|
||||
|
||||
void PSK31::webapiUpdateChannelSettings(
|
||||
PSK31Settings& settings,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response)
|
||||
{
|
||||
if (channelSettingsKeys.contains("inputFrequencyOffset")) {
|
||||
settings.m_inputFrequencyOffset = response.getPSK31Settings()->getInputFrequencyOffset();
|
||||
}
|
||||
if (channelSettingsKeys.contains("baud")) {
|
||||
settings.m_baud = response.getPSK31Settings()->getBaud();
|
||||
}
|
||||
if (channelSettingsKeys.contains("rfBandwidth")) {
|
||||
settings.m_rfBandwidth = response.getPSK31Settings()->getRfBandwidth();
|
||||
}
|
||||
if (channelSettingsKeys.contains("gain")) {
|
||||
settings.m_gain = response.getPSK31Settings()->getGain();
|
||||
}
|
||||
if (channelSettingsKeys.contains("channelMute")) {
|
||||
settings.m_channelMute = response.getPSK31Settings()->getChannelMute() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("repeat")) {
|
||||
settings.m_repeat = response.getPSK31Settings()->getRepeat() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("repeatCount")) {
|
||||
settings.m_repeatCount = response.getPSK31Settings()->getRepeatCount();
|
||||
}
|
||||
if (channelSettingsKeys.contains("lpfTaps")) {
|
||||
settings.m_lpfTaps = response.getPSK31Settings()->getLpfTaps();
|
||||
}
|
||||
if (channelSettingsKeys.contains("rfNoise")) {
|
||||
settings.m_rfNoise = response.getPSK31Settings()->getRfNoise() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("text")) {
|
||||
settings.m_text = *response.getPSK31Settings()->getText();
|
||||
}
|
||||
if (channelSettingsKeys.contains("beta")) {
|
||||
settings.m_beta = response.getPSK31Settings()->getBeta();
|
||||
}
|
||||
if (channelSettingsKeys.contains("symbolSpan")) {
|
||||
settings.m_symbolSpan = response.getPSK31Settings()->getSymbolSpan();
|
||||
}
|
||||
if (channelSettingsKeys.contains("prefixCRLF")) {
|
||||
settings.m_prefixCRLF = response.getPSK31Settings()->getPrefixCrlf();
|
||||
}
|
||||
if (channelSettingsKeys.contains("postfixCRLF")) {
|
||||
settings.m_postfixCRLF = response.getPSK31Settings()->getPostfixCrlf();
|
||||
}
|
||||
if (channelSettingsKeys.contains("rgbColor")) {
|
||||
settings.m_rgbColor = response.getPSK31Settings()->getRgbColor();
|
||||
}
|
||||
if (channelSettingsKeys.contains("title")) {
|
||||
settings.m_title = *response.getPSK31Settings()->getTitle();
|
||||
}
|
||||
if (channelSettingsKeys.contains("streamIndex")) {
|
||||
settings.m_streamIndex = response.getPSK31Settings()->getStreamIndex();
|
||||
}
|
||||
if (channelSettingsKeys.contains("useReverseAPI")) {
|
||||
settings.m_useReverseAPI = response.getPSK31Settings()->getUseReverseApi() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("reverseAPIAddress")) {
|
||||
settings.m_reverseAPIAddress = *response.getPSK31Settings()->getReverseApiAddress();
|
||||
}
|
||||
if (channelSettingsKeys.contains("reverseAPIPort")) {
|
||||
settings.m_reverseAPIPort = response.getPSK31Settings()->getReverseApiPort();
|
||||
}
|
||||
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
settings.m_reverseAPIDeviceIndex = response.getPSK31Settings()->getReverseApiDeviceIndex();
|
||||
}
|
||||
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
|
||||
settings.m_reverseAPIChannelIndex = response.getPSK31Settings()->getReverseApiChannelIndex();
|
||||
}
|
||||
if (channelSettingsKeys.contains("udpEnabled")) {
|
||||
settings.m_udpEnabled = response.getPSK31Settings()->getUdpEnabled();
|
||||
}
|
||||
if (channelSettingsKeys.contains("udpAddress")) {
|
||||
settings.m_udpAddress = *response.getPSK31Settings()->getUdpAddress();
|
||||
}
|
||||
if (channelSettingsKeys.contains("udpPort")) {
|
||||
settings.m_udpPort = response.getPSK31Settings()->getUdpPort();
|
||||
}
|
||||
if (settings.m_channelMarker && channelSettingsKeys.contains("channelMarker")) {
|
||||
settings.m_channelMarker->updateFrom(channelSettingsKeys, response.getPSK31Settings()->getChannelMarker());
|
||||
}
|
||||
if (settings.m_rollupState && channelSettingsKeys.contains("rollupState")) {
|
||||
settings.m_rollupState->updateFrom(channelSettingsKeys, response.getPSK31Settings()->getRollupState());
|
||||
}
|
||||
}
|
||||
|
||||
int PSK31::webapiReportGet(
|
||||
SWGSDRangel::SWGChannelReport& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setPSK31Report(new SWGSDRangel::SWGPSK31ModReport());
|
||||
response.getPSK31Report()->init();
|
||||
webapiFormatChannelReport(response);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int PSK31::webapiActionsPost(
|
||||
const QStringList& channelActionsKeys,
|
||||
SWGSDRangel::SWGChannelActions& query,
|
||||
QString& errorMessage)
|
||||
{
|
||||
SWGSDRangel::SWGPSK31ModActions *swgPSK31Actions = query.getPSK31Actions();
|
||||
|
||||
if (swgPSK31Actions)
|
||||
{
|
||||
if (channelActionsKeys.contains("tx"))
|
||||
{
|
||||
if (swgPSK31Actions->getTx() != 0)
|
||||
{
|
||||
if (channelActionsKeys.contains("payload")
|
||||
&& (swgPSK31Actions->getPayload()->getText()))
|
||||
{
|
||||
MsgTXText *msg = MsgTXText::create(
|
||||
*swgPSK31Actions->getPayload()->getText()
|
||||
);
|
||||
m_basebandSource->getInputMessageQueue()->push(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MsgTx *msg = MsgTx::create();
|
||||
m_basebandSource->getInputMessageQueue()->push(msg);
|
||||
}
|
||||
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = "Must contain tx action";
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = "Unknown PSK31Mod action";
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = "Missing PSK31ModActions in query";
|
||||
return 400;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PSK31::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const PSK31Settings& settings)
|
||||
{
|
||||
response.getPSK31Settings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
|
||||
response.getPSK31Settings()->setBaud(settings.m_baud);
|
||||
response.getPSK31Settings()->setRfBandwidth(settings.m_rfBandwidth);
|
||||
response.getPSK31Settings()->setGain(settings.m_gain);
|
||||
response.getPSK31Settings()->setChannelMute(settings.m_channelMute ? 1 : 0);
|
||||
response.getPSK31Settings()->setRepeat(settings.m_repeat ? 1 : 0);
|
||||
response.getPSK31Settings()->setRepeatCount(settings.m_repeatCount);
|
||||
response.getPSK31Settings()->setLpfTaps(settings.m_lpfTaps);
|
||||
response.getPSK31Settings()->setRfNoise(settings.m_rfNoise ? 1 : 0);
|
||||
|
||||
if (response.getPSK31Settings()->getText()) {
|
||||
*response.getPSK31Settings()->getText() = settings.m_text;
|
||||
} else {
|
||||
response.getPSK31Settings()->setText(new QString(settings.m_text));
|
||||
}
|
||||
|
||||
response.getPSK31Settings()->setPulseShaping(settings.m_pulseShaping ? 1 : 0);
|
||||
response.getPSK31Settings()->setBeta(settings.m_beta);
|
||||
response.getPSK31Settings()->setSymbolSpan(settings.m_symbolSpan);
|
||||
|
||||
response.getPSK31Settings()->setPrefixCrlf(settings.m_prefixCRLF);
|
||||
response.getPSK31Settings()->setPostfixCrlf(settings.m_postfixCRLF);
|
||||
|
||||
response.getPSK31Settings()->setUdpEnabled(settings.m_udpEnabled);
|
||||
response.getPSK31Settings()->setUdpAddress(new QString(settings.m_udpAddress));
|
||||
response.getPSK31Settings()->setUdpPort(settings.m_udpPort);
|
||||
|
||||
response.getPSK31Settings()->setRgbColor(settings.m_rgbColor);
|
||||
|
||||
if (response.getPSK31Settings()->getTitle()) {
|
||||
*response.getPSK31Settings()->getTitle() = settings.m_title;
|
||||
} else {
|
||||
response.getPSK31Settings()->setTitle(new QString(settings.m_title));
|
||||
}
|
||||
|
||||
response.getPSK31Settings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
|
||||
|
||||
if (response.getPSK31Settings()->getReverseApiAddress()) {
|
||||
*response.getPSK31Settings()->getReverseApiAddress() = settings.m_reverseAPIAddress;
|
||||
} else {
|
||||
response.getPSK31Settings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
|
||||
}
|
||||
|
||||
response.getPSK31Settings()->setReverseApiPort(settings.m_reverseAPIPort);
|
||||
response.getPSK31Settings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
|
||||
response.getPSK31Settings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex);
|
||||
|
||||
if (settings.m_channelMarker)
|
||||
{
|
||||
if (response.getPSK31Settings()->getChannelMarker())
|
||||
{
|
||||
settings.m_channelMarker->formatTo(response.getPSK31Settings()->getChannelMarker());
|
||||
}
|
||||
else
|
||||
{
|
||||
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
||||
settings.m_channelMarker->formatTo(swgChannelMarker);
|
||||
response.getPSK31Settings()->setChannelMarker(swgChannelMarker);
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.m_rollupState)
|
||||
{
|
||||
if (response.getPSK31Settings()->getRollupState())
|
||||
{
|
||||
settings.m_rollupState->formatTo(response.getPSK31Settings()->getRollupState());
|
||||
}
|
||||
else
|
||||
{
|
||||
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState();
|
||||
settings.m_rollupState->formatTo(swgRollupState);
|
||||
response.getPSK31Settings()->setRollupState(swgRollupState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
||||
{
|
||||
response.getPSK31Report()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
|
||||
response.getPSK31Report()->setChannelSampleRate(m_basebandSource->getChannelSampleRate());
|
||||
}
|
||||
|
||||
void PSK31::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const PSK31Settings& settings, bool force)
|
||||
{
|
||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
||||
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
||||
|
||||
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
|
||||
.arg(settings.m_reverseAPIAddress)
|
||||
.arg(settings.m_reverseAPIPort)
|
||||
.arg(settings.m_reverseAPIDeviceIndex)
|
||||
.arg(settings.m_reverseAPIChannelIndex);
|
||||
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||
|
||||
QBuffer *buffer = new QBuffer();
|
||||
buffer->open((QBuffer::ReadWrite));
|
||||
buffer->write(swgChannelSettings->asJson().toUtf8());
|
||||
buffer->seek(0);
|
||||
|
||||
// Always use PATCH to avoid passing reverse API settings
|
||||
QNetworkReply *reply = m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
|
||||
buffer->setParent(reply);
|
||||
|
||||
delete swgChannelSettings;
|
||||
}
|
||||
|
||||
void PSK31::sendChannelSettings(
|
||||
const QList<ObjectPipe*>& pipes,
|
||||
QList<QString>& channelSettingsKeys,
|
||||
const PSK31Settings& settings,
|
||||
bool force)
|
||||
{
|
||||
for (const auto& pipe : pipes)
|
||||
{
|
||||
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||
|
||||
if (messageQueue)
|
||||
{
|
||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
||||
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
||||
MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create(
|
||||
this,
|
||||
channelSettingsKeys,
|
||||
swgChannelSettings,
|
||||
force
|
||||
);
|
||||
messageQueue->push(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31::webapiFormatChannelSettings(
|
||||
QList<QString>& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
||||
const PSK31Settings& settings,
|
||||
bool force
|
||||
)
|
||||
{
|
||||
swgChannelSettings->setDirection(1); // single source (Tx)
|
||||
swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet());
|
||||
swgChannelSettings->setOriginatorDeviceSetIndex(getDeviceSetIndex());
|
||||
swgChannelSettings->setChannelType(new QString(m_channelId));
|
||||
swgChannelSettings->setPSK31Settings(new SWGSDRangel::SWGPSK31ModSettings());
|
||||
SWGSDRangel::SWGPSK31ModSettings *swgPSK31Settings = swgChannelSettings->getPSK31Settings();
|
||||
|
||||
// transfer data that has been modified. When force is on transfer all data except reverse API data
|
||||
|
||||
if (channelSettingsKeys.contains("inputFrequencyOffset") || force) {
|
||||
swgPSK31Settings->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
|
||||
}
|
||||
if (channelSettingsKeys.contains("baud") || force) {
|
||||
swgPSK31Settings->setBaud((int) settings.m_baud);
|
||||
}
|
||||
if (channelSettingsKeys.contains("rfBandwidth") || force) {
|
||||
swgPSK31Settings->setRfBandwidth(settings.m_rfBandwidth);
|
||||
}
|
||||
if (channelSettingsKeys.contains("gain") || force) {
|
||||
swgPSK31Settings->setGain(settings.m_gain);
|
||||
}
|
||||
if (channelSettingsKeys.contains("channelMute") || force) {
|
||||
swgPSK31Settings->setChannelMute(settings.m_channelMute ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("repeat") || force) {
|
||||
swgPSK31Settings->setRepeat(settings.m_repeat ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("repeatCount") || force) {
|
||||
swgPSK31Settings->setRepeatCount(settings.m_repeatCount);
|
||||
}
|
||||
if (channelSettingsKeys.contains("lpfTaps")) {
|
||||
swgPSK31Settings->setLpfTaps(settings.m_lpfTaps);
|
||||
}
|
||||
if (channelSettingsKeys.contains("rfNoise")) {
|
||||
swgPSK31Settings->setRfNoise(settings.m_rfNoise ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("text")) {
|
||||
swgPSK31Settings->setText(new QString(settings.m_text));
|
||||
}
|
||||
if (channelSettingsKeys.contains("beta")) {
|
||||
swgPSK31Settings->setBeta(settings.m_beta);
|
||||
}
|
||||
if (channelSettingsKeys.contains("symbolSpan")) {
|
||||
swgPSK31Settings->setSymbolSpan(settings.m_symbolSpan);
|
||||
}
|
||||
if (channelSettingsKeys.contains("prefixCRLF")) {
|
||||
swgPSK31Settings->setPrefixCrlf(settings.m_prefixCRLF);
|
||||
}
|
||||
if (channelSettingsKeys.contains("postfixCRLF")) {
|
||||
swgPSK31Settings->setPostfixCrlf(settings.m_postfixCRLF);
|
||||
}
|
||||
if (channelSettingsKeys.contains("rgbColor") || force) {
|
||||
swgPSK31Settings->setRgbColor(settings.m_rgbColor);
|
||||
}
|
||||
if (channelSettingsKeys.contains("title") || force) {
|
||||
swgPSK31Settings->setTitle(new QString(settings.m_title));
|
||||
}
|
||||
if (channelSettingsKeys.contains("streamIndex") || force) {
|
||||
swgPSK31Settings->setStreamIndex(settings.m_streamIndex);
|
||||
}
|
||||
if (channelSettingsKeys.contains("udpEnabled") || force) {
|
||||
swgPSK31Settings->setUdpEnabled(settings.m_udpEnabled);
|
||||
}
|
||||
if (channelSettingsKeys.contains("udpAddress") || force) {
|
||||
swgPSK31Settings->setUdpAddress(new QString(settings.m_udpAddress));
|
||||
}
|
||||
if (channelSettingsKeys.contains("udpPort") || force) {
|
||||
swgPSK31Settings->setUdpPort(settings.m_udpPort);
|
||||
}
|
||||
|
||||
if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force))
|
||||
{
|
||||
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
||||
settings.m_channelMarker->formatTo(swgChannelMarker);
|
||||
swgPSK31Settings->setChannelMarker(swgChannelMarker);
|
||||
}
|
||||
|
||||
if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force))
|
||||
{
|
||||
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState();
|
||||
settings.m_rollupState->formatTo(swgRollupState);
|
||||
swgPSK31Settings->setRollupState(swgRollupState);
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31::networkManagerFinished(QNetworkReply *reply)
|
||||
{
|
||||
QNetworkReply::NetworkError replyError = reply->error();
|
||||
|
||||
if (replyError)
|
||||
{
|
||||
qWarning() << "PSK31::networkManagerFinished:"
|
||||
<< " error(" << (int) replyError
|
||||
<< "): " << replyError
|
||||
<< ": " << reply->errorString();
|
||||
}
|
||||
else
|
||||
{
|
||||
QString answer = reply->readAll();
|
||||
answer.chop(1); // remove last \n
|
||||
qDebug("PSK31::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
|
||||
}
|
||||
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
double PSK31::getMagSq() const
|
||||
{
|
||||
return m_basebandSource->getMagSq();
|
||||
}
|
||||
|
||||
void PSK31::setLevelMeter(QObject *levelMeter)
|
||||
{
|
||||
connect(m_basebandSource, SIGNAL(levelChanged(qreal, qreal, int)), levelMeter, SLOT(levelChanged(qreal, qreal, int)));
|
||||
}
|
||||
|
||||
uint32_t PSK31::getNumberOfDeviceStreams() const
|
||||
{
|
||||
return m_deviceAPI->getNbSinkStreams();
|
||||
}
|
||||
|
||||
int PSK31::getSourceChannelSampleRate() const
|
||||
{
|
||||
return m_basebandSource->getSourceChannelSampleRate();
|
||||
}
|
||||
|
||||
void PSK31::openUDP(const PSK31Settings& settings)
|
||||
{
|
||||
closeUDP();
|
||||
m_udpSocket = new QUdpSocket();
|
||||
if (!m_udpSocket->bind(QHostAddress(settings.m_udpAddress), settings.m_udpPort))
|
||||
qCritical() << "PSK31::openUDP: Failed to bind to port " << settings.m_udpAddress << ":" << settings.m_udpPort << ". Error: " << m_udpSocket->error();
|
||||
else
|
||||
qDebug() << "PSK31::openUDP: Listening for text on " << settings.m_udpAddress << ":" << settings.m_udpPort;
|
||||
connect(m_udpSocket, &QUdpSocket::readyRead, this, &PSK31::udpRx);
|
||||
}
|
||||
|
||||
void PSK31::closeUDP()
|
||||
{
|
||||
if (m_udpSocket != nullptr)
|
||||
{
|
||||
disconnect(m_udpSocket, &QUdpSocket::readyRead, this, &PSK31::udpRx);
|
||||
delete m_udpSocket;
|
||||
m_udpSocket = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31::udpRx()
|
||||
{
|
||||
while (m_udpSocket->hasPendingDatagrams())
|
||||
{
|
||||
QNetworkDatagram datagram = m_udpSocket->receiveDatagram();
|
||||
MsgTXText *msg = MsgTXText::create(QString(datagram.data()));
|
||||
m_basebandSource->getInputMessageQueue()->push(msg);
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31::setMessageQueueToGUI(MessageQueue* queue) {
|
||||
ChannelAPI::setMessageQueueToGUI(queue);
|
||||
m_basebandSource->setMessageQueueToGUI(queue);
|
||||
}
|
246
plugins/channeltx/modpsk31/psk31mod.h
Normal file
246
plugins/channeltx/modpsk31/psk31mod.h
Normal file
@ -0,0 +1,246 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016-2019 Edouard Griffiths, F4EXB //
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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 PLUGINS_CHANNELTX_MODPSK31_PSK31MOD_H_
|
||||
#define PLUGINS_CHANNELTX_MODPSK31_PSK31MOD_H_
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include <QRecursiveMutex>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
#include "dsp/basebandsamplesource.h"
|
||||
#include "dsp/spectrumvis.h"
|
||||
#include "channel/channelapi.h"
|
||||
#include "util/message.h"
|
||||
|
||||
#include "psk31modsettings.h"
|
||||
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
class QThread;
|
||||
class QUdpSocket;
|
||||
class DeviceAPI;
|
||||
class PSK31Baseband;
|
||||
class ObjectPipe;
|
||||
|
||||
class PSK31 : public BasebandSampleSource, public ChannelAPI {
|
||||
public:
|
||||
class MsgConfigurePSK31 : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const PSK31Settings& getSettings() const { return m_settings; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigurePSK31* create(const PSK31Settings& settings, bool force)
|
||||
{
|
||||
return new MsgConfigurePSK31(settings, force);
|
||||
}
|
||||
|
||||
private:
|
||||
PSK31Settings m_settings;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigurePSK31(const PSK31Settings& settings, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgTx : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
static MsgTx* create() {
|
||||
return new MsgTx();
|
||||
}
|
||||
|
||||
private:
|
||||
MsgTx() :
|
||||
Message()
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgReportTx : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const QString& getText() const { return m_text; }
|
||||
int getBufferedCharacters() const { return m_bufferedCharacters; }
|
||||
|
||||
static MsgReportTx* create(const QString& text, int bufferedCharacters) {
|
||||
return new MsgReportTx(text, bufferedCharacters);
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_text;
|
||||
int m_bufferedCharacters;
|
||||
|
||||
MsgReportTx(const QString& text, int bufferedCharacters) :
|
||||
Message(),
|
||||
m_text(text),
|
||||
m_bufferedCharacters(bufferedCharacters)
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgTXText : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
static MsgTXText* create(QString text)
|
||||
{
|
||||
return new MsgTXText(text);
|
||||
}
|
||||
|
||||
QString m_text;
|
||||
|
||||
private:
|
||||
|
||||
MsgTXText(QString text) :
|
||||
Message(),
|
||||
m_text(text)
|
||||
{ }
|
||||
};
|
||||
|
||||
//=================================================================
|
||||
|
||||
PSK31(DeviceAPI *deviceAPI);
|
||||
virtual ~PSK31();
|
||||
virtual void destroy() { delete this; }
|
||||
virtual void setDeviceAPI(DeviceAPI *deviceAPI);
|
||||
virtual DeviceAPI *getDeviceAPI() { return m_deviceAPI; }
|
||||
|
||||
virtual void start();
|
||||
virtual void stop();
|
||||
virtual void pull(SampleVector::iterator& begin, unsigned int nbSamples);
|
||||
virtual void pushMessage(Message *msg) { m_inputMessageQueue.push(msg); }
|
||||
virtual QString getSourceName() { return objectName(); }
|
||||
|
||||
virtual void getIdentifier(QString& id) { id = objectName(); }
|
||||
virtual QString getIdentifier() const { return objectName(); }
|
||||
virtual void getTitle(QString& title) { title = m_settings.m_title; }
|
||||
virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; }
|
||||
virtual void setCenterFrequency(qint64 frequency);
|
||||
|
||||
virtual QByteArray serialize() const;
|
||||
virtual bool deserialize(const QByteArray& data);
|
||||
|
||||
virtual int getNbSinkStreams() const { return 1; }
|
||||
virtual int getNbSourceStreams() const { return 0; }
|
||||
|
||||
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const
|
||||
{
|
||||
(void) streamIndex;
|
||||
(void) sinkElseSource;
|
||||
return m_settings.m_inputFrequencyOffset;
|
||||
}
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiWorkspaceGet(
|
||||
SWGSDRangel::SWGWorkspaceInfo& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiReportGet(
|
||||
SWGSDRangel::SWGChannelReport& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiActionsPost(
|
||||
const QStringList& channelActionsKeys,
|
||||
SWGSDRangel::SWGChannelActions& query,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatChannelSettings(
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
const PSK31Settings& settings);
|
||||
|
||||
static void webapiUpdateChannelSettings(
|
||||
PSK31Settings& settings,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response);
|
||||
|
||||
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }
|
||||
double getMagSq() const;
|
||||
void setLevelMeter(QObject *levelMeter);
|
||||
uint32_t getNumberOfDeviceStreams() const;
|
||||
int getSourceChannelSampleRate() const;
|
||||
void setMessageQueueToGUI(MessageQueue* queue) override;
|
||||
|
||||
static const char* const m_channelIdURI;
|
||||
static const char* const m_channelId;
|
||||
|
||||
private:
|
||||
enum RateState {
|
||||
RSInitialFill,
|
||||
RSRunning
|
||||
};
|
||||
|
||||
DeviceAPI* m_deviceAPI;
|
||||
QThread *m_thread;
|
||||
PSK31Baseband* m_basebandSource;
|
||||
PSK31Settings m_settings;
|
||||
SpectrumVis m_spectrumVis;
|
||||
|
||||
SampleVector m_sampleBuffer;
|
||||
QRecursiveMutex m_settingsMutex;
|
||||
|
||||
int m_sampleRate;
|
||||
|
||||
QNetworkAccessManager *m_networkManager;
|
||||
QNetworkRequest m_networkRequest;
|
||||
QUdpSocket *m_udpSocket;
|
||||
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
void applySettings(const PSK31Settings& settings, bool force = false);
|
||||
void sendSampleRateToDemodAnalyzer();
|
||||
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const PSK31Settings& settings, bool force);
|
||||
void sendChannelSettings(
|
||||
const QList<ObjectPipe*>& pipes,
|
||||
QList<QString>& channelSettingsKeys,
|
||||
const PSK31Settings& settings,
|
||||
bool force
|
||||
);
|
||||
void webapiFormatChannelSettings(
|
||||
QList<QString>& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
||||
const PSK31Settings& settings,
|
||||
bool force
|
||||
);
|
||||
void openUDP(const PSK31Settings& settings);
|
||||
void closeUDP();
|
||||
|
||||
private slots:
|
||||
void networkManagerFinished(QNetworkReply *reply);
|
||||
void udpRx();
|
||||
};
|
||||
|
||||
|
||||
#endif /* PLUGINS_CHANNELTX_MODPSK31_PSK31MOD_H_ */
|
200
plugins/channeltx/modpsk31/psk31modbaseband.cpp
Normal file
200
plugins/channeltx/modpsk31/psk31modbaseband.cpp
Normal file
@ -0,0 +1,200 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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 <QDebug>
|
||||
|
||||
#include "dsp/upchannelizer.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
|
||||
#include "psk31modbaseband.h"
|
||||
#include "psk31mod.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(PSK31Baseband::MsgConfigurePSK31Baseband, Message)
|
||||
|
||||
PSK31Baseband::PSK31Baseband()
|
||||
{
|
||||
m_sampleFifo.resize(SampleSourceFifo::getSizePolicy(48000));
|
||||
m_channelizer = new UpChannelizer(&m_source);
|
||||
|
||||
qDebug("PSK31Baseband::PSK31Baseband");
|
||||
QObject::connect(
|
||||
&m_sampleFifo,
|
||||
&SampleSourceFifo::dataRead,
|
||||
this,
|
||||
&PSK31Baseband::handleData,
|
||||
Qt::QueuedConnection
|
||||
);
|
||||
|
||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
||||
}
|
||||
|
||||
PSK31Baseband::~PSK31Baseband()
|
||||
{
|
||||
delete m_channelizer;
|
||||
}
|
||||
|
||||
void PSK31Baseband::reset()
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
m_sampleFifo.reset();
|
||||
}
|
||||
|
||||
void PSK31Baseband::setChannel(ChannelAPI *channel)
|
||||
{
|
||||
m_source.setChannel(channel);
|
||||
}
|
||||
|
||||
void PSK31Baseband::pull(const SampleVector::iterator& begin, unsigned int nbSamples)
|
||||
{
|
||||
unsigned int part1Begin, part1End, part2Begin, part2End;
|
||||
m_sampleFifo.read(nbSamples, part1Begin, part1End, part2Begin, part2End);
|
||||
SampleVector& data = m_sampleFifo.getData();
|
||||
|
||||
if (part1Begin != part1End)
|
||||
{
|
||||
std::copy(
|
||||
data.begin() + part1Begin,
|
||||
data.begin() + part1End,
|
||||
begin
|
||||
);
|
||||
}
|
||||
|
||||
unsigned int shift = part1End - part1Begin;
|
||||
|
||||
if (part2Begin != part2End)
|
||||
{
|
||||
std::copy(
|
||||
data.begin() + part2Begin,
|
||||
data.begin() + part2End,
|
||||
begin + shift
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31Baseband::handleData()
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
SampleVector& data = m_sampleFifo.getData();
|
||||
unsigned int ipart1begin;
|
||||
unsigned int ipart1end;
|
||||
unsigned int ipart2begin;
|
||||
unsigned int ipart2end;
|
||||
qreal rmsLevel, peakLevel;
|
||||
int numSamples;
|
||||
|
||||
unsigned int remainder = m_sampleFifo.remainder();
|
||||
|
||||
while ((remainder > 0) && (m_inputMessageQueue.size() == 0))
|
||||
{
|
||||
m_sampleFifo.write(remainder, ipart1begin, ipart1end, ipart2begin, ipart2end);
|
||||
|
||||
if (ipart1begin != ipart1end) { // first part of FIFO data
|
||||
processFifo(data, ipart1begin, ipart1end);
|
||||
}
|
||||
|
||||
if (ipart2begin != ipart2end) { // second part of FIFO data (used when block wraps around)
|
||||
processFifo(data, ipart2begin, ipart2end);
|
||||
}
|
||||
|
||||
remainder = m_sampleFifo.remainder();
|
||||
}
|
||||
|
||||
m_source.getLevels(rmsLevel, peakLevel, numSamples);
|
||||
emit levelChanged(rmsLevel, peakLevel, numSamples);
|
||||
}
|
||||
|
||||
void PSK31Baseband::processFifo(SampleVector& data, unsigned int iBegin, unsigned int iEnd)
|
||||
{
|
||||
m_channelizer->prefetch(iEnd - iBegin);
|
||||
m_channelizer->pull(data.begin() + iBegin, iEnd - iBegin);
|
||||
}
|
||||
|
||||
void PSK31Baseband::handleInputMessages()
|
||||
{
|
||||
Message* message;
|
||||
|
||||
while ((message = m_inputMessageQueue.pop()) != nullptr)
|
||||
{
|
||||
if (handleMessage(*message)) {
|
||||
delete message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool PSK31Baseband::handleMessage(const Message& cmd)
|
||||
{
|
||||
if (MsgConfigurePSK31Baseband::match(cmd))
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
MsgConfigurePSK31Baseband& cfg = (MsgConfigurePSK31Baseband&) cmd;
|
||||
qDebug() << "PSK31Baseband::handleMessage: MsgConfigurePSK31Baseband";
|
||||
|
||||
applySettings(cfg.getSettings(), cfg.getForce());
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (PSK31::MsgTx::match(cmd))
|
||||
{
|
||||
qDebug() << "PSK31Baseband::handleMessage: MsgTx";
|
||||
m_source.addTXText(m_settings.m_text);
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (PSK31::MsgTXText::match(cmd))
|
||||
{
|
||||
PSK31::MsgTXText& tx = (PSK31::MsgTXText&) cmd;
|
||||
m_source.addTXText(tx.m_text);
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (DSPSignalNotification::match(cmd))
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
|
||||
qDebug() << "PSK31Baseband::handleMessage: DSPSignalNotification: basebandSampleRate: " << notif.getSampleRate();
|
||||
m_sampleFifo.resize(SampleSourceFifo::getSizePolicy(notif.getSampleRate()));
|
||||
m_channelizer->setBasebandSampleRate(notif.getSampleRate());
|
||||
m_source.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "PSK31Baseband - Baseband got unknown message";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31Baseband::applySettings(const PSK31Settings& settings, bool force)
|
||||
{
|
||||
if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force)
|
||||
{
|
||||
m_channelizer->setChannelization(m_channelizer->getChannelSampleRate(), settings.m_inputFrequencyOffset);
|
||||
m_source.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
}
|
||||
|
||||
m_source.applySettings(settings, force);
|
||||
|
||||
m_settings = settings;
|
||||
}
|
||||
|
||||
int PSK31Baseband::getChannelSampleRate() const
|
||||
{
|
||||
return m_channelizer->getChannelSampleRate();
|
||||
}
|
100
plugins/channeltx/modpsk31/psk31modbaseband.h
Normal file
100
plugins/channeltx/modpsk31/psk31modbaseband.h
Normal file
@ -0,0 +1,100 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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_PSK31MODBASEBAND_H
|
||||
#define INCLUDE_PSK31MODBASEBAND_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QRecursiveMutex>
|
||||
|
||||
#include "dsp/samplesourcefifo.h"
|
||||
#include "util/message.h"
|
||||
#include "util/messagequeue.h"
|
||||
|
||||
#include "psk31modsource.h"
|
||||
|
||||
class UpChannelizer;
|
||||
class ChannelAPI;
|
||||
|
||||
class PSK31Baseband : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
class MsgConfigurePSK31Baseband : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const PSK31Settings& getSettings() const { return m_settings; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigurePSK31Baseband* create(const PSK31Settings& settings, bool force)
|
||||
{
|
||||
return new MsgConfigurePSK31Baseband(settings, force);
|
||||
}
|
||||
|
||||
private:
|
||||
PSK31Settings m_settings;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigurePSK31Baseband(const PSK31Settings& settings, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
|
||||
PSK31Baseband();
|
||||
~PSK31Baseband();
|
||||
void reset();
|
||||
void pull(const SampleVector::iterator& begin, unsigned int nbSamples);
|
||||
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
|
||||
void setMessageQueueToGUI(MessageQueue* messageQueue) { m_source.setMessageQueueToGUI(messageQueue); }
|
||||
double getMagSq() const { return m_source.getMagSq(); }
|
||||
int getChannelSampleRate() const;
|
||||
void setSpectrumSampleSink(BasebandSampleSink* sampleSink) { m_source.setSpectrumSink(sampleSink); }
|
||||
void setChannel(ChannelAPI *channel);
|
||||
int getSourceChannelSampleRate() const { return m_source.getChannelSampleRate(); }
|
||||
|
||||
signals:
|
||||
/**
|
||||
* Level changed
|
||||
* \param rmsLevel RMS level in range 0.0 - 1.0
|
||||
* \param peakLevel Peak level in range 0.0 - 1.0
|
||||
* \param numSamples Number of audio samples analyzed
|
||||
*/
|
||||
void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples);
|
||||
|
||||
private:
|
||||
SampleSourceFifo m_sampleFifo;
|
||||
UpChannelizer *m_channelizer;
|
||||
PSK31Source m_source;
|
||||
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
|
||||
PSK31Settings m_settings;
|
||||
QRecursiveMutex m_mutex;
|
||||
|
||||
void processFifo(SampleVector& data, unsigned int iBegin, unsigned int iEnd);
|
||||
bool handleMessage(const Message& cmd);
|
||||
void applySettings(const PSK31Settings& settings, bool force = false);
|
||||
|
||||
private slots:
|
||||
void handleInputMessages();
|
||||
void handleData(); //!< Handle data when samples have to be processed
|
||||
};
|
||||
|
||||
|
||||
#endif // INCLUDE_PSK31MODBASEBAND_H
|
548
plugins/channeltx/modpsk31/psk31modgui.cpp
Normal file
548
plugins/channeltx/modpsk31/psk31modgui.cpp
Normal file
@ -0,0 +1,548 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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 <QDockWidget>
|
||||
#include <QMainWindow>
|
||||
#include <QFileDialog>
|
||||
#include <QTime>
|
||||
#include <QScrollBar>
|
||||
#include <QDebug>
|
||||
|
||||
#include "dsp/spectrumvis.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "device/deviceuiset.h"
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "util/db.h"
|
||||
#include "util/rtty.h"
|
||||
#include "util/maidenhead.h"
|
||||
#include "gui/glspectrum.h"
|
||||
#include "gui/crightclickenabler.h"
|
||||
#include "gui/basicchannelsettingsdialog.h"
|
||||
#include "gui/devicestreamselectiondialog.h"
|
||||
#include "gui/fmpreemphasisdialog.h"
|
||||
#include "gui/dialpopup.h"
|
||||
#include "gui/dialogpositioner.h"
|
||||
#include "maincore.h"
|
||||
|
||||
#include "ui_psk31modgui.h"
|
||||
#include "psk31modgui.h"
|
||||
#include "psk31modrepeatdialog.h"
|
||||
#include "psk31modtxsettingsdialog.h"
|
||||
|
||||
PSK31GUI* PSK31GUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx)
|
||||
{
|
||||
PSK31GUI* gui = new PSK31GUI(pluginAPI, deviceUISet, channelTx);
|
||||
return gui;
|
||||
}
|
||||
|
||||
void PSK31GUI::destroy()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
void PSK31GUI::resetToDefaults()
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
displaySettings();
|
||||
applySettings(true);
|
||||
}
|
||||
|
||||
QByteArray PSK31GUI::serialize() const
|
||||
{
|
||||
return m_settings.serialize();
|
||||
}
|
||||
|
||||
bool PSK31GUI::deserialize(const QByteArray& data)
|
||||
{
|
||||
if (m_settings.deserialize(data)) {
|
||||
displaySettings();
|
||||
applySettings(true);
|
||||
return true;
|
||||
} else {
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool PSK31GUI::handleMessage(const Message& message)
|
||||
{
|
||||
if (PSK31::MsgConfigurePSK31::match(message))
|
||||
{
|
||||
const PSK31::MsgConfigurePSK31& cfg = (PSK31::MsgConfigurePSK31&) message;
|
||||
m_settings = cfg.getSettings();
|
||||
blockApplySettings(true);
|
||||
m_channelMarker.updateSettings(static_cast<const ChannelMarker*>(m_settings.m_channelMarker));
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
return true;
|
||||
}
|
||||
else if (PSK31::MsgReportTx::match(message))
|
||||
{
|
||||
const PSK31::MsgReportTx& report = (PSK31::MsgReportTx&)message;
|
||||
QString s = report.getText();
|
||||
int bufferedCharacters = report.getBufferedCharacters();
|
||||
|
||||
// Turn TX button green when transmitting
|
||||
QString tooltip = m_initialToolTip;
|
||||
if (bufferedCharacters == 0)
|
||||
{
|
||||
ui->txButton->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->txButton->setStyleSheet("QToolButton { background-color : green; }");
|
||||
tooltip.append(QString("\n\n%1 characters in buffer").arg(bufferedCharacters));
|
||||
}
|
||||
ui->txButton->setToolTip(tooltip);
|
||||
|
||||
s = s.replace(">", ""); // Don't display LTRS
|
||||
s = s.replace("\r", ""); // Don't display carriage returns
|
||||
|
||||
if (!s.isEmpty())
|
||||
{
|
||||
// Is the scroll bar at the bottom?
|
||||
int scrollPos = ui->transmittedText->verticalScrollBar()->value();
|
||||
bool atBottom = scrollPos >= ui->transmittedText->verticalScrollBar()->maximum();
|
||||
|
||||
// Move cursor to end where we want to append new text
|
||||
// (user may have moved it by clicking / highlighting text)
|
||||
ui->transmittedText->moveCursor(QTextCursor::End);
|
||||
|
||||
// Restore scroll position
|
||||
ui->transmittedText->verticalScrollBar()->setValue(scrollPos);
|
||||
|
||||
// Insert text
|
||||
ui->transmittedText->insertPlainText(s);
|
||||
|
||||
// Scroll to bottom, if we we're previously at the bottom
|
||||
if (atBottom) {
|
||||
ui->transmittedText->verticalScrollBar()->setValue(ui->transmittedText->verticalScrollBar()->maximum());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (DSPSignalNotification::match(message))
|
||||
{
|
||||
const DSPSignalNotification& notif = (const DSPSignalNotification&) message;
|
||||
m_deviceCenterFrequency = notif.getCenterFrequency();
|
||||
m_basebandSampleRate = notif.getSampleRate();
|
||||
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();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31GUI::channelMarkerChangedByCursor()
|
||||
{
|
||||
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
||||
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PSK31GUI::handleSourceMessages()
|
||||
{
|
||||
Message* message;
|
||||
|
||||
while ((message = getInputMessageQueue()->pop()) != 0)
|
||||
{
|
||||
if (handleMessage(*message))
|
||||
{
|
||||
delete message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31GUI::on_deltaFrequency_changed(qint64 value)
|
||||
{
|
||||
m_channelMarker.setCenterFrequency(value);
|
||||
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
||||
updateAbsoluteCenterFrequency();
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PSK31GUI::on_rfBW_valueChanged(int value)
|
||||
{
|
||||
int bw = value;
|
||||
ui->rfBWText->setText(formatFrequency(bw));
|
||||
m_channelMarker.setBandwidth(bw);
|
||||
m_settings.m_rfBandwidth = bw;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PSK31GUI::on_clearTransmittedText_clicked()
|
||||
{
|
||||
ui->transmittedText->clear();
|
||||
}
|
||||
|
||||
void PSK31GUI::on_gain_valueChanged(int value)
|
||||
{
|
||||
ui->gainText->setText(QString("%1dB").arg(value));
|
||||
m_settings.m_gain = value;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PSK31GUI::on_channelMute_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_channelMute = checked;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PSK31GUI::on_txButton_clicked()
|
||||
{
|
||||
transmit(ui->text->currentText());
|
||||
}
|
||||
|
||||
void PSK31GUI::on_text_returnPressed()
|
||||
{
|
||||
transmit(ui->text->currentText());
|
||||
ui->text->setCurrentText("");
|
||||
}
|
||||
|
||||
void PSK31GUI::on_text_editingFinished()
|
||||
{
|
||||
m_settings.m_text = ui->text->currentText();
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PSK31GUI::on_repeat_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_repeat = checked;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PSK31GUI::repeatSelect(const QPoint& p)
|
||||
{
|
||||
PSK31RepeatDialog dialog(m_settings.m_repeatCount);
|
||||
dialog.move(p);
|
||||
new DialogPositioner(&dialog, false);
|
||||
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
m_settings.m_repeatCount = dialog.m_repeatCount;
|
||||
applySettings();
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31GUI::txSettingsSelect(const QPoint& p)
|
||||
{
|
||||
PSK31TXSettingsDialog dialog(&m_settings);
|
||||
dialog.move(p);
|
||||
new DialogPositioner(&dialog, false);
|
||||
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
displaySettings();
|
||||
applySettings();
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31GUI::on_udpEnabled_clicked(bool checked)
|
||||
{
|
||||
m_settings.m_udpEnabled = checked;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PSK31GUI::on_udpAddress_editingFinished()
|
||||
{
|
||||
m_settings.m_udpAddress = ui->udpAddress->text();
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PSK31GUI::on_udpPort_editingFinished()
|
||||
{
|
||||
m_settings.m_udpPort = ui->udpPort->text().toInt();
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PSK31GUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
||||
{
|
||||
(void) widget;
|
||||
(void) rollDown;
|
||||
|
||||
getRollupContents()->saveState(m_rollupState);
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void PSK31GUI::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);
|
||||
dialog.setDefaultTitle(m_displayedName);
|
||||
|
||||
if (m_deviceUISet->m_deviceMIMOEngine)
|
||||
{
|
||||
dialog.setNumberOfStreams(m_psk31Mod->getNumberOfDeviceStreams());
|
||||
dialog.setStreamIndex(m_settings.m_streamIndex);
|
||||
}
|
||||
|
||||
dialog.move(p);
|
||||
new DialogPositioner(&dialog, false);
|
||||
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);
|
||||
setTitle(m_channelMarker.getTitle());
|
||||
setTitleColor(m_settings.m_rgbColor);
|
||||
|
||||
if (m_deviceUISet->m_deviceMIMOEngine)
|
||||
{
|
||||
m_settings.m_streamIndex = dialog.getSelectedStreamIndex();
|
||||
m_channelMarker.clearStreamIndexes();
|
||||
m_channelMarker.addStreamIndex(m_settings.m_streamIndex);
|
||||
updateIndexLabel();
|
||||
}
|
||||
|
||||
applySettings();
|
||||
}
|
||||
|
||||
resetContextMenuType();
|
||||
}
|
||||
|
||||
PSK31GUI::PSK31GUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent) :
|
||||
ChannelGUI(parent),
|
||||
ui(new Ui::PSK31GUI),
|
||||
m_pluginAPI(pluginAPI),
|
||||
m_deviceUISet(deviceUISet),
|
||||
m_channelMarker(this),
|
||||
m_deviceCenterFrequency(0),
|
||||
m_basebandSampleRate(1),
|
||||
m_doApplySettings(true)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
m_helpURL = "plugins/channeltx/modpsk31/readme.md";
|
||||
RollupContents *rollupContents = getRollupContents();
|
||||
ui->setupUi(rollupContents);
|
||||
setSizePolicy(rollupContents->sizePolicy());
|
||||
rollupContents->arrangeRollups();
|
||||
connect(rollupContents, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
||||
|
||||
m_psk31Mod = (PSK31*) channelTx;
|
||||
m_psk31Mod->setMessageQueueToGUI(getInputMessageQueue());
|
||||
|
||||
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
||||
|
||||
m_spectrumVis = m_psk31Mod->getSpectrumVis();
|
||||
m_spectrumVis->setGLSpectrum(ui->glSpectrum);
|
||||
|
||||
ui->spectrumGUI->setBuddies(m_spectrumVis, ui->glSpectrum);
|
||||
|
||||
ui->glSpectrum->setCenterFrequency(0);
|
||||
ui->glSpectrum->setSampleRate(2000);
|
||||
ui->glSpectrum->setLsbDisplay(false);
|
||||
|
||||
SpectrumSettings spectrumSettings = m_spectrumVis->getSettings();
|
||||
spectrumSettings.m_ssb = false;
|
||||
spectrumSettings.m_displayCurrent = true;
|
||||
spectrumSettings.m_displayWaterfall = false;
|
||||
spectrumSettings.m_displayMaxHold = false;
|
||||
spectrumSettings.m_displayHistogram = false;
|
||||
SpectrumVis::MsgConfigureSpectrumVis *msg = SpectrumVis::MsgConfigureSpectrumVis::create(spectrumSettings, false);
|
||||
m_spectrumVis->getInputMessageQueue()->push(msg);
|
||||
|
||||
CRightClickEnabler *repeatRightClickEnabler = new CRightClickEnabler(ui->repeat);
|
||||
connect(repeatRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(repeatSelect(const QPoint &)));
|
||||
|
||||
CRightClickEnabler *txRightClickEnabler = new CRightClickEnabler(ui->txButton);
|
||||
connect(txRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(txSettingsSelect(const QPoint &)));
|
||||
|
||||
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
|
||||
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
|
||||
|
||||
m_channelMarker.blockSignals(true);
|
||||
m_channelMarker.setColor(Qt::red);
|
||||
m_channelMarker.setBandwidth(12500);
|
||||
m_channelMarker.setCenterFrequency(0);
|
||||
m_channelMarker.setTitle("PSK31 Modulator");
|
||||
m_channelMarker.setSourceOrSinkStream(false);
|
||||
m_channelMarker.blockSignals(false);
|
||||
m_channelMarker.setVisible(true); // activate signal on the last setting only
|
||||
|
||||
m_deviceUISet->addChannelMarker(&m_channelMarker);
|
||||
|
||||
connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
|
||||
|
||||
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
||||
m_psk31Mod->setLevelMeter(ui->volumeMeter);
|
||||
|
||||
m_settings.setChannelMarker(&m_channelMarker);
|
||||
m_settings.setRollupState(&m_rollupState);
|
||||
|
||||
ui->transmittedText->addAcronyms(Rtty::m_acronyms);
|
||||
|
||||
ui->spectrumContainer->setVisible(false);
|
||||
|
||||
displaySettings();
|
||||
makeUIConnections();
|
||||
applySettings();
|
||||
DialPopup::addPopupsToChildDials(this);
|
||||
|
||||
m_initialToolTip = ui->txButton->toolTip();
|
||||
}
|
||||
|
||||
PSK31GUI::~PSK31GUI()
|
||||
{
|
||||
// If we don't disconnect, we can get this signal after this has been deleted!
|
||||
QObject::disconnect(ui->text->lineEdit(), &QLineEdit::editingFinished, this, &PSK31GUI::on_text_editingFinished);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PSK31GUI::transmit(const QString& text)
|
||||
{
|
||||
PSK31::MsgTXText*msg = PSK31::MsgTXText::create(text);
|
||||
m_psk31Mod->getInputMessageQueue()->push(msg);
|
||||
}
|
||||
|
||||
void PSK31GUI::blockApplySettings(bool block)
|
||||
{
|
||||
m_doApplySettings = !block;
|
||||
}
|
||||
|
||||
void PSK31GUI::applySettings(bool force)
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
PSK31::MsgConfigurePSK31 *msg = PSK31::MsgConfigurePSK31::create(m_settings, force);
|
||||
m_psk31Mod->getInputMessageQueue()->push(msg);
|
||||
}
|
||||
}
|
||||
|
||||
QString PSK31GUI::formatFrequency(int frequency) const
|
||||
{
|
||||
QString suffix = "";
|
||||
if (width() > 450) {
|
||||
suffix = " Hz";
|
||||
}
|
||||
return QString("%1%2").arg(frequency).arg(suffix);
|
||||
}
|
||||
|
||||
QString PSK31GUI::substitute(const QString& text)
|
||||
{
|
||||
const MainSettings& mainSettings = MainCore::instance()->getSettings();
|
||||
QString location = Maidenhead::toMaidenhead(mainSettings.getLatitude(), mainSettings.getLongitude());
|
||||
QString s = text;
|
||||
|
||||
s = s.replace("${callsign}", mainSettings.getStationName().toUpper());
|
||||
s = s.replace("${location}", location);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void PSK31GUI::displaySettings()
|
||||
{
|
||||
m_channelMarker.blockSignals(true);
|
||||
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
|
||||
m_channelMarker.setTitle(m_settings.m_title);
|
||||
m_channelMarker.setBandwidth(m_settings.m_rfBandwidth);
|
||||
m_channelMarker.blockSignals(false);
|
||||
m_channelMarker.setColor(m_settings.m_rgbColor); // activate signal on the last setting only
|
||||
|
||||
setTitleColor(m_settings.m_rgbColor);
|
||||
setWindowTitle(m_channelMarker.getTitle());
|
||||
setTitle(m_channelMarker.getTitle());
|
||||
updateIndexLabel();
|
||||
|
||||
blockApplySettings(true);
|
||||
|
||||
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
||||
|
||||
ui->rfBWText->setText(formatFrequency(m_settings.m_rfBandwidth));
|
||||
ui->rfBW->setValue(m_settings.m_rfBandwidth);
|
||||
|
||||
ui->udpEnabled->setChecked(m_settings.m_udpEnabled);
|
||||
ui->udpAddress->setText(m_settings.m_udpAddress);
|
||||
ui->udpPort->setText(QString::number(m_settings.m_udpPort));
|
||||
|
||||
ui->gainText->setText(QString("%1").arg((double)m_settings.m_gain, 0, 'f', 1));
|
||||
ui->gain->setValue(m_settings.m_gain);
|
||||
|
||||
ui->channelMute->setChecked(m_settings.m_channelMute);
|
||||
ui->repeat->setChecked(m_settings.m_repeat);
|
||||
|
||||
ui->text->clear();
|
||||
for (const auto& text : m_settings.m_predefinedTexts) {
|
||||
ui->text->addItem(substitute(text));
|
||||
}
|
||||
ui->text->setCurrentText(m_settings.m_text);
|
||||
|
||||
getRollupContents()->restoreState(m_rollupState);
|
||||
updateAbsoluteCenterFrequency();
|
||||
blockApplySettings(false);
|
||||
}
|
||||
|
||||
void PSK31GUI::leaveEvent(QEvent* event)
|
||||
{
|
||||
m_channelMarker.setHighlighted(false);
|
||||
ChannelGUI::leaveEvent(event);
|
||||
}
|
||||
|
||||
void PSK31GUI::enterEvent(EnterEventType* event)
|
||||
{
|
||||
m_channelMarker.setHighlighted(true);
|
||||
ChannelGUI::enterEvent(event);
|
||||
}
|
||||
|
||||
void PSK31GUI::tick()
|
||||
{
|
||||
double powDb = CalcDb::dbPower(m_psk31Mod->getMagSq());
|
||||
m_channelPowerDbAvg(powDb);
|
||||
ui->channelPower->setText(tr("%1 dB").arg(m_channelPowerDbAvg.asDouble(), 0, 'f', 1));
|
||||
}
|
||||
|
||||
void PSK31GUI::makeUIConnections()
|
||||
{
|
||||
QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &PSK31GUI::on_deltaFrequency_changed);
|
||||
QObject::connect(ui->rfBW, &QSlider::valueChanged, this, &PSK31GUI::on_rfBW_valueChanged);
|
||||
QObject::connect(ui->clearTransmittedText, &QToolButton::clicked, this, &PSK31GUI::on_clearTransmittedText_clicked);
|
||||
QObject::connect(ui->gain, &QDial::valueChanged, this, &PSK31GUI::on_gain_valueChanged);
|
||||
QObject::connect(ui->channelMute, &QToolButton::toggled, this, &PSK31GUI::on_channelMute_toggled);
|
||||
QObject::connect(ui->txButton, &QToolButton::clicked, this, &PSK31GUI::on_txButton_clicked);
|
||||
QObject::connect(ui->text->lineEdit(), &QLineEdit::editingFinished, this, &PSK31GUI::on_text_editingFinished);
|
||||
QObject::connect(ui->text->lineEdit(), &QLineEdit::returnPressed, this, &PSK31GUI::on_text_returnPressed);
|
||||
QObject::connect(ui->repeat, &ButtonSwitch::toggled, this, &PSK31GUI::on_repeat_toggled);
|
||||
QObject::connect(ui->udpEnabled, &QCheckBox::clicked, this, &PSK31GUI::on_udpEnabled_clicked);
|
||||
QObject::connect(ui->udpAddress, &QLineEdit::editingFinished, this, &PSK31GUI::on_udpAddress_editingFinished);
|
||||
QObject::connect(ui->udpPort, &QLineEdit::editingFinished, this, &PSK31GUI::on_udpPort_editingFinished);
|
||||
}
|
||||
|
||||
void PSK31GUI::updateAbsoluteCenterFrequency()
|
||||
{
|
||||
setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset);
|
||||
}
|
124
plugins/channeltx/modpsk31/psk31modgui.h
Normal file
124
plugins/channeltx/modpsk31/psk31modgui.h
Normal file
@ -0,0 +1,124 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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 PLUGINS_CHANNELTX_MODPSK31_PSK31MODGUI_H_
|
||||
#define PLUGINS_CHANNELTX_MODPSK31_PSK31MODGUI_H_
|
||||
|
||||
#include "channel/channelgui.h"
|
||||
#include "dsp/channelmarker.h"
|
||||
#include "util/movingaverage.h"
|
||||
#include "util/messagequeue.h"
|
||||
#include "settings/rollupstate.h"
|
||||
|
||||
#include "psk31mod.h"
|
||||
#include "psk31modsettings.h"
|
||||
|
||||
class PluginAPI;
|
||||
class DeviceUISet;
|
||||
class BasebandSampleSource;
|
||||
class SpectrumVis;
|
||||
|
||||
namespace Ui {
|
||||
class PSK31GUI;
|
||||
}
|
||||
|
||||
class PSK31GUI : public ChannelGUI {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static PSK31GUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx);
|
||||
virtual void destroy();
|
||||
|
||||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
||||
virtual void setWorkspaceIndex(int index) { m_settings.m_workspaceIndex = index; };
|
||||
virtual int getWorkspaceIndex() const { return m_settings.m_workspaceIndex; };
|
||||
virtual void setGeometryBytes(const QByteArray& blob) { m_settings.m_geometryBytes = blob; };
|
||||
virtual QByteArray getGeometryBytes() const { return m_settings.m_geometryBytes; };
|
||||
virtual QString getTitle() const { return m_settings.m_title; };
|
||||
virtual QColor getTitleColor() const { return m_settings.m_rgbColor; };
|
||||
virtual void zetHidden(bool hidden) { m_settings.m_hidden = hidden; }
|
||||
virtual bool getHidden() const { return m_settings.m_hidden; }
|
||||
virtual ChannelMarker& getChannelMarker() { return m_channelMarker; }
|
||||
virtual int getStreamIndex() const { return m_settings.m_streamIndex; }
|
||||
virtual void setStreamIndex(int streamIndex) { m_settings.m_streamIndex = streamIndex; }
|
||||
|
||||
public slots:
|
||||
void channelMarkerChangedByCursor();
|
||||
|
||||
private:
|
||||
Ui::PSK31GUI* ui;
|
||||
PluginAPI* m_pluginAPI;
|
||||
DeviceUISet* m_deviceUISet;
|
||||
ChannelMarker m_channelMarker;
|
||||
RollupState m_rollupState;
|
||||
PSK31Settings m_settings;
|
||||
qint64 m_deviceCenterFrequency;
|
||||
int m_basebandSampleRate;
|
||||
bool m_doApplySettings;
|
||||
SpectrumVis* m_spectrumVis;
|
||||
QString m_initialToolTip;
|
||||
|
||||
PSK31* m_psk31Mod;
|
||||
MovingAverageUtil<double, double, 2> m_channelPowerDbAvg; // Less than other mods, as packets are short
|
||||
|
||||
MessageQueue m_inputMessageQueue;
|
||||
|
||||
explicit PSK31GUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = 0);
|
||||
virtual ~PSK31GUI();
|
||||
|
||||
void transmit(const QString& str);
|
||||
void blockApplySettings(bool block);
|
||||
void applySettings(bool force = false);
|
||||
void displaySettings();
|
||||
QString formatFrequency(int frequency) const;
|
||||
bool handleMessage(const Message& message);
|
||||
void makeUIConnections();
|
||||
void updateAbsoluteCenterFrequency();
|
||||
QString substitute(const QString& text);
|
||||
|
||||
void leaveEvent(QEvent*);
|
||||
void enterEvent(EnterEventType*);
|
||||
|
||||
private slots:
|
||||
void handleSourceMessages();
|
||||
|
||||
void on_deltaFrequency_changed(qint64 value);
|
||||
void on_rfBW_valueChanged(int index);
|
||||
void on_gain_valueChanged(int value);
|
||||
void on_channelMute_toggled(bool checked);
|
||||
void on_clearTransmittedText_clicked();
|
||||
void on_txButton_clicked();
|
||||
void on_text_editingFinished();
|
||||
void on_text_returnPressed();
|
||||
void on_repeat_toggled(bool checked);
|
||||
void repeatSelect(const QPoint& p);
|
||||
void txSettingsSelect(const QPoint& p);
|
||||
void on_udpEnabled_clicked(bool checked);
|
||||
void on_udpAddress_editingFinished();
|
||||
void on_udpPort_editingFinished();
|
||||
|
||||
void onWidgetRolled(QWidget* widget, bool rollDown);
|
||||
void onMenuDialogCalled(const QPoint& p);
|
||||
|
||||
void tick();
|
||||
};
|
||||
|
||||
#endif /* PLUGINS_CHANNELTX_MODPSK31_PSK31MODGUI_H_ */
|
667
plugins/channeltx/modpsk31/psk31modgui.ui
Normal file
667
plugins/channeltx/modpsk31/psk31modgui.ui
Normal file
@ -0,0 +1,667 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PSK31GUI</class>
|
||||
<widget class="RollupContents" name="PSK31GUI">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>396</width>
|
||||
<height>702</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>390</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Sans</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>PSK31 Modulator</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="settingsContainer" native="true">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>2</x>
|
||||
<y>2</y>
|
||||
<width>391</width>
|
||||
<height>211</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>280</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="settingsLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="deltaFreqPowLayout">
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="deltaFrequencyLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="deltaFrequencyLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Df</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ValueDialZ" name="deltaFrequency" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Mono</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Demod shift frequency from center in Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="deltaUnits">
|
||||
<property name="text">
|
||||
<string>Hz </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="channelPower">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Channel power</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-100.0 dB</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="channelMute">
|
||||
<property name="toolTip">
|
||||
<string>Mute/Unmute channel</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrgui/resources/res.qrc">
|
||||
<normaloff>:/txon.png</normaloff>
|
||||
<normalon>:/txoff.png</normalon>:/txon.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="rfBandwidthLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="rfBWLabel">
|
||||
<property name="text">
|
||||
<string>BW</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="rfBW">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>RF bandwidth</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>340</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="rfBWText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>1700</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="volumeLayout">
|
||||
<item>
|
||||
<widget class="QDial" name="gain">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Gain</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-60</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="gainLabel">
|
||||
<property name="text">
|
||||
<string>Gain</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="gainText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Audio input gain value</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-80.0dB</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="LevelMeterVU" name="volumeMeter" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Mono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Level (% full range) top trace: average, bottom trace: instantaneous peak, tip: peak hold</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="udpLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="udpEnabled">
|
||||
<property name="toolTip">
|
||||
<string>Forward text received via UDP</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>UDP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="udpAddress">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>UDP address to listen for text to forward on</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>000.000.000.000</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>127.0.0.1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="udpSeparator">
|
||||
<property name="text">
|
||||
<string>:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="udpPort">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>UDP port to listen for text to forward on</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>00000</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>9997</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="callsignLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacerSettings">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="repeat">
|
||||
<property name="toolTip">
|
||||
<string>Repeatedly transmit the text. Right click for additional settings.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrgui/resources/res.qrc">
|
||||
<normaloff>:/playloop.png</normaloff>:/playloop.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="clearTransmittedText">
|
||||
<property name="toolTip">
|
||||
<string>Clear transmitted text</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrgui/resources/res.qrc">
|
||||
<normaloff>:/bin.png</normaloff>:/bin.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="packetDataLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="text">
|
||||
<property name="toolTip">
|
||||
<string>Text to send</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="txButton">
|
||||
<property name="toolTip">
|
||||
<string>Press to transmit the text. Right click for additional settings.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TX</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="logContainer" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>220</y>
|
||||
<width>391</width>
|
||||
<height>141</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Transmitted Text</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="transmittedLayout">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="AcronymView" name="transmittedText"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="spectrumContainer" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>370</y>
|
||||
<width>381</width>
|
||||
<height>284</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Baseband Spectrum</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="spectrumLayout">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="GLSpectrum" name="glSpectrum" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Mono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="GLSpectrumGUI" name="spectrumGUI" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>RollupContents</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/rollupcontents.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>GLSpectrum</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/glspectrum.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>GLSpectrumGUI</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/glspectrumgui.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ValueDialZ</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/valuedialz.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ButtonSwitch</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LevelMeterVU</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/levelmeter.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AcronymView</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>gui/acronymview.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>deltaFrequency</tabstop>
|
||||
<tabstop>channelMute</tabstop>
|
||||
<tabstop>rfBW</tabstop>
|
||||
<tabstop>txButton</tabstop>
|
||||
<tabstop>transmittedText</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../../sdrgui/resources/res.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
92
plugins/channeltx/modpsk31/psk31modplugin.cpp
Normal file
92
plugins/channeltx/modpsk31/psk31modplugin.cpp
Normal file
@ -0,0 +1,92 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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 <QtPlugin>
|
||||
#include "plugin/pluginapi.h"
|
||||
|
||||
#ifndef SERVER_MODE
|
||||
#include "psk31modgui.h"
|
||||
#endif
|
||||
#include "psk31mod.h"
|
||||
#include "psk31modwebapiadapter.h"
|
||||
#include "psk31modplugin.h"
|
||||
|
||||
const PluginDescriptor PSK31Plugin::m_pluginDescriptor = {
|
||||
PSK31::m_channelId,
|
||||
QStringLiteral("PSK31 Modulator"),
|
||||
QStringLiteral("7.16.0"),
|
||||
QStringLiteral("(c) Jon Beniston, M7RCE"),
|
||||
QStringLiteral("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
QStringLiteral("https://github.com/f4exb/sdrangel")
|
||||
};
|
||||
|
||||
PSK31Plugin::PSK31Plugin(QObject* parent) :
|
||||
QObject(parent),
|
||||
m_pluginAPI(0)
|
||||
{
|
||||
}
|
||||
|
||||
const PluginDescriptor& PSK31Plugin::getPluginDescriptor() const
|
||||
{
|
||||
return m_pluginDescriptor;
|
||||
}
|
||||
|
||||
void PSK31Plugin::initPlugin(PluginAPI* pluginAPI)
|
||||
{
|
||||
m_pluginAPI = pluginAPI;
|
||||
|
||||
m_pluginAPI->registerTxChannel(PSK31::m_channelIdURI, PSK31::m_channelId, this);
|
||||
}
|
||||
|
||||
void PSK31Plugin::createTxChannel(DeviceAPI *deviceAPI, BasebandSampleSource **bs, ChannelAPI **cs) const
|
||||
{
|
||||
if (bs || cs)
|
||||
{
|
||||
PSK31 *instance = new PSK31(deviceAPI);
|
||||
|
||||
if (bs) {
|
||||
*bs = instance;
|
||||
}
|
||||
|
||||
if (cs) {
|
||||
*cs = instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SERVER_MODE
|
||||
ChannelGUI* PSK31Plugin::createTxChannelGUI(
|
||||
DeviceUISet *deviceUISet,
|
||||
BasebandSampleSource *txChannel) const
|
||||
{
|
||||
(void) deviceUISet;
|
||||
(void) txChannel;
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
ChannelGUI* PSK31Plugin::createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) const
|
||||
{
|
||||
return PSK31GUI::create(m_pluginAPI, deviceUISet, txChannel);
|
||||
}
|
||||
#endif
|
||||
|
||||
ChannelWebAPIAdapter* PSK31Plugin::createChannelWebAPIAdapter() const
|
||||
{
|
||||
return new PSK31WebAPIAdapter();
|
||||
}
|
49
plugins/channeltx/modpsk31/psk31modplugin.h
Normal file
49
plugins/channeltx/modpsk31/psk31modplugin.h
Normal file
@ -0,0 +1,49 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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_PSK31MODPLUGIN_H
|
||||
#define INCLUDE_PSK31MODPLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#include "plugin/plugininterface.h"
|
||||
|
||||
class DeviceUISet;
|
||||
class BasebandSampleSource;
|
||||
|
||||
class PSK31Plugin : public QObject, PluginInterface {
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(PluginInterface)
|
||||
Q_PLUGIN_METADATA(IID "sdrangel.channeltx.psk31mod")
|
||||
|
||||
public:
|
||||
explicit PSK31Plugin(QObject* parent = 0);
|
||||
|
||||
const PluginDescriptor& getPluginDescriptor() const;
|
||||
void initPlugin(PluginAPI* pluginAPI);
|
||||
|
||||
virtual void createTxChannel(DeviceAPI *deviceAPI, BasebandSampleSource **bs, ChannelAPI **cs) const;
|
||||
virtual ChannelGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *rxChannel) const;
|
||||
virtual ChannelWebAPIAdapter* createChannelWebAPIAdapter() const;
|
||||
|
||||
private:
|
||||
static const PluginDescriptor m_pluginDescriptor;
|
||||
|
||||
PluginAPI* m_pluginAPI;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_PSK31MODPLUGIN_H
|
43
plugins/channeltx/modpsk31/psk31modrepeatdialog.cpp
Normal file
43
plugins/channeltx/modpsk31/psk31modrepeatdialog.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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 "psk31modrepeatdialog.h"
|
||||
#include "psk31modsettings.h"
|
||||
#include <QLineEdit>
|
||||
|
||||
PSK31RepeatDialog::PSK31RepeatDialog(int repeatCount, QWidget* parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::PSK31RepeatDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QLineEdit *edit = ui->repeatCount->lineEdit();
|
||||
if (edit) {
|
||||
edit->setText(QString("%1").arg(repeatCount));
|
||||
}
|
||||
}
|
||||
|
||||
PSK31RepeatDialog::~PSK31RepeatDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PSK31RepeatDialog::accept()
|
||||
{
|
||||
QString text = ui->repeatCount->currentText();
|
||||
m_repeatCount = text.toUInt();
|
||||
QDialog::accept();
|
||||
}
|
39
plugins/channeltx/modpsk31/psk31modrepeatdialog.h
Normal file
39
plugins/channeltx/modpsk31/psk31modrepeatdialog.h
Normal file
@ -0,0 +1,39 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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_PSK31MODREPEATDIALOG_H
|
||||
#define INCLUDE_PSK31MODREPEATDIALOG_H
|
||||
|
||||
#include "ui_psk31modrepeatdialog.h"
|
||||
|
||||
class PSK31RepeatDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PSK31RepeatDialog(int repeatCount, QWidget* parent = 0);
|
||||
~PSK31RepeatDialog();
|
||||
|
||||
int m_repeatCount; // Number of times to transmit
|
||||
|
||||
private slots:
|
||||
void accept();
|
||||
|
||||
private:
|
||||
Ui::PSK31RepeatDialog* ui;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_PSK31MODREPEATDIALOG_H
|
116
plugins/channeltx/modpsk31/psk31modrepeatdialog.ui
Normal file
116
plugins/channeltx/modpsk31/psk31modrepeatdialog.ui
Normal file
@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PSK31RepeatDialog</class>
|
||||
<widget class="QDialog" name="PSK31RepeatDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>351</width>
|
||||
<height>91</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Sans</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Packet Repeat Settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="repeatCountLabel">
|
||||
<property name="text">
|
||||
<string>Times to transmit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="repeatCount">
|
||||
<property name="toolTip">
|
||||
<string>Number of times to transmit</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>10</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>100</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1000</string>
|
||||
</property>
|
||||
</item>
|
||||
</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>
|
||||
<tabstops>
|
||||
<tabstop>repeatCount</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>PSK31RepeatDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>PSK31RepeatDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
210
plugins/channeltx/modpsk31/psk31modsettings.cpp
Normal file
210
plugins/channeltx/modpsk31/psk31modsettings.cpp
Normal file
@ -0,0 +1,210 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017 Edouard Griffiths, F4EXB //
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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 <QColor>
|
||||
#include <QDebug>
|
||||
|
||||
#include "dsp/dspengine.h"
|
||||
#include "util/baudot.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "settings/serializable.h"
|
||||
#include "psk31modsettings.h"
|
||||
|
||||
PSK31Settings::PSK31Settings() :
|
||||
m_channelMarker(nullptr),
|
||||
m_rollupState(nullptr)
|
||||
{
|
||||
resetToDefaults();
|
||||
}
|
||||
|
||||
void PSK31Settings::resetToDefaults()
|
||||
{
|
||||
m_inputFrequencyOffset = 0;
|
||||
m_baud = 31.25;
|
||||
m_rfBandwidth = 340;
|
||||
m_gain = 0.0f;
|
||||
m_channelMute = false;
|
||||
m_repeat = false;
|
||||
m_repeatCount = 10;
|
||||
m_lpfTaps = 301;
|
||||
m_rfNoise = false;
|
||||
m_text = "CQ CQ CQ DE SDRangel CQ";
|
||||
m_prefixCRLF = true;
|
||||
m_postfixCRLF = true;
|
||||
m_predefinedTexts = QStringList({
|
||||
"CQ CQ CQ DE ${callsign} ${callsign} CQ",
|
||||
"DE ${callsign} ${callsign} ${callsign}",
|
||||
"UR 599 QTH IS ${location}",
|
||||
"TU DE ${callsign} CQ"
|
||||
});
|
||||
m_rgbColor = QColor(180, 205, 130).rgb();
|
||||
m_title = "PSK31 Modulator";
|
||||
m_streamIndex = 0;
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
m_reverseAPIPort = 8888;
|
||||
m_reverseAPIDeviceIndex = 0;
|
||||
m_reverseAPIChannelIndex = 0;
|
||||
m_pulseShaping = true;
|
||||
m_beta = 1.0f;
|
||||
m_symbolSpan = 2;
|
||||
m_udpEnabled = false;
|
||||
m_udpAddress = "127.0.0.1";
|
||||
m_udpPort = 9998;
|
||||
m_workspaceIndex = 0;
|
||||
m_hidden = false;
|
||||
}
|
||||
|
||||
QByteArray PSK31Settings::serialize() const
|
||||
{
|
||||
SimpleSerializer s(1);
|
||||
|
||||
s.writeS32(1, m_inputFrequencyOffset);
|
||||
s.writeReal(2, m_baud);
|
||||
s.writeS32(3, m_rfBandwidth);
|
||||
s.writeReal(5, m_gain);
|
||||
s.writeBool(6, m_channelMute);
|
||||
s.writeBool(7, m_repeat);
|
||||
s.writeS32(9, m_repeatCount);
|
||||
s.writeS32(23, m_lpfTaps);
|
||||
s.writeBool(25, m_rfNoise);
|
||||
s.writeString(30, m_text);
|
||||
|
||||
s.writeBool(64, m_prefixCRLF);
|
||||
s.writeBool(65, m_postfixCRLF);
|
||||
s.writeList(66, m_predefinedTexts);
|
||||
|
||||
s.writeU32(31, m_rgbColor);
|
||||
s.writeString(32, m_title);
|
||||
|
||||
if (m_channelMarker) {
|
||||
s.writeBlob(33, m_channelMarker->serialize());
|
||||
}
|
||||
|
||||
s.writeS32(34, m_streamIndex);
|
||||
s.writeBool(35, m_useReverseAPI);
|
||||
s.writeString(36, m_reverseAPIAddress);
|
||||
s.writeU32(37, m_reverseAPIPort);
|
||||
s.writeU32(38, m_reverseAPIDeviceIndex);
|
||||
s.writeU32(39, m_reverseAPIChannelIndex);
|
||||
s.writeBool(46, m_pulseShaping);
|
||||
s.writeReal(47, m_beta);
|
||||
s.writeS32(48, m_symbolSpan);
|
||||
s.writeBool(51, m_udpEnabled);
|
||||
s.writeString(52, m_udpAddress);
|
||||
s.writeU32(53, m_udpPort);
|
||||
|
||||
if (m_rollupState) {
|
||||
s.writeBlob(54, m_rollupState->serialize());
|
||||
}
|
||||
|
||||
s.writeS32(55, m_workspaceIndex);
|
||||
s.writeBlob(56, m_geometryBytes);
|
||||
s.writeBool(57, m_hidden);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
|
||||
bool PSK31Settings::deserialize(const QByteArray& data)
|
||||
{
|
||||
SimpleDeserializer d(data);
|
||||
|
||||
if(!d.isValid())
|
||||
{
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(d.getVersion() == 1)
|
||||
{
|
||||
QByteArray bytetmp;
|
||||
qint32 tmp;
|
||||
uint32_t utmp;
|
||||
|
||||
d.readS32(1, &tmp, 0);
|
||||
m_inputFrequencyOffset = tmp;
|
||||
d.readReal(2, &m_baud, 31.25f);
|
||||
d.readS32(3, &m_rfBandwidth, 340);
|
||||
d.readReal(5, &m_gain, 0.0f);
|
||||
d.readBool(6, &m_channelMute, false);
|
||||
d.readBool(7, &m_repeat, false);
|
||||
d.readS32(9, &m_repeatCount, -1);
|
||||
d.readS32(23, &m_lpfTaps, 301);
|
||||
d.readBool(25, &m_rfNoise, false);
|
||||
d.readString(30, &m_text, "CQ CQ CQ anyone using SDRangel");
|
||||
|
||||
d.readBool(64, &m_prefixCRLF, true);
|
||||
d.readBool(65, &m_postfixCRLF, true);
|
||||
d.readList(66, &m_predefinedTexts);
|
||||
|
||||
d.readU32(31, &m_rgbColor);
|
||||
d.readString(32, &m_title, "PSK31 Modulator");
|
||||
|
||||
if (m_channelMarker)
|
||||
{
|
||||
d.readBlob(33, &bytetmp);
|
||||
m_channelMarker->deserialize(bytetmp);
|
||||
}
|
||||
|
||||
d.readS32(34, &m_streamIndex, 0);
|
||||
d.readBool(35, &m_useReverseAPI, false);
|
||||
d.readString(36, &m_reverseAPIAddress, "127.0.0.1");
|
||||
d.readU32(37, &utmp, 0);
|
||||
|
||||
if ((utmp > 1023) && (utmp < 65535)) {
|
||||
m_reverseAPIPort = utmp;
|
||||
} else {
|
||||
m_reverseAPIPort = 8888;
|
||||
}
|
||||
|
||||
d.readU32(38, &utmp, 0);
|
||||
m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp;
|
||||
d.readU32(39, &utmp, 0);
|
||||
m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp;
|
||||
d.readBool(46, &m_pulseShaping, true);
|
||||
d.readReal(47, &m_beta, 1.0f);
|
||||
d.readS32(48, &m_symbolSpan, 2);
|
||||
d.readBool(51, &m_udpEnabled);
|
||||
d.readString(52, &m_udpAddress, "127.0.0.1");
|
||||
d.readU32(53, &utmp);
|
||||
|
||||
if ((utmp > 1023) && (utmp < 65535)) {
|
||||
m_udpPort = utmp;
|
||||
} else {
|
||||
m_udpPort = 9998;
|
||||
}
|
||||
|
||||
if (m_rollupState)
|
||||
{
|
||||
d.readBlob(54, &bytetmp);
|
||||
m_rollupState->deserialize(bytetmp);
|
||||
}
|
||||
|
||||
d.readS32(55, &m_workspaceIndex, 0);
|
||||
d.readBlob(56, &m_geometryBytes);
|
||||
d.readBool(57, &m_hidden, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "PSK31Settings::deserialize: ERROR";
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
}
|
73
plugins/channeltx/modpsk31/psk31modsettings.h
Normal file
73
plugins/channeltx/modpsk31/psk31modsettings.h
Normal file
@ -0,0 +1,73 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017 Edouard Griffiths, F4EXB //
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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 PLUGINS_CHANNELTX_MODPSK31_PSK31MODSETTINGS_H
|
||||
#define PLUGINS_CHANNELTX_MODPSK31_PSK31MODSETTINGS_H
|
||||
|
||||
#include <QByteArray>
|
||||
#include <stdint.h>
|
||||
#include "dsp/dsptypes.h"
|
||||
#include "util/baudot.h"
|
||||
|
||||
class Serializable;
|
||||
|
||||
struct PSK31Settings
|
||||
{
|
||||
qint64 m_inputFrequencyOffset;
|
||||
float m_baud;
|
||||
int m_rfBandwidth;
|
||||
Real m_gain;
|
||||
bool m_channelMute;
|
||||
bool m_repeat;
|
||||
int m_repeatCount;
|
||||
int m_lpfTaps;
|
||||
bool m_rfNoise;
|
||||
QString m_text; // Text to send
|
||||
bool m_pulseShaping;
|
||||
float m_beta;
|
||||
int m_symbolSpan;
|
||||
bool m_prefixCRLF;
|
||||
bool m_postfixCRLF;
|
||||
QStringList m_predefinedTexts;
|
||||
|
||||
quint32 m_rgbColor;
|
||||
QString m_title;
|
||||
Serializable *m_channelMarker;
|
||||
int m_streamIndex;
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
uint16_t m_reverseAPIPort;
|
||||
uint16_t m_reverseAPIDeviceIndex;
|
||||
uint16_t m_reverseAPIChannelIndex;
|
||||
bool m_udpEnabled;
|
||||
QString m_udpAddress;
|
||||
uint16_t m_udpPort;
|
||||
Serializable *m_rollupState;
|
||||
int m_workspaceIndex;
|
||||
QByteArray m_geometryBytes;
|
||||
bool m_hidden;
|
||||
|
||||
PSK31Settings();
|
||||
void resetToDefaults();
|
||||
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
|
||||
void setRollupState(Serializable *rollupState) { m_rollupState = rollupState; }
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
};
|
||||
|
||||
#endif /* PLUGINS_CHANNELTX_MODPSK31_PSK31MODSETTINGS_H */
|
434
plugins/channeltx/modpsk31/psk31modsource.cpp
Normal file
434
plugins/channeltx/modpsk31/psk31modsource.cpp
Normal file
@ -0,0 +1,434 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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 <cctype>
|
||||
#include <QDebug>
|
||||
|
||||
#include "dsp/basebandsamplesink.h"
|
||||
#include "dsp/datafifo.h"
|
||||
#include "psk31mod.h"
|
||||
#include "psk31modsource.h"
|
||||
#include "util/messagequeue.h"
|
||||
#include "maincore.h"
|
||||
|
||||
PSK31Source::PSK31Source() :
|
||||
m_channelSampleRate(48000),
|
||||
m_channelFrequencyOffset(0),
|
||||
m_spectrumRate(2000),
|
||||
m_fmPhase(0.0),
|
||||
m_spectrumSink(nullptr),
|
||||
m_specSampleBufferIndex(0),
|
||||
m_magsq(0.0),
|
||||
m_levelCalcCount(0),
|
||||
m_peakLevel(0.0f),
|
||||
m_levelSum(0.0f),
|
||||
m_byteIdx(0),
|
||||
m_bitIdx(0),
|
||||
m_bitCount(0)
|
||||
{
|
||||
m_bits.append(0);
|
||||
m_lowpass.create(301, m_channelSampleRate, 400.0 / 2.0);
|
||||
m_pulseShape.create(0.5, 6, m_channelSampleRate / 45.45, true);
|
||||
|
||||
m_demodBuffer.resize(1<<12);
|
||||
m_demodBufferFill = 0;
|
||||
|
||||
m_specSampleBuffer.resize(m_specSampleBufferSize);
|
||||
m_interpolatorDistanceRemain = 0;
|
||||
m_interpolatorConsumed = false;
|
||||
m_interpolatorDistance = (Real)m_channelSampleRate / (Real)m_spectrumRate;
|
||||
m_interpolator.create(48, m_spectrumRate, m_spectrumRate / 2.2, 3.0);
|
||||
|
||||
applySettings(m_settings, true);
|
||||
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
|
||||
}
|
||||
|
||||
PSK31Source::~PSK31Source()
|
||||
{
|
||||
}
|
||||
|
||||
void PSK31Source::pull(SampleVector::iterator begin, unsigned int nbSamples)
|
||||
{
|
||||
std::for_each(
|
||||
begin,
|
||||
begin + nbSamples,
|
||||
[this](Sample& s) {
|
||||
pullOne(s);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void PSK31Source::pullOne(Sample& sample)
|
||||
{
|
||||
if (m_settings.m_channelMute)
|
||||
{
|
||||
sample.m_real = 0.0f;
|
||||
sample.m_imag = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate next sample
|
||||
modulateSample();
|
||||
|
||||
// Shift to carrier frequency
|
||||
Complex ci = m_modSample;
|
||||
ci *= m_carrierNco.nextIQ();
|
||||
|
||||
// Calculate power
|
||||
double magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
|
||||
m_movingAverage(magsq);
|
||||
m_magsq = m_movingAverage.asDouble();
|
||||
|
||||
// Convert from float to fixed point
|
||||
sample.m_real = (FixReal) (ci.real() * SDR_TX_SCALEF);
|
||||
sample.m_imag = (FixReal) (ci.imag() * SDR_TX_SCALEF);
|
||||
}
|
||||
|
||||
void PSK31Source::sampleToSpectrum(Complex sample)
|
||||
{
|
||||
if (m_spectrumSink)
|
||||
{
|
||||
Complex out;
|
||||
if (m_interpolator.decimate(&m_interpolatorDistanceRemain, sample, &out))
|
||||
{
|
||||
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
||||
Real r = std::real(out) * SDR_TX_SCALEF;
|
||||
Real i = std::imag(out) * SDR_TX_SCALEF;
|
||||
m_specSampleBuffer[m_specSampleBufferIndex++] = Sample(r, i);
|
||||
if (m_specSampleBufferIndex == m_specSampleBufferSize)
|
||||
{
|
||||
m_spectrumSink->feed(m_specSampleBuffer.begin(), m_specSampleBuffer.end(), false);
|
||||
m_specSampleBufferIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31Source::modulateSample()
|
||||
{
|
||||
Real mod;
|
||||
|
||||
if (m_sampleIdx == 0)
|
||||
{
|
||||
if (m_bitCount == 0)
|
||||
{
|
||||
if (!m_textToTransmit.isEmpty())
|
||||
{
|
||||
// Encode a character at a time, so we get a TxReport after each character
|
||||
QString s = m_textToTransmit.left(1);
|
||||
m_textToTransmit = m_textToTransmit.mid(1);
|
||||
encodeText(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
encodeIdle();
|
||||
}
|
||||
initTX();
|
||||
}
|
||||
|
||||
m_bit = getBit();
|
||||
|
||||
// Differential encoding
|
||||
m_prevSymbol = m_symbol;
|
||||
m_symbol = (m_bit ^ m_symbol) ? 0 : 1;
|
||||
}
|
||||
|
||||
// PSK
|
||||
if (m_settings.m_pulseShaping)
|
||||
{
|
||||
if (m_sampleIdx == 1) {
|
||||
mod = m_pulseShape.filter(m_symbol ? 1.0f : -1.0f);
|
||||
} else {
|
||||
mod = m_pulseShape.filter(0.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mod = m_symbol ? 1.0f : -1.0f;
|
||||
}
|
||||
|
||||
m_sampleIdx++;
|
||||
if (m_sampleIdx >= m_samplesPerSymbol) {
|
||||
m_sampleIdx = 0;
|
||||
}
|
||||
|
||||
if (!m_settings.m_rfNoise)
|
||||
{
|
||||
m_modSample.real(m_linearGain * mod);
|
||||
m_modSample.imag(0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Noise to test filter frequency response
|
||||
m_modSample.real(m_linearGain * ((Real)rand()/((Real)RAND_MAX)-0.5f));
|
||||
m_modSample.imag(m_linearGain * ((Real)rand()/((Real)RAND_MAX)-0.5f));
|
||||
}
|
||||
|
||||
// Apply low pass filter to limit RF BW
|
||||
m_modSample = m_lowpass.filter(m_modSample);
|
||||
|
||||
// Display in spectrum analyser
|
||||
sampleToSpectrum(m_modSample);
|
||||
|
||||
Real s = std::real(m_modSample);
|
||||
calculateLevel(s);
|
||||
|
||||
// Send to demod analyser
|
||||
m_demodBuffer[m_demodBufferFill] = mod * std::numeric_limits<int16_t>::max();
|
||||
++m_demodBufferFill;
|
||||
|
||||
if (m_demodBufferFill >= m_demodBuffer.size())
|
||||
{
|
||||
QList<ObjectPipe*> dataPipes;
|
||||
MainCore::instance()->getDataPipes().getDataPipes(m_channel, "demod", dataPipes);
|
||||
|
||||
if (dataPipes.size() > 0)
|
||||
{
|
||||
QList<ObjectPipe*>::iterator it = dataPipes.begin();
|
||||
|
||||
for (; it != dataPipes.end(); ++it)
|
||||
{
|
||||
DataFifo *fifo = qobject_cast<DataFifo*>((*it)->m_element);
|
||||
|
||||
if (fifo) {
|
||||
fifo->write((quint8*) &m_demodBuffer[0], m_demodBuffer.size() * sizeof(qint16), DataFifo::DataTypeI16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_demodBufferFill = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31Source::calculateLevel(Real& sample)
|
||||
{
|
||||
if (m_levelCalcCount < m_levelNbSamples)
|
||||
{
|
||||
m_peakLevel = std::max(std::fabs(m_peakLevel), sample);
|
||||
m_levelSum += sample * sample;
|
||||
m_levelCalcCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_rmsLevel = sqrt(m_levelSum / m_levelNbSamples);
|
||||
m_peakLevelOut = m_peakLevel;
|
||||
m_peakLevel = 0.0f;
|
||||
m_levelSum = 0.0f;
|
||||
m_levelCalcCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31Source::applySettings(const PSK31Settings& settings, bool force)
|
||||
{
|
||||
if ((settings.m_baud != m_settings.m_baud) || force)
|
||||
{
|
||||
m_samplesPerSymbol = m_channelSampleRate / settings.m_baud;
|
||||
qDebug() << "m_samplesPerSymbol: " << m_samplesPerSymbol << " (" << m_channelSampleRate << "/" << settings.m_baud << ")";
|
||||
}
|
||||
|
||||
if ((settings.m_lpfTaps != m_settings.m_lpfTaps) || (settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force)
|
||||
{
|
||||
qDebug() << "PSK31Source::applySettings: Creating new lpf with taps " << settings.m_lpfTaps << " rfBW " << settings.m_rfBandwidth;
|
||||
m_lowpass.create(settings.m_lpfTaps, m_channelSampleRate, settings.m_rfBandwidth / 2.0);
|
||||
}
|
||||
if ((settings.m_beta != m_settings.m_beta) || (settings.m_symbolSpan != m_settings.m_symbolSpan) || (settings.m_baud != m_settings.m_baud) || force)
|
||||
{
|
||||
qDebug() << "PSK31Source::applySettings: Recreating pulse shaping filter: "
|
||||
<< " beta: " << settings.m_beta
|
||||
<< " symbolSpan: " << settings.m_symbolSpan
|
||||
<< " channelSampleRate:" << m_channelSampleRate
|
||||
<< " baud:" << settings.m_baud;
|
||||
m_pulseShape.create(settings.m_beta, settings.m_symbolSpan, m_channelSampleRate/settings.m_baud, true);
|
||||
}
|
||||
|
||||
m_settings = settings;
|
||||
|
||||
// Precalculate FM sensensity and linear gain to save doing it in the loop
|
||||
m_phaseSensitivity = 2.0f * M_PI * 1100 / (double)m_channelSampleRate;
|
||||
m_linearGain = powf(10.0f, m_settings.m_gain/20.0f);
|
||||
}
|
||||
|
||||
void PSK31Source::applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force)
|
||||
{
|
||||
qDebug() << "PSK31Source::applyChannelSettings:"
|
||||
<< " channelSampleRate: " << channelSampleRate
|
||||
<< " channelFrequencyOffset: " << channelFrequencyOffset
|
||||
<< " rfBandwidth: " << m_settings.m_rfBandwidth;
|
||||
|
||||
if ((channelFrequencyOffset != m_channelFrequencyOffset)
|
||||
|| (channelSampleRate != m_channelSampleRate) || force)
|
||||
{
|
||||
m_carrierNco.setFreq(channelFrequencyOffset, channelSampleRate);
|
||||
}
|
||||
|
||||
if ((m_channelSampleRate != channelSampleRate) || force)
|
||||
{
|
||||
qDebug() << "PSK31Source::applyChannelSettings: Recreating filters";
|
||||
m_lowpass.create(m_settings.m_lpfTaps, channelSampleRate, m_settings.m_rfBandwidth / 2.0);
|
||||
qDebug() << "PSK31Source::applyChannelSettings: Recreating bandpass filter: "
|
||||
<< " channelSampleRate:" << channelSampleRate;
|
||||
qDebug() << "PSK31Source::applyChannelSettings: Recreating pulse shaping filter: "
|
||||
<< " beta: " << m_settings.m_beta
|
||||
<< " symbolSpan: " << m_settings.m_symbolSpan
|
||||
<< " channelSampleRate:" << m_channelSampleRate
|
||||
<< " baud:" << m_settings.m_baud;
|
||||
m_pulseShape.create(m_settings.m_beta, m_settings.m_symbolSpan, channelSampleRate/m_settings.m_baud, true);
|
||||
}
|
||||
|
||||
if ((m_channelSampleRate != channelSampleRate) || force)
|
||||
{
|
||||
m_interpolatorDistanceRemain = 0;
|
||||
m_interpolatorConsumed = false;
|
||||
m_interpolatorDistance = (Real) channelSampleRate / (Real) m_spectrumRate;
|
||||
m_interpolator.create(48, m_spectrumRate, m_spectrumRate / 2.2, 3.0);
|
||||
}
|
||||
|
||||
m_channelSampleRate = channelSampleRate;
|
||||
m_channelFrequencyOffset = channelFrequencyOffset;
|
||||
m_samplesPerSymbol = m_channelSampleRate / m_settings.m_baud;
|
||||
qDebug() << "m_samplesPerSymbol: " << m_samplesPerSymbol << " (" << m_channelSampleRate << "/" << m_settings.m_baud << ")";
|
||||
|
||||
// Precalculate FM sensensity to save doing it in the loop
|
||||
m_phaseSensitivity = 2.0f * M_PI * 1100 / (double)m_channelSampleRate;
|
||||
|
||||
QList<ObjectPipe*> pipes;
|
||||
MainCore::instance()->getMessagePipes().getMessagePipes(m_channel, "reportdemod", pipes);
|
||||
|
||||
if (pipes.size() > 0)
|
||||
{
|
||||
for (const auto& pipe : pipes)
|
||||
{
|
||||
MessageQueue* messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||
MainCore::MsgChannelDemodReport *msg = MainCore::MsgChannelDemodReport::create(m_channel, m_channelSampleRate);
|
||||
messageQueue->push(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int PSK31Source::getBit()
|
||||
{
|
||||
int bit;
|
||||
|
||||
if (m_bitCount > 0)
|
||||
{
|
||||
bit = (m_bits[m_byteIdx] >> m_bitIdx) & 1;
|
||||
m_bitIdx++;
|
||||
m_bitCount--;
|
||||
if (m_bitIdx == 8)
|
||||
{
|
||||
m_byteIdx++;
|
||||
m_bitIdx = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "PSK31Source::getBit: Called when empty";
|
||||
bit = 1;
|
||||
}
|
||||
|
||||
return bit;
|
||||
}
|
||||
|
||||
void PSK31Source::addBit(int bit)
|
||||
{
|
||||
m_bits[m_byteIdx] |= bit << m_bitIdx;
|
||||
m_bitIdx++;
|
||||
m_bitCount++;
|
||||
m_bitCountTotal++;
|
||||
if (m_bitIdx == 8)
|
||||
{
|
||||
m_byteIdx++;
|
||||
if (m_bits.size() <= m_byteIdx) {
|
||||
m_bits.append(0);
|
||||
}
|
||||
m_bitIdx = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31Source::initTX()
|
||||
{
|
||||
m_byteIdx = 0;
|
||||
m_bitIdx = 0;
|
||||
m_bitCount = m_bitCountTotal; // Reset to allow retransmission
|
||||
m_bit = 0;
|
||||
}
|
||||
|
||||
void PSK31Source::addTXText(QString text)
|
||||
{
|
||||
int count = m_settings.m_repeat ? m_settings.m_repeatCount : 1;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
||||
QString s = text;
|
||||
|
||||
if (m_settings.m_prefixCRLF) {
|
||||
s.prepend("\r\r\n>"); // '>' switches to letters
|
||||
}
|
||||
if (m_settings.m_postfixCRLF) {
|
||||
s.append("\r\r\n");
|
||||
}
|
||||
|
||||
m_textToTransmit.append(s);
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31Source::encodeText(const QString& text)
|
||||
{
|
||||
// PSK31 varicode encoding
|
||||
m_byteIdx = 0;
|
||||
m_bitIdx = 0;
|
||||
m_bitCount = 0;
|
||||
m_bitCountTotal = 0;
|
||||
for (int i = 0; i < m_bits.size(); i++) {
|
||||
m_bits[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < text.size(); i++)
|
||||
{
|
||||
unsigned bits;
|
||||
unsigned bitCount;
|
||||
|
||||
m_psk31Encoder.encode(text[i], bits, bitCount);
|
||||
for (unsigned int j = 0; j < bitCount; j++)
|
||||
{
|
||||
int txBit = (bits >> j) & 1;
|
||||
addBit(txBit);
|
||||
}
|
||||
}
|
||||
|
||||
if (getMessageQueueToGUI())
|
||||
{
|
||||
PSK31::MsgReportTx* msg = PSK31::MsgReportTx::create(text, m_textToTransmit.size());
|
||||
getMessageQueueToGUI()->push(msg);
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31Source::encodeIdle()
|
||||
{
|
||||
m_byteIdx = 0;
|
||||
m_bitIdx = 0;
|
||||
m_bitCount = 0;
|
||||
m_bitCountTotal = 0;
|
||||
for (int i = 0; i < m_bits.size(); i++) {
|
||||
m_bits[i] = 0;
|
||||
}
|
||||
addBit(0);
|
||||
addBit(0);
|
||||
addBit(0);
|
||||
addBit(0);
|
||||
}
|
137
plugins/channeltx/modpsk31/psk31modsource.h
Normal file
137
plugins/channeltx/modpsk31/psk31modsource.h
Normal file
@ -0,0 +1,137 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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_PSK31MODSOURCE_H
|
||||
#define INCLUDE_PSK31MODSOURCE_H
|
||||
|
||||
#include <QMutex>
|
||||
#include <QDebug>
|
||||
#include <QVector>
|
||||
|
||||
#include "dsp/channelsamplesource.h"
|
||||
#include "dsp/nco.h"
|
||||
#include "dsp/ncof.h"
|
||||
#include "dsp/interpolator.h"
|
||||
#include "dsp/firfilter.h"
|
||||
#include "dsp/raisedcosine.h"
|
||||
#include "util/movingaverage.h"
|
||||
#include "util/psk31.h"
|
||||
|
||||
#include "psk31modsettings.h"
|
||||
|
||||
class BasebandSampleSink;
|
||||
class ChannelAPI;
|
||||
|
||||
class PSK31Source : public ChannelSampleSource
|
||||
{
|
||||
public:
|
||||
PSK31Source();
|
||||
virtual ~PSK31Source();
|
||||
|
||||
virtual void pull(SampleVector::iterator begin, unsigned int nbSamples);
|
||||
virtual void pullOne(Sample& sample);
|
||||
virtual void prefetch(unsigned int nbSamples) { (void) nbSamples; }
|
||||
|
||||
double getMagSq() const { return m_magsq; }
|
||||
void getLevels(qreal& rmsLevel, qreal& peakLevel, int& numSamples) const
|
||||
{
|
||||
rmsLevel = m_rmsLevel;
|
||||
peakLevel = m_peakLevelOut;
|
||||
numSamples = m_levelNbSamples;
|
||||
}
|
||||
void setMessageQueueToGUI(MessageQueue* messageQueue) { m_messageQueueToGUI = messageQueue; }
|
||||
void setSpectrumSink(BasebandSampleSink *sampleSink) { m_spectrumSink = sampleSink; }
|
||||
void applySettings(const PSK31Settings& settings, bool force = false);
|
||||
void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = false);
|
||||
void addTXText(QString data);
|
||||
void setChannel(ChannelAPI *channel) { m_channel = channel; }
|
||||
int getChannelSampleRate() const { return m_channelSampleRate; }
|
||||
|
||||
private:
|
||||
int m_channelSampleRate;
|
||||
int m_channelFrequencyOffset;
|
||||
int m_spectrumRate;
|
||||
PSK31Settings m_settings;
|
||||
ChannelAPI *m_channel;
|
||||
|
||||
NCO m_carrierNco;
|
||||
double m_fmPhase; // Double gives cleaner spectrum than Real
|
||||
double m_phaseSensitivity;
|
||||
Real m_linearGain;
|
||||
Complex m_modSample;
|
||||
|
||||
int m_bit; // Current bit
|
||||
int m_prevBit; // Previous bit, for differential encoding
|
||||
int m_symbol; // Current symbol
|
||||
int m_prevSymbol;
|
||||
RaisedCosine<Real> m_pulseShape; // Pulse shaping filter
|
||||
Lowpass<Complex> m_lowpass; // Low pass filter to limit RF bandwidth
|
||||
|
||||
BasebandSampleSink* m_spectrumSink; // Spectrum GUI to display baseband waveform
|
||||
SampleVector m_specSampleBuffer;
|
||||
static const int m_specSampleBufferSize = 256;
|
||||
int m_specSampleBufferIndex;
|
||||
Interpolator m_interpolator; // Interpolator to downsample to spectrum
|
||||
Real m_interpolatorDistance;
|
||||
Real m_interpolatorDistanceRemain;
|
||||
bool m_interpolatorConsumed;
|
||||
|
||||
double m_magsq;
|
||||
MovingAverageUtil<double, double, 16> m_movingAverage;
|
||||
|
||||
quint32 m_levelCalcCount;
|
||||
qreal m_rmsLevel;
|
||||
qreal m_peakLevelOut;
|
||||
Real m_peakLevel;
|
||||
Real m_levelSum;
|
||||
|
||||
static const int m_levelNbSamples = 480; // every 10ms assuming 48k Sa/s
|
||||
|
||||
int m_sampleIdx; // Sample index in to symbol
|
||||
int m_samplesPerSymbol; // Number of samples per symbol
|
||||
|
||||
QString m_textToTransmit; // Transmit buffer (before encoding)
|
||||
|
||||
PSK31Encoder m_psk31Encoder;
|
||||
|
||||
QList<uint8_t> m_bits; // Bits to transmit
|
||||
int m_byteIdx; // Index in to m_bits
|
||||
int m_bitIdx; // Index in to current byte of m_bits
|
||||
int m_bitCount; // Count of number of valid bits in m_bits
|
||||
int m_bitCountTotal;
|
||||
|
||||
QVector<qint16> m_demodBuffer;
|
||||
int m_demodBufferFill;
|
||||
|
||||
MessageQueue* m_messageQueueToGUI;
|
||||
|
||||
MessageQueue* getMessageQueueToGUI() { return m_messageQueueToGUI; }
|
||||
|
||||
void encodeText(const QString& data);
|
||||
void encodeIdle();
|
||||
int getBit(); // Get bit from m_bits
|
||||
void addBit(int bit); // Add bit to m_bits, with zero stuffing
|
||||
void initTX();
|
||||
|
||||
void calculateLevel(Real& sample);
|
||||
void modulateSample();
|
||||
void sampleToSpectrum(Complex sample);
|
||||
|
||||
};
|
||||
|
||||
#endif // INCLUDE_PSK31MODSOURCE_H
|
110
plugins/channeltx/modpsk31/psk31modtxsettingsdialog.cpp
Normal file
110
plugins/channeltx/modpsk31/psk31modtxsettingsdialog.cpp
Normal file
@ -0,0 +1,110 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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 "psk31modtxsettingsdialog.h"
|
||||
|
||||
static QListWidgetItem* newItem(const QString& text)
|
||||
{
|
||||
QListWidgetItem* item = new QListWidgetItem(text);
|
||||
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||
return item;
|
||||
}
|
||||
|
||||
PSK31TXSettingsDialog::PSK31TXSettingsDialog(PSK31Settings* settings, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
m_settings(settings),
|
||||
ui(new Ui::PSK31TXSettingsDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->prefixCRLF->setChecked(m_settings->m_prefixCRLF);
|
||||
ui->postfixCRLF->setChecked(m_settings->m_postfixCRLF);
|
||||
for (const auto& text : m_settings->m_predefinedTexts) {
|
||||
ui->predefinedText->addItem(newItem(text));
|
||||
}
|
||||
ui->pulseShaping->setChecked(m_settings->m_pulseShaping);
|
||||
ui->beta->setValue(m_settings->m_beta);
|
||||
ui->symbolSpan->setValue(m_settings->m_symbolSpan);
|
||||
ui->lpfTaps->setValue(m_settings->m_lpfTaps);
|
||||
ui->rfNoise->setChecked(m_settings->m_rfNoise);
|
||||
}
|
||||
|
||||
PSK31TXSettingsDialog::~PSK31TXSettingsDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PSK31TXSettingsDialog::accept()
|
||||
{
|
||||
m_settings->m_prefixCRLF = ui->prefixCRLF->isChecked();
|
||||
m_settings->m_postfixCRLF = ui->postfixCRLF->isChecked();
|
||||
m_settings->m_predefinedTexts.clear();
|
||||
for (int i = 0; i < ui->predefinedText->count(); i++) {
|
||||
m_settings->m_predefinedTexts.append(ui->predefinedText->item(i)->text());
|
||||
}
|
||||
m_settings->m_pulseShaping = ui->pulseShaping->isChecked();
|
||||
m_settings->m_beta = ui->beta->value();
|
||||
m_settings->m_symbolSpan = ui->symbolSpan->value();
|
||||
m_settings->m_lpfTaps = ui->lpfTaps->value();
|
||||
m_settings->m_rfNoise = ui->rfNoise->isChecked();
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void PSK31TXSettingsDialog::on_add_clicked()
|
||||
{
|
||||
QListWidgetItem* item = newItem("...");
|
||||
ui->predefinedText->addItem(item);
|
||||
ui->predefinedText->setCurrentItem(item);
|
||||
}
|
||||
|
||||
void PSK31TXSettingsDialog::on_remove_clicked()
|
||||
{
|
||||
QList<QListWidgetItem*> items = ui->predefinedText->selectedItems();
|
||||
for (auto item : items) {
|
||||
delete ui->predefinedText->takeItem(ui->predefinedText->row(item));
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31TXSettingsDialog::on_up_clicked()
|
||||
{
|
||||
QList<QListWidgetItem*> items = ui->predefinedText->selectedItems();
|
||||
for (auto item : items)
|
||||
{
|
||||
int row = ui->predefinedText->row(item);
|
||||
if (row > 0)
|
||||
{
|
||||
QListWidgetItem* item = ui->predefinedText->takeItem(row);
|
||||
ui->predefinedText->insertItem(row - 1, item);
|
||||
ui->predefinedText->setCurrentItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PSK31TXSettingsDialog::on_down_clicked()
|
||||
{
|
||||
QList<QListWidgetItem*> items = ui->predefinedText->selectedItems();
|
||||
for (auto item : items)
|
||||
{
|
||||
int row = ui->predefinedText->row(item);
|
||||
if (row < ui->predefinedText->count() - 1)
|
||||
{
|
||||
QListWidgetItem* item = ui->predefinedText->takeItem(row);
|
||||
ui->predefinedText->insertItem(row + 1, item);
|
||||
ui->predefinedText->setCurrentItem(item);
|
||||
}
|
||||
}
|
||||
}
|
44
plugins/channeltx/modpsk31/psk31modtxsettingsdialog.h
Normal file
44
plugins/channeltx/modpsk31/psk31modtxsettingsdialog.h
Normal file
@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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_PSK31MODTXSETTINGSDIALOG_H
|
||||
#define INCLUDE_PSK31MODTXSETTINGSDIALOG_H
|
||||
|
||||
#include "ui_psk31modtxsettingsdialog.h"
|
||||
#include "psk31modsettings.h"
|
||||
|
||||
class PSK31TXSettingsDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PSK31TXSettingsDialog(PSK31Settings *settings, QWidget *parent = nullptr);
|
||||
~PSK31TXSettingsDialog();
|
||||
|
||||
PSK31Settings *m_settings;
|
||||
|
||||
private slots:
|
||||
void accept();
|
||||
void on_add_clicked();
|
||||
void on_remove_clicked();
|
||||
void on_up_clicked();
|
||||
void on_down_clicked();
|
||||
|
||||
private:
|
||||
Ui::PSK31TXSettingsDialog* ui;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_PSK31MODTXSETTINGSDIALOG_H
|
284
plugins/channeltx/modpsk31/psk31modtxsettingsdialog.ui
Normal file
284
plugins/channeltx/modpsk31/psk31modtxsettingsdialog.ui
Normal file
@ -0,0 +1,284 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PSK31TXSettingsDialog</class>
|
||||
<widget class="QDialog" name="PSK31TXSettingsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>351</width>
|
||||
<height>554</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Sans</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Transmit Settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="listControls">
|
||||
<property name="title">
|
||||
<string>Text</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="prefixCRLF">
|
||||
<property name="toolTip">
|
||||
<string>Prefix text with carriage returns, line feed and switch to letters</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Prefix CR+CR+LF+LTRS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Predefined text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="add">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add item to list</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="remove">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove selected items from list</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="up">
|
||||
<property name="toolTip">
|
||||
<string>Move selected item up</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Up</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrgui/resources/res.qrc">
|
||||
<normaloff>:/arrow_up.png</normaloff>:/arrow_up.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="down">
|
||||
<property name="toolTip">
|
||||
<string>Move selected item down</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrgui/resources/res.qrc">
|
||||
<normaloff>:/arrow_down.png</normaloff>:/arrow_down.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="postfixCRLF">
|
||||
<property name="toolTip">
|
||||
<string>Postfix text with carriage returns and line feeds</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Postfix CR+CR+LF</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QListWidget" name="predefinedText">
|
||||
<property name="toolTip">
|
||||
<string>Predefined text messages
|
||||
|
||||
Substitutions:
|
||||
${callsign}
|
||||
${location}</string>
|
||||
</property>
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::InternalMove</enum>
|
||||
</property>
|
||||
<property name="defaultDropAction">
|
||||
<enum>Qt::MoveAction</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="fskGroup">
|
||||
<property name="title">
|
||||
<string>Modulation</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lpfTapsLabel">
|
||||
<property name="text">
|
||||
<string>RF BW limit LPF taps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="lpfTaps">
|
||||
<property name="toolTip">
|
||||
<string>Number of taps in LPF for RF BW filter.</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="pulseShaping">
|
||||
<property name="toolTip">
|
||||
<string>Enable raised cosine pulse shaping filter</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Raised cosine pulse shaping</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="betaLabel">
|
||||
<property name="text">
|
||||
<string>Filter rolloff (beta)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="beta">
|
||||
<property name="toolTip">
|
||||
<string>Roll-off of the filter</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.250000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="symbolSpanLabel">
|
||||
<property name="text">
|
||||
<string>Filter symbol span</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="symbolSpan">
|
||||
<property name="toolTip">
|
||||
<string>Number of symbols over which filter is applied</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>20</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="debugGroup">
|
||||
<property name="title">
|
||||
<string>Debug</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="rfNoise">
|
||||
<property name="toolTip">
|
||||
<string>Generate white noise as RF signal.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Generate RF noise</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>
|
||||
<include location="../../../sdrgui/resources/res.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>PSK31TXSettingsDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>PSK31TXSettingsDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
53
plugins/channeltx/modpsk31/psk31modwebapiadapter.cpp
Normal file
53
plugins/channeltx/modpsk31/psk31modwebapiadapter.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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 "SWGChannelSettings.h"
|
||||
#include "psk31mod.h"
|
||||
#include "psk31modwebapiadapter.h"
|
||||
|
||||
PSK31WebAPIAdapter::PSK31WebAPIAdapter()
|
||||
{}
|
||||
|
||||
PSK31WebAPIAdapter::~PSK31WebAPIAdapter()
|
||||
{}
|
||||
|
||||
int PSK31WebAPIAdapter::webapiSettingsGet(
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setPSK31Settings(new SWGSDRangel::SWGPSK31ModSettings());
|
||||
response.getPSK31Settings()->init();
|
||||
PSK31::webapiFormatChannelSettings(response, m_settings);
|
||||
|
||||
return 200;
|
||||
}
|
||||
|
||||
int PSK31WebAPIAdapter::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) force; // no action
|
||||
(void) errorMessage;
|
||||
PSK31::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response);
|
||||
|
||||
PSK31::webapiFormatChannelSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
50
plugins/channeltx/modpsk31/psk31modwebapiadapter.h
Normal file
50
plugins/channeltx/modpsk31/psk31modwebapiadapter.h
Normal file
@ -0,0 +1,50 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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_PSK31MOD_WEBAPIADAPTER_H
|
||||
#define INCLUDE_PSK31MOD_WEBAPIADAPTER_H
|
||||
|
||||
#include "channel/channelwebapiadapter.h"
|
||||
#include "psk31modsettings.h"
|
||||
|
||||
/**
|
||||
* Standalone API adapter only for the settings
|
||||
*/
|
||||
class PSK31WebAPIAdapter : public ChannelWebAPIAdapter {
|
||||
public:
|
||||
PSK31WebAPIAdapter();
|
||||
virtual ~PSK31WebAPIAdapter();
|
||||
|
||||
virtual QByteArray serialize() const { return m_settings.serialize(); }
|
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
PSK31Settings m_settings;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_PSK31MOD_WEBAPIADAPTER_H
|
99
plugins/channeltx/modpsk31/readme.md
Normal file
99
plugins/channeltx/modpsk31/readme.md
Normal file
@ -0,0 +1,99 @@
|
||||
<h1>PSK31 Modulator Plugin</h1>
|
||||
|
||||
<h2>Introduction</h2>
|
||||
|
||||
This plugin can be used to modulate PSK31 encoded text.
|
||||
PSK31 uses differential Binary Phase Shift Keying at 31.25 baud.
|
||||
|
||||
<h2>Interface</h2>
|
||||
|
||||
The top and bottom bars of the channel window are described [here](../../../sdrgui/channel/readme.md)
|
||||
|
||||
![PSK31 Modulator plugin GUI](../../../doc/img/PSK31Mod_plugin.png)
|
||||
|
||||
<h3>1: Frequency shift from center frequency of transmission</h3>
|
||||
|
||||
Use the wheels to adjust the frequency shift in Hz from the center frequency of transmission. Left click on a digit sets the cursor position at this digit. Right click on a digit sets all digits on the right to zero. This effectively floors value at the digit position. Wheels are moved with the mousewheel while pointing at the wheel or by selecting the wheel with the left mouse click and using the keyboard arrows. Pressing shift simultaneously moves digit by 5 and pressing control moves it by 2.
|
||||
|
||||
<h3>2: Channel power</h3>
|
||||
|
||||
Average total power in dB relative to a +/- 1.0 amplitude signal generated in the pass band.
|
||||
|
||||
<h3>3: Channel mute</h3>
|
||||
|
||||
Use this button to toggle mute for this channel.
|
||||
|
||||
<h3>4: RF Bandwidth</h3>
|
||||
|
||||
This specifies the bandwidth of a LPF that is applied to the output signal to limit the RF bandwidth.
|
||||
|
||||
<h3>5: Gain</h3>
|
||||
|
||||
Adjusts the gain in dB from -60 to 0dB.
|
||||
|
||||
<h3>6: Level meter in %</h3>
|
||||
|
||||
- top bar (beige): average value
|
||||
- bottom bar (brown): instantaneous peak value
|
||||
- tip vertical bar (bright red): peak hold value
|
||||
|
||||
<h3>7: UDP</h3>
|
||||
|
||||
When checked, a UDP port is opened to receive text from other features or applications that will be transmitted.
|
||||
|
||||
<h3>8: UDP address</h3>
|
||||
|
||||
IP address of the interface to open the UDP port on, to receive text to be transmitted.
|
||||
|
||||
<h3>9: UDP port</h3>
|
||||
|
||||
UDP port number to receive text to be transmitted on.
|
||||
|
||||
<h3>10: Repeat</h3>
|
||||
|
||||
Check this button to repeatedly transmit a text message. Right click to open the dialog to adjust the number of times the text should be repeated.
|
||||
|
||||
<h3>11: Clear Transmitted Text</h3>
|
||||
|
||||
Press to clear the transmitted text.
|
||||
|
||||
<h3>12: Text to Transmit</h3>
|
||||
|
||||
Enter text to transmit. Pressing return will transmit the text and clear this field. Press the arrow to display and select a list of pre-defined text or previously transmitted text to enter in to the field.
|
||||
|
||||
The list of pre-defined text can be customised via the Transmit Settings dialog (13).
|
||||
|
||||
<h3>13: TX</h3>
|
||||
|
||||
Press to transmit the current text. The text field will not be cleared.
|
||||
|
||||
Right click to open a dialog to adjust additional Transmit Settings, including the list of pre-defined text.
|
||||
|
||||
Predefined text supports the following variable substitutions:
|
||||
|
||||
* ${callsign} - Gets replaced with the station name from Preferences > My Position
|
||||
* ${location} = Gets replaced with the Maidenhead locator for the position specified under Preferences > My Position
|
||||
|
||||
The substitutions are applied when the Transmit Settings dialog is closed.
|
||||
|
||||
<h3>14: Transmitted Text</h3>
|
||||
|
||||
The trasnmitted text area shows characters as they are transmitted.
|
||||
|
||||
Holding the cursor over an acronym may show a tooltip with the decoded acronym.
|
||||
|
||||
<h2>API</h2>
|
||||
|
||||
Full details of the API can be found in the Swagger documentation. Below are a few examples.
|
||||
|
||||
To transmit the current text simply send a "tx" action:
|
||||
|
||||
curl -X POST "http://127.0.0.1:8091/sdrangel/deviceset/0/channel/0/actions" -d '{"channelType": "PSK31Mod", "direction": 1, "PSK31ModActions": { "tx": 1 }}'
|
||||
|
||||
To transmit text specified on the command line:
|
||||
|
||||
curl -X POST "http://127.0.0.1:8091/sdrangel/deviceset/0/channel/0/actions" -d '{"channelType": "PSK31Mod", "direction": 1, "PSK31ModActions": { "tx": 1, "payload": {"text": "CQ CQ CQ anyone using SDRangel CQ" }}}'
|
||||
|
||||
To adjust a setting, such as the frequency offset:
|
||||
|
||||
curl -X PATCH "http://127.0.0.1:8091/sdrangel/deviceset/0/channel/0/settings" -d '{"channelType": "PSK31Mod", "direction": 1, "PSK31ModSettings": {"inputFrequencyOffset": 2000 }}'
|
@ -38,6 +38,7 @@ const QStringList DemodAnalyzerSettings::m_channelTypes = {
|
||||
QStringLiteral("PacketDemod"),
|
||||
QStringLiteral("PacketMod"),
|
||||
QStringLiteral("RadiosondeDemod"),
|
||||
QStringLiteral("PSK31Mod"),
|
||||
QStringLiteral("RTTYMod"),
|
||||
QStringLiteral("SSBDemod"),
|
||||
QStringLiteral("SSBMod"),
|
||||
@ -61,6 +62,7 @@ const QStringList DemodAnalyzerSettings::m_channelURIs = {
|
||||
QStringLiteral("sdrangel.channel.packetdemod"),
|
||||
QStringLiteral("sdrangel.channeltx.modpacket"),
|
||||
QStringLiteral("sdrangel.channel.radiosondedemod"),
|
||||
QStringLiteral("sdrangel.channeltx.modpsk31"),
|
||||
QStringLiteral("sdrangel.channeltx.modrtty"),
|
||||
QStringLiteral("sdrangel.channel.ssbdemod"),
|
||||
QStringLiteral("sdrangel.channeltx.modssb"),
|
||||
|
@ -252,6 +252,7 @@ set(sdrbase_SOURCES
|
||||
util/png.cpp
|
||||
util/prettyprint.cpp
|
||||
util/profiler.cpp
|
||||
util/psk31.cpp
|
||||
util/radiosonde.cpp
|
||||
util/rtpsink.cpp
|
||||
util/syncmessenger.cpp
|
||||
@ -491,6 +492,7 @@ set(sdrbase_HEADERS
|
||||
util/png.h
|
||||
util/prettyprint.h
|
||||
util/profiler.h
|
||||
util/psk31.h
|
||||
util/radiosonde.h
|
||||
util/rtpsink.h
|
||||
util/rtty.h
|
||||
|
205
sdrbase/util/psk31.cpp
Normal file
205
sdrbase/util/psk31.cpp
Normal file
@ -0,0 +1,205 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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 <QDebug>
|
||||
|
||||
#include "psk31.h"
|
||||
|
||||
// ASCII varicode encoding
|
||||
// From http://www.aintel.bi.ehu.es/psk31.html
|
||||
const QStringList PSK31Varicode::m_varicode = {
|
||||
"1010101011",
|
||||
"1011011011",
|
||||
"1011101101",
|
||||
"1101110111",
|
||||
"1011101011",
|
||||
"1101011111",
|
||||
"1011101111",
|
||||
"1011111101",
|
||||
"1011111111",
|
||||
"11101111",
|
||||
"11101",
|
||||
"1101101111",
|
||||
"1011011101",
|
||||
"11111",
|
||||
"1101110101",
|
||||
"1110101011",
|
||||
"1011110111",
|
||||
"1011110101",
|
||||
"1110101101",
|
||||
"1110101111",
|
||||
"1101011011",
|
||||
"1101101011",
|
||||
"1101101101",
|
||||
"1101010111",
|
||||
"1101111011",
|
||||
"1101111101",
|
||||
"1110110111",
|
||||
"1101010101",
|
||||
"1101011101",
|
||||
"1110111011",
|
||||
"1011111011",
|
||||
"1101111111",
|
||||
"1",
|
||||
"111111111",
|
||||
"101011111",
|
||||
"111110101",
|
||||
"111011011",
|
||||
"1011010101",
|
||||
"1010111011",
|
||||
"101111111",
|
||||
"11111011",
|
||||
"11110111",
|
||||
"101101111",
|
||||
"111011111",
|
||||
"1110101",
|
||||
"110101",
|
||||
"1010111",
|
||||
"110101111",
|
||||
"10110111",
|
||||
"10111101",
|
||||
"11101101",
|
||||
"11111111",
|
||||
"101110111",
|
||||
"101011011",
|
||||
"101101011",
|
||||
"110101101",
|
||||
"110101011",
|
||||
"110110111",
|
||||
"11110101",
|
||||
"110111101",
|
||||
"111101101",
|
||||
"1010101",
|
||||
"111010111",
|
||||
"1010101111",
|
||||
"1010111101",
|
||||
"1111101",
|
||||
"11101011",
|
||||
"10101101",
|
||||
"10110101",
|
||||
"1110111",
|
||||
"11011011",
|
||||
"11111101",
|
||||
"101010101",
|
||||
"1111111",
|
||||
"111111101",
|
||||
"101111101",
|
||||
"11010111",
|
||||
"10111011",
|
||||
"11011101",
|
||||
"10101011",
|
||||
"11010101",
|
||||
"111011101",
|
||||
"10101111",
|
||||
"1101111",
|
||||
"1101101",
|
||||
"101010111",
|
||||
"110110101",
|
||||
"101011101",
|
||||
"101110101",
|
||||
"101111011",
|
||||
"1010101101",
|
||||
"111110111",
|
||||
"111101111",
|
||||
"111111011",
|
||||
"1010111111",
|
||||
"101101101",
|
||||
"1011011111",
|
||||
"1011",
|
||||
"1011111",
|
||||
"101111",
|
||||
"101101",
|
||||
"11",
|
||||
"111101",
|
||||
"1011011",
|
||||
"101011",
|
||||
"1101",
|
||||
"111101011",
|
||||
"10111111",
|
||||
"11011",
|
||||
"111011",
|
||||
"1111",
|
||||
"111",
|
||||
"111111",
|
||||
"110111111",
|
||||
"10101",
|
||||
"10111",
|
||||
"101",
|
||||
"110111",
|
||||
"1111011",
|
||||
"1101011",
|
||||
"11011111",
|
||||
"1011101",
|
||||
"111010101",
|
||||
"1010110111",
|
||||
"110111011",
|
||||
"1010110101",
|
||||
"1011010111",
|
||||
"1110110101",
|
||||
};
|
||||
|
||||
PSK31Encoder::PSK31Encoder()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool PSK31Encoder::encode(QChar c, unsigned &bits, unsigned int &bitCount)
|
||||
{
|
||||
bits = 0;
|
||||
bitCount = 0;
|
||||
|
||||
char ch = c.toLatin1() & 0x7f;
|
||||
QString code = PSK31Varicode::m_varicode[ch];
|
||||
|
||||
// FIXME: http://det.bi.ehu.es/~jtpjatae/pdf/p31g3plx.pdf > 128
|
||||
|
||||
addCode(bits, bitCount, code);
|
||||
qDebug() << "Encoding " << c << "as" << code << bits << bitCount;
|
||||
return true;
|
||||
}
|
||||
|
||||
void PSK31Encoder::addCode(unsigned& bits, unsigned int& bitCount, const QString& code) const
|
||||
{
|
||||
int codeBits = 0;
|
||||
unsigned int codeLen = code.size();
|
||||
|
||||
for (int i = 0; i < codeLen; i++) {
|
||||
codeBits |= (code[i] == "1" ? 1 : 0) << i;
|
||||
}
|
||||
|
||||
addStartBits(bits, bitCount);
|
||||
addBits(bits, bitCount, codeBits, codeLen);
|
||||
addStopBits(bits, bitCount);
|
||||
}
|
||||
|
||||
void PSK31Encoder::addStartBits(unsigned& bits, unsigned int& bitCount) const
|
||||
{
|
||||
// Start bit is 0
|
||||
addBits(bits, bitCount, 0, 1);
|
||||
}
|
||||
|
||||
void PSK31Encoder::addStopBits(unsigned& bits, unsigned int& bitCount) const
|
||||
{
|
||||
// Stop bit is 1
|
||||
addBits(bits, bitCount, 0, 1);
|
||||
}
|
||||
|
||||
void PSK31Encoder::addBits(unsigned& bits, unsigned int& bitCount, int data, int count) const
|
||||
{
|
||||
bits |= data << bitCount;
|
||||
bitCount += count;
|
||||
}
|
52
sdrbase/util/psk31.h
Normal file
52
sdrbase/util/psk31.h
Normal file
@ -0,0 +1,52 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2023 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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_UTIL_PSK31_H
|
||||
#define INCLUDE_UTIL_PSK31_H
|
||||
|
||||
#include <QString>
|
||||
#include <QDateTime>
|
||||
#include <QMap>
|
||||
|
||||
#include "export.h"
|
||||
|
||||
class SDRBASE_API PSK31Varicode {
|
||||
|
||||
public:
|
||||
|
||||
static const QStringList m_varicode; // Index with 7-bit ASCII
|
||||
|
||||
};
|
||||
|
||||
class SDRBASE_API PSK31Encoder {
|
||||
|
||||
public:
|
||||
|
||||
PSK31Encoder();
|
||||
bool encode(QChar c, unsigned& bits, unsigned int &bitCount);
|
||||
|
||||
private:
|
||||
|
||||
void addCode(unsigned& bits, unsigned int& bitCount, const QString& code) const;
|
||||
void addStartBits(unsigned int& bits, unsigned int& bitCount) const;
|
||||
void addStopBits(unsigned int& bits, unsigned int& bitCount) const;
|
||||
void addBits(unsigned int& bits, unsigned int& bitCount, int data, int count) const;
|
||||
|
||||
};
|
||||
|
||||
#endif // INCLUDE_UTIL_PSK31_H
|
||||
|
@ -4609,6 +4609,11 @@ bool WebAPIRequestMapper::getChannelSettings(
|
||||
channelSettings->setPagerDemodSettings(new SWGSDRangel::SWGPagerDemodSettings());
|
||||
channelSettings->getPagerDemodSettings()->fromJsonObject(settingsJsonObject);
|
||||
}
|
||||
else if (channelSettingsKey == "PSK31ModSettings")
|
||||
{
|
||||
channelSettings->setPsk31ModSettings(new SWGSDRangel::SWGPSK31ModSettings());
|
||||
channelSettings->getPsk31ModSettings()->fromJsonObject(settingsJsonObject);
|
||||
}
|
||||
else if (channelSettingsKey == "RadioAstronomySettings")
|
||||
{
|
||||
channelSettings->setRadioAstronomySettings(new SWGSDRangel::SWGRadioAstronomySettings());
|
||||
@ -4643,12 +4648,12 @@ bool WebAPIRequestMapper::getChannelSettings(
|
||||
{
|
||||
channelSettings->setRttyDemodSettings(new SWGSDRangel::SWGRTTYDemodSettings());
|
||||
channelSettings->getRttyDemodSettings()->fromJsonObject(settingsJsonObject);
|
||||
}
|
||||
}
|
||||
else if (channelSettingsKey == "RTTYModSettings")
|
||||
{
|
||||
channelSettings->setRttyModSettings(new SWGSDRangel::SWGRTTYModSettings());
|
||||
channelSettings->getRttyModSettings()->fromJsonObject(settingsJsonObject);
|
||||
}
|
||||
}
|
||||
else if (channelSettingsKey == "SigMFFileSinkSettings")
|
||||
{
|
||||
channelSettings->setSigMfFileSinkSettings(new SWGSDRangel::SWGSigMFFileSinkSettings());
|
||||
@ -4756,6 +4761,11 @@ bool WebAPIRequestMapper::getChannelActions(
|
||||
channelActions->setPacketModActions(new SWGSDRangel::SWGPacketModActions());
|
||||
channelActions->getPacketModActions()->fromJsonObject(actionsJsonObject);
|
||||
}
|
||||
else if (channelActionsKey == "PSK31ModActions")
|
||||
{
|
||||
channelActions->setPsk31ModActions(new SWGSDRangel::SWGPsk31ModActions());
|
||||
channelActions->getPsk31ModActions()->fromJsonObject(actionsJsonObject);
|
||||
}
|
||||
else if (channelActionsKey == "RTTYModActions")
|
||||
{
|
||||
channelActions->setRttyModActions(new SWGSDRangel::SWGRTTYModActions());
|
||||
@ -5435,6 +5445,7 @@ void WebAPIRequestMapper::resetChannelSettings(SWGSDRangel::SWGChannelSettings&
|
||||
channelSettings.setPacketDemodSettings(nullptr);
|
||||
channelSettings.setPacketModSettings(nullptr);
|
||||
channelSettings.setPagerDemodSettings(nullptr);
|
||||
channelSettings.setPsk31ModSettings(nullptr);
|
||||
channelSettings.setRadioAstronomySettings(nullptr);
|
||||
channelSettings.setRadioClockSettings(nullptr);
|
||||
channelSettings.setRadiosondeDemodSettings(nullptr);
|
||||
@ -5474,6 +5485,7 @@ void WebAPIRequestMapper::resetChannelReport(SWGSDRangel::SWGChannelReport& chan
|
||||
channelReport.setNoiseFigureReport(nullptr);
|
||||
channelReport.setIeee802154ModReport(nullptr);
|
||||
channelReport.setPacketModReport(nullptr);
|
||||
channelReport.setPsk31Report(nullptr);
|
||||
channelReport.setRadioAstronomyReport(nullptr);
|
||||
channelReport.setRadioClockReport(nullptr);
|
||||
channelReport.setRadiosondeDemodReport(nullptr);
|
||||
@ -5498,8 +5510,9 @@ void WebAPIRequestMapper::resetChannelActions(SWGSDRangel::SWGChannelActions& ch
|
||||
channelActions.setChannelType(nullptr);
|
||||
channelActions.setFileSourceActions(nullptr);
|
||||
channelActions.setIeee802154ModActions(nullptr);
|
||||
channelActions.setRadioAstronomyActions(nullptr);
|
||||
channelActions.setPacketModActions(nullptr);
|
||||
channelActions.setPsk31ModActions(nullptr);
|
||||
channelActions.setRadioAstronomyActions(nullptr);
|
||||
channelActions.setRttyModActions(nullptr);
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,7 @@ const QMap<QString, QString> WebAPIUtils::m_channelURIToSettingsKey = {
|
||||
{"sdrangel.channel.packetdemod", "PacketDemodSettings"},
|
||||
{"sdrangel.channel.pagerdemod", "PagerDemodSettings"},
|
||||
{"sdrangel.channeltx.modpacket", "PacketModSettings"},
|
||||
{"sdrangel.channel.psk31mod", "PSK31ModSettings"},
|
||||
{"sdrangel.channeltx.mod802.15.4", "IEEE_802_15_4_ModSettings"},
|
||||
{"sdrangel.channel.radioclock", "RadioClockSettings"},
|
||||
{"sdrangel.channel.radiosondedemod", "RadiosondeDemodSettings"},
|
||||
@ -178,6 +179,7 @@ const QMap<QString, QString> WebAPIUtils::m_channelTypeToSettingsKey = {
|
||||
{"PacketDemod", "PacketDemodSettings"},
|
||||
{"PacketMod", "PacketModSettings"},
|
||||
{"PagerDemod", "PagerDemodSettings"},
|
||||
{"PSK31Mod", "PSK31ModSettings"},
|
||||
{"LocalSink", "LocalSinkSettings"},
|
||||
{"LocalSource", "LocalSourceSettings"},
|
||||
{"RadioAstronomy", "RadioAstronomySettings"},
|
||||
@ -211,6 +213,7 @@ const QMap<QString, QString> WebAPIUtils::m_channelTypeToActionsKey = {
|
||||
{"IEEE_802_15_4_Mod", "IEEE_802_15_4_ModActions"},
|
||||
{"RadioAstronomy", "RadioAstronomyActions"},
|
||||
{"PacketMod", "PacketModActions"},
|
||||
{"PSK31Mod", "PSK31ModActions"},
|
||||
{"RTTYMod", "RTTYModActions"}
|
||||
};
|
||||
|
||||
|
@ -29,6 +29,8 @@ ChannelActions:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/IEEE_802_15_4_Mod.yaml#/IEEE_802_15_4_ModActions"
|
||||
PacketModActions:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/PacketMod.yaml#/PacketModActions"
|
||||
PSK31ModActions:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/PSK31Mod.yaml#/PSK31ModActions"
|
||||
RadioAstronomyActions:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/RadioAstronomy.yaml#/RadioAstronomyActions"
|
||||
RTTYModActions:
|
||||
|
@ -53,8 +53,6 @@ ChannelReport:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/FreqTracker.yaml#/FreqTrackerReport"
|
||||
FT8DemodReport:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/FT8Demod.yaml#/FT8DemodReport"
|
||||
RTTYDemodReport:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/RTTYDemod.yaml#/RTTYDemodReport"
|
||||
HeatMapReport:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/HeatMap.yaml#/HeatMapReport"
|
||||
ILSDemodReport:
|
||||
@ -81,6 +79,8 @@ ChannelReport:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/RadiosondeDemod.yaml#/RadiosondeDemodReport"
|
||||
RemoteSourceReport:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/RemoteSource.yaml#/RemoteSourceReport"
|
||||
RTTYDemodReport:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/RTTYDemod.yaml#/RTTYDemodReport"
|
||||
RTTYModReport:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/RTTYMod.yaml#/RTTYModReport"
|
||||
PacketDemodReport:
|
||||
@ -89,6 +89,8 @@ ChannelReport:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/PacketMod.yaml#/PacketModReport"
|
||||
PagerDemodReport:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/PagerDemod.yaml#/PagerDemodReport"
|
||||
PSK31ModReport:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/PSK31Mod.yaml#/PSK31ModReport"
|
||||
SigMFFileSinkReport:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/SigMFFileSink.yaml#/SigMFFileSinkReport"
|
||||
SSBModReport:
|
||||
|
@ -67,10 +67,6 @@ ChannelSettings:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/FreqTracker.yaml#/FreqTrackerSettings"
|
||||
FT8DemodSettings:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/FT8Demod.yaml#/FT8DemodSettings"
|
||||
RTTYDemodSettings:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/RTTYDemod.yaml#/RTTYDemodSettings"
|
||||
RTTYModSettings:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/RTTYMod.yaml#/RTTYModSettings"
|
||||
HeatMapSettings:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/HeatMap.yaml#/HeatMapSettings"
|
||||
ILSDemodSettings:
|
||||
@ -101,6 +97,8 @@ ChannelSettings:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/PacketMod.yaml#/PacketModSettings"
|
||||
PagerDemodSettings:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/PagerDemod.yaml#/PagerDemodSettings"
|
||||
PSK31ModSettings:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/PSK31Mod.yaml#/PSK31ModSettings"
|
||||
RadioAstronomySettings:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/RadioAstronomy.yaml#/RadioAstronomySettings"
|
||||
RadioClockSettings:
|
||||
@ -113,6 +111,10 @@ ChannelSettings:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/RemoteSource.yaml#/RemoteSourceSettings"
|
||||
RemoteTCPSinkSettings:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/RemoteTCPSink.yaml#/RemoteTCPSinkSettings"
|
||||
RTTYDemodSettings:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/RTTYDemod.yaml#/RTTYDemodSettings"
|
||||
RTTYModSettings:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/RTTYMod.yaml#/RTTYModSettings"
|
||||
SigMFFileSinkSettings:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/SigMFFileSink.yaml#/SigMFFileSinkSettings"
|
||||
SSBModSettings:
|
||||
|
99
swagger/sdrangel/api/swagger/include/PSK31Mod.yaml
Normal file
99
swagger/sdrangel/api/swagger/include/PSK31Mod.yaml
Normal file
@ -0,0 +1,99 @@
|
||||
PSK31ModSettings:
|
||||
description: PSK31Mod
|
||||
properties:
|
||||
inputFrequencyOffset:
|
||||
type: integer
|
||||
format: int64
|
||||
rfBandwidth:
|
||||
type: integer
|
||||
gain:
|
||||
type: number
|
||||
format: float
|
||||
channelMute:
|
||||
type: integer
|
||||
repeat:
|
||||
type: integer
|
||||
repeatCount:
|
||||
type: integer
|
||||
lpfTaps:
|
||||
type: integer
|
||||
rfNoise:
|
||||
type: integer
|
||||
description: >
|
||||
Boolean
|
||||
* 0 - off
|
||||
* 1 - on
|
||||
text:
|
||||
type: string
|
||||
description: Text to transmit
|
||||
pulseShaping:
|
||||
type: integer
|
||||
description: >
|
||||
Boolean
|
||||
* 0 - off
|
||||
* 1 - on
|
||||
beta:
|
||||
type: number
|
||||
format: float
|
||||
symbolSpan:
|
||||
type: integer
|
||||
prefixCRLF:
|
||||
type: integer
|
||||
postfixCRLF:
|
||||
type: integer
|
||||
udpEnabled:
|
||||
description: "Whether to receive text to transmit on specified UDP port"
|
||||
type: integer
|
||||
udpAddress:
|
||||
description: "UDP address to receive text to transmit via"
|
||||
type: string
|
||||
udpPort:
|
||||
description: "UDP port to receive text to transmit via"
|
||||
type: integer
|
||||
rgbColor:
|
||||
type: integer
|
||||
title:
|
||||
type: string
|
||||
streamIndex:
|
||||
description: MIMO channel. Not relevant when connected to SI (single Rx).
|
||||
type: integer
|
||||
useReverseAPI:
|
||||
description: Synchronize with reverse API (1 for yes, 0 for no)
|
||||
type: integer
|
||||
reverseAPIAddress:
|
||||
type: string
|
||||
reverseAPIPort:
|
||||
type: integer
|
||||
reverseAPIDeviceIndex:
|
||||
type: integer
|
||||
reverseAPIChannelIndex:
|
||||
type: integer
|
||||
channelMarker:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/ChannelMarker.yaml#/ChannelMarker"
|
||||
rollupState:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/RollupState.yaml#/RollupState"
|
||||
|
||||
PSK31ModReport:
|
||||
description: PSK31Mod
|
||||
properties:
|
||||
channelPowerDB:
|
||||
description: power transmitted in channel (dB)
|
||||
type: number
|
||||
format: float
|
||||
channelSampleRate:
|
||||
type: integer
|
||||
|
||||
PSK31ModActions:
|
||||
description: PSK31Mod
|
||||
properties:
|
||||
tx:
|
||||
type: integer
|
||||
description: >
|
||||
Transmit current text
|
||||
* 0 - Do nothing
|
||||
* 1 - Transmit
|
||||
payload:
|
||||
type: object
|
||||
properties:
|
||||
text:
|
||||
type: string
|
Loading…
Reference in New Issue
Block a user