mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-07-31 05:02:24 -04:00
UDPSink plugin: basic framework
This commit is contained in:
parent
30761a6145
commit
0288044ab3
@ -15,11 +15,11 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "../../channelrx/udpsrc/udpsrcgui.h"
|
#include "udpsrcgui.h"
|
||||||
|
|
||||||
#include <device/devicesourceapi.h>
|
#include "device/devicesourceapi.h"
|
||||||
#include <dsp/downchannelizer.h>
|
#include "dsp/downchannelizer.h"
|
||||||
#include "../../../sdrbase/dsp/threadedbasebandsamplesink.h"
|
#include "dsp/threadedbasebandsamplesink.h"
|
||||||
#include "plugin/pluginapi.h"
|
#include "plugin/pluginapi.h"
|
||||||
#include "dsp/spectrumvis.h"
|
#include "dsp/spectrumvis.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "dsp/channelmarker.h"
|
#include "dsp/channelmarker.h"
|
||||||
#include "dsp/movingaverage.h"
|
#include "dsp/movingaverage.h"
|
||||||
|
|
||||||
#include "../../channelrx/udpsrc/udpsrc.h"
|
#include "udpsrc.h"
|
||||||
|
|
||||||
class PluginAPI;
|
class PluginAPI;
|
||||||
class DeviceSourceAPI;
|
class DeviceSourceAPI;
|
||||||
|
@ -6,6 +6,7 @@ add_subdirectory(modam)
|
|||||||
add_subdirectory(modnfm)
|
add_subdirectory(modnfm)
|
||||||
add_subdirectory(modssb)
|
add_subdirectory(modssb)
|
||||||
add_subdirectory(modwfm)
|
add_subdirectory(modwfm)
|
||||||
|
add_subdirectory(udpsink)
|
||||||
|
|
||||||
if (OpenCV_FOUND)
|
if (OpenCV_FOUND)
|
||||||
add_subdirectory(modatv)
|
add_subdirectory(modatv)
|
||||||
|
44
plugins/channeltx/udpsink/CMakeLists.txt
Normal file
44
plugins/channeltx/udpsink/CMakeLists.txt
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
project(udpsink)
|
||||||
|
|
||||||
|
set(udpsink_SOURCES
|
||||||
|
udpsink.cpp
|
||||||
|
udpsinkgui.cpp
|
||||||
|
udpsinkplugin.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set(udpsink_HEADERS
|
||||||
|
udpsink.h
|
||||||
|
udpsinkgui.h
|
||||||
|
udpsinkplugin.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set(udpsink_FORMS
|
||||||
|
udpsinkgui.ui
|
||||||
|
)
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
.
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
#include(${QT_USE_FILE})
|
||||||
|
add_definitions(${QT_DEFINITIONS})
|
||||||
|
add_definitions(-DQT_PLUGIN)
|
||||||
|
add_definitions(-DQT_SHARED)
|
||||||
|
|
||||||
|
qt5_wrap_ui(udpsink_FORMS_HEADERS ${udpsink_FORMS})
|
||||||
|
|
||||||
|
add_library(modudpsink SHARED
|
||||||
|
${udpsink_SOURCES}
|
||||||
|
${udpsink_HEADERS_MOC}
|
||||||
|
${udpsink_FORMS_HEADERS}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(modudpsink
|
||||||
|
${QT_LIBRARIES}
|
||||||
|
sdrbase
|
||||||
|
)
|
||||||
|
|
||||||
|
qt5_use_modules(modudpsink Core Widgets Network)
|
||||||
|
|
||||||
|
install(TARGETS modudpsink DESTINATION lib/plugins/channeltx)
|
112
plugins/channeltx/udpsink/udpsink.cpp
Normal file
112
plugins/channeltx/udpsink/udpsink.cpp
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2017 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// //
|
||||||
|
// 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 "udpsink.h"
|
||||||
|
|
||||||
|
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkConfigure, Message)
|
||||||
|
|
||||||
|
UDPSink::UDPSink(MessageQueue* uiMessageQueue, UDPSinkGUI* udpSinkGUI, BasebandSampleSink* spectrum) :
|
||||||
|
m_uiMessageQueue(uiMessageQueue),
|
||||||
|
m_udpSinkGUI(udpSinkGUI),
|
||||||
|
m_spectrum(spectrum),
|
||||||
|
m_settingsMutex(QMutex::Recursive)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
UDPSink::~UDPSink()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSink::start()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSink::stop()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSink::pull(Sample& sample)
|
||||||
|
{
|
||||||
|
sample.m_real = 0.0f;
|
||||||
|
sample.m_imag = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UDPSink::handleMessage(const Message& cmd)
|
||||||
|
{
|
||||||
|
qDebug() << "UDPSink::handleMessage";
|
||||||
|
|
||||||
|
if (UpChannelizer::MsgChannelizerNotification::match(cmd))
|
||||||
|
{
|
||||||
|
UpChannelizer::MsgChannelizerNotification& notif = (UpChannelizer::MsgChannelizerNotification&) cmd;
|
||||||
|
|
||||||
|
m_settingsMutex.lock();
|
||||||
|
|
||||||
|
m_config.m_basebandSampleRate = notif.getBasebandSampleRate();
|
||||||
|
m_config.m_outputSampleRate = notif.getSampleRate();
|
||||||
|
m_config.m_inputFrequencyOffset = notif.getFrequencyOffset();
|
||||||
|
|
||||||
|
m_settingsMutex.unlock();
|
||||||
|
|
||||||
|
qDebug() << "UDPSink::handleMessage: MsgChannelizerNotification:"
|
||||||
|
<< " m_basebandSampleRate: " << m_config.m_basebandSampleRate
|
||||||
|
<< " m_outputSampleRate: " << m_config.m_outputSampleRate
|
||||||
|
<< " m_inputFrequencyOffset: " << m_config.m_inputFrequencyOffset;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (MsgUDPSinkConfigure::match(cmd))
|
||||||
|
{
|
||||||
|
MsgUDPSinkConfigure& cfg = (MsgUDPSinkConfigure&) cmd;
|
||||||
|
|
||||||
|
m_settingsMutex.lock();
|
||||||
|
|
||||||
|
m_config.m_sampleFormat = cfg.getSampleFormat();
|
||||||
|
m_config.m_inputSampleRate = cfg.getInputSampleRate();
|
||||||
|
m_config.m_rfBandwidth = cfg.getRFBandwidth();
|
||||||
|
m_config.m_fmDeviation = cfg.getFMDeviation();
|
||||||
|
m_config.m_udpAddressStr = cfg.getUDPAddress();
|
||||||
|
m_config.m_udpPort = cfg.getUDPPort();
|
||||||
|
|
||||||
|
m_settingsMutex.unlock();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSink::configure(MessageQueue* messageQueue,
|
||||||
|
SampleFormat sampleFormat,
|
||||||
|
Real outputSampleRate,
|
||||||
|
Real rfBandwidth,
|
||||||
|
int fmDeviation,
|
||||||
|
QString& udpAddress,
|
||||||
|
int udpPort)
|
||||||
|
{
|
||||||
|
Message* cmd = MsgUDPSinkConfigure::create(sampleFormat,
|
||||||
|
outputSampleRate,
|
||||||
|
rfBandwidth,
|
||||||
|
fmDeviation,
|
||||||
|
udpAddress,
|
||||||
|
udpPort);
|
||||||
|
messageQueue->push(cmd);
|
||||||
|
}
|
||||||
|
|
150
plugins/channeltx/udpsink/udpsink.h
Normal file
150
plugins/channeltx/udpsink/udpsink.h
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2017 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// //
|
||||||
|
// 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_UDPSINK_UDPSINK_H_
|
||||||
|
#define PLUGINS_CHANNELTX_UDPSINK_UDPSINK_H_
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
#include "dsp/basebandsamplesource.h"
|
||||||
|
#include "dsp/basebandsamplesink.h"
|
||||||
|
#include "util/message.h"
|
||||||
|
|
||||||
|
class UDPSinkGUI;
|
||||||
|
|
||||||
|
class UDPSink : public BasebandSampleSource {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum SampleFormat {
|
||||||
|
FormatS16LE,
|
||||||
|
FormatNFM,
|
||||||
|
FormatNFMMono,
|
||||||
|
FormatLSB,
|
||||||
|
FormatUSB,
|
||||||
|
FormatLSBMono,
|
||||||
|
FormatUSBMono,
|
||||||
|
FormatAMMono,
|
||||||
|
FormatNone
|
||||||
|
};
|
||||||
|
|
||||||
|
UDPSink(MessageQueue* uiMessageQueue, UDPSinkGUI* udpSinkGUI, BasebandSampleSink* spectrum);
|
||||||
|
virtual ~UDPSink();
|
||||||
|
|
||||||
|
virtual void start();
|
||||||
|
virtual void stop();
|
||||||
|
virtual void pull(Sample& sample);
|
||||||
|
virtual bool handleMessage(const Message& cmd);
|
||||||
|
|
||||||
|
void configure(MessageQueue* messageQueue,
|
||||||
|
SampleFormat sampleFormat,
|
||||||
|
Real inputSampleRate,
|
||||||
|
Real rfBandwidth,
|
||||||
|
int fmDeviation,
|
||||||
|
QString& udpAddress,
|
||||||
|
int udpPort);
|
||||||
|
|
||||||
|
private:
|
||||||
|
class MsgUDPSinkConfigure : public Message {
|
||||||
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
|
public:
|
||||||
|
SampleFormat getSampleFormat() const { return m_sampleFormat; }
|
||||||
|
Real getInputSampleRate() const { return m_inputSampleRate; }
|
||||||
|
Real getRFBandwidth() const { return m_rfBandwidth; }
|
||||||
|
int getFMDeviation() const { return m_fmDeviation; }
|
||||||
|
const QString& getUDPAddress() const { return m_udpAddress; }
|
||||||
|
int getUDPPort() const { return m_udpPort; }
|
||||||
|
|
||||||
|
static MsgUDPSinkConfigure* create(SampleFormat
|
||||||
|
sampleFormat,
|
||||||
|
Real inputSampleRate,
|
||||||
|
Real rfBandwidth,
|
||||||
|
int fmDeviation,
|
||||||
|
QString& udpAddress,
|
||||||
|
int udpPort)
|
||||||
|
{
|
||||||
|
return new MsgUDPSinkConfigure(sampleFormat,
|
||||||
|
inputSampleRate,
|
||||||
|
rfBandwidth,
|
||||||
|
fmDeviation,
|
||||||
|
udpAddress,
|
||||||
|
udpPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
SampleFormat m_sampleFormat;
|
||||||
|
Real m_inputSampleRate;
|
||||||
|
Real m_rfBandwidth;
|
||||||
|
int m_fmDeviation;
|
||||||
|
QString m_udpAddress;
|
||||||
|
int m_udpPort;
|
||||||
|
|
||||||
|
MsgUDPSinkConfigure(SampleFormat sampleFormat,
|
||||||
|
Real inputSampleRate,
|
||||||
|
Real rfBandwidth,
|
||||||
|
int fmDeviation,
|
||||||
|
QString& udpAddress,
|
||||||
|
int udpPort) :
|
||||||
|
Message(),
|
||||||
|
m_sampleFormat(sampleFormat),
|
||||||
|
m_inputSampleRate(inputSampleRate),
|
||||||
|
m_rfBandwidth(rfBandwidth),
|
||||||
|
m_fmDeviation(fmDeviation),
|
||||||
|
m_udpAddress(udpAddress),
|
||||||
|
m_udpPort(udpPort)
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Config {
|
||||||
|
int m_basebandSampleRate;
|
||||||
|
Real m_outputSampleRate;
|
||||||
|
int m_sampleFormat;
|
||||||
|
Real m_inputSampleRate;
|
||||||
|
qint64 m_inputFrequencyOffset;
|
||||||
|
Real m_rfBandwidth;
|
||||||
|
int m_fmDeviation;
|
||||||
|
|
||||||
|
QString m_udpAddressStr;
|
||||||
|
quint16 m_udpPort;
|
||||||
|
|
||||||
|
Config() :
|
||||||
|
m_basebandSampleRate(0),
|
||||||
|
m_outputSampleRate(0),
|
||||||
|
m_sampleFormat(0),
|
||||||
|
m_inputSampleRate(0),
|
||||||
|
m_inputFrequencyOffset(0),
|
||||||
|
m_rfBandwidth(0),
|
||||||
|
m_fmDeviation(0),
|
||||||
|
m_udpAddressStr("127.0.0.1"),
|
||||||
|
m_udpPort(9999)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
Config m_config;
|
||||||
|
Config m_running;
|
||||||
|
|
||||||
|
MessageQueue* m_uiMessageQueue;
|
||||||
|
UDPSinkGUI* m_udpSinkGUI;
|
||||||
|
BasebandSampleSink* m_spectrum;
|
||||||
|
|
||||||
|
QMutex m_settingsMutex;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* PLUGINS_CHANNELTX_UDPSINK_UDPSINK_H_ */
|
375
plugins/channeltx/udpsink/udpsinkgui.cpp
Normal file
375
plugins/channeltx/udpsink/udpsinkgui.cpp
Normal file
@ -0,0 +1,375 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2017 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "device/devicesinkapi.h"
|
||||||
|
#include "dsp/upchannelizer.h"
|
||||||
|
#include "dsp/threadedbasebandsamplesource.h"
|
||||||
|
#include "dsp/spectrumvis.h"
|
||||||
|
#include "plugin/pluginapi.h"
|
||||||
|
#include "util/simpleserializer.h"
|
||||||
|
#include "dsp/dspengine.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#include "udpsinkgui.h"
|
||||||
|
#include "ui_udpsinkgui.h"
|
||||||
|
|
||||||
|
const QString UDPSinkGUI::m_channelID = "sdrangel.channeltx.udpsink";
|
||||||
|
|
||||||
|
UDPSinkGUI* UDPSinkGUI::create(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI)
|
||||||
|
{
|
||||||
|
UDPSinkGUI* gui = new UDPSinkGUI(pluginAPI, deviceAPI);
|
||||||
|
return gui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::destroy()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::setName(const QString& name)
|
||||||
|
{
|
||||||
|
setObjectName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString UDPSinkGUI::getName() const
|
||||||
|
{
|
||||||
|
return objectName();
|
||||||
|
}
|
||||||
|
|
||||||
|
qint64 UDPSinkGUI::getCenterFrequency() const {
|
||||||
|
return m_channelMarker.getCenterFrequency();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::setCenterFrequency(qint64 centerFrequency)
|
||||||
|
{
|
||||||
|
m_channelMarker.setCenterFrequency(centerFrequency);
|
||||||
|
applySettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::resetToDefaults()
|
||||||
|
{
|
||||||
|
blockApplySettings(true);
|
||||||
|
|
||||||
|
ui->sampleFormat->setCurrentIndex(0);
|
||||||
|
ui->sampleRate->setText("48000");
|
||||||
|
ui->rfBandwidth->setText("32000");
|
||||||
|
ui->fmDeviation->setText("2500");
|
||||||
|
ui->udpAddress->setText("127.0.0.1");
|
||||||
|
ui->udpPort->setText("9999");
|
||||||
|
ui->spectrumGUI->resetToDefaults();
|
||||||
|
ui->volume->setValue(20);
|
||||||
|
|
||||||
|
blockApplySettings(false);
|
||||||
|
applySettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray UDPSinkGUI::serialize() const
|
||||||
|
{
|
||||||
|
SimpleSerializer s(1);
|
||||||
|
s.writeBlob(1, saveState());
|
||||||
|
s.writeS32(2, m_channelMarker.getCenterFrequency());
|
||||||
|
s.writeS32(3, m_sampleFormat);
|
||||||
|
s.writeReal(4, m_inputSampleRate);
|
||||||
|
s.writeReal(5, m_rfBandwidth);
|
||||||
|
s.writeS32(6, m_udpPort);
|
||||||
|
s.writeBlob(7, ui->spectrumGUI->serialize());
|
||||||
|
s.writeS32(8, m_channelMarker.getCenterFrequency());
|
||||||
|
s.writeString(9, m_udpAddress);
|
||||||
|
s.writeS32(10, (qint32)m_volume);
|
||||||
|
s.writeS32(11, m_fmDeviation);
|
||||||
|
return s.final();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UDPSinkGUI::deserialize(const QByteArray& data)
|
||||||
|
{
|
||||||
|
SimpleDeserializer d(data);
|
||||||
|
|
||||||
|
if (!d.isValid())
|
||||||
|
{
|
||||||
|
resetToDefaults();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d.getVersion() == 1)
|
||||||
|
{
|
||||||
|
QByteArray bytetmp;
|
||||||
|
QString strtmp;
|
||||||
|
qint32 s32tmp;
|
||||||
|
Real realtmp;
|
||||||
|
|
||||||
|
blockApplySettings(true);
|
||||||
|
m_channelMarker.blockSignals(true);
|
||||||
|
|
||||||
|
d.readBlob(1, &bytetmp);
|
||||||
|
restoreState(bytetmp);
|
||||||
|
d.readS32(2, &s32tmp, 0);
|
||||||
|
m_channelMarker.setCenterFrequency(s32tmp);
|
||||||
|
d.readS32(3, &s32tmp, UDPSink::FormatS16LE);
|
||||||
|
switch(s32tmp) {
|
||||||
|
case UDPSink::FormatS16LE:
|
||||||
|
ui->sampleFormat->setCurrentIndex(0);
|
||||||
|
break;
|
||||||
|
case UDPSink::FormatNFM:
|
||||||
|
ui->sampleFormat->setCurrentIndex(1);
|
||||||
|
break;
|
||||||
|
case UDPSink::FormatNFMMono:
|
||||||
|
ui->sampleFormat->setCurrentIndex(2);
|
||||||
|
break;
|
||||||
|
case UDPSink::FormatLSB:
|
||||||
|
ui->sampleFormat->setCurrentIndex(3);
|
||||||
|
break;
|
||||||
|
case UDPSink::FormatUSB:
|
||||||
|
ui->sampleFormat->setCurrentIndex(4);
|
||||||
|
break;
|
||||||
|
case UDPSink::FormatLSBMono:
|
||||||
|
ui->sampleFormat->setCurrentIndex(5);
|
||||||
|
break;
|
||||||
|
case UDPSink::FormatUSBMono:
|
||||||
|
ui->sampleFormat->setCurrentIndex(6);
|
||||||
|
break;
|
||||||
|
case UDPSink::FormatAMMono:
|
||||||
|
ui->sampleFormat->setCurrentIndex(7);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ui->sampleFormat->setCurrentIndex(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
d.readReal(4, &realtmp, 48000);
|
||||||
|
ui->sampleRate->setText(QString("%1").arg(realtmp, 0));
|
||||||
|
d.readReal(5, &realtmp, 32000);
|
||||||
|
ui->rfBandwidth->setText(QString("%1").arg(realtmp, 0));
|
||||||
|
d.readS32(6, &s32tmp, 9999);
|
||||||
|
ui->udpPort->setText(QString("%1").arg(s32tmp));
|
||||||
|
d.readBlob(7, &bytetmp);
|
||||||
|
ui->spectrumGUI->deserialize(bytetmp);
|
||||||
|
d.readS32(8, &s32tmp, 0);
|
||||||
|
m_channelMarker.setCenterFrequency(s32tmp);
|
||||||
|
d.readString(9, &strtmp, "127.0.0.1");
|
||||||
|
ui->udpAddress->setText(strtmp);
|
||||||
|
d.readS32(10, &s32tmp, 20);
|
||||||
|
ui->volume->setValue(s32tmp);
|
||||||
|
d.readS32(11, &s32tmp, 2500);
|
||||||
|
ui->fmDeviation->setText(QString("%1").arg(s32tmp));
|
||||||
|
|
||||||
|
blockApplySettings(false);
|
||||||
|
m_channelMarker.blockSignals(false);
|
||||||
|
|
||||||
|
applySettings();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resetToDefaults();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UDPSinkGUI::handleMessage(const Message& message __attribute__((unused)))
|
||||||
|
{
|
||||||
|
qDebug() << "UDPSinkGUI::handleMessage";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::handleSourceMessages()
|
||||||
|
{
|
||||||
|
Message* message;
|
||||||
|
|
||||||
|
while ((message = m_udpSink->getOutputMessageQueue()->pop()) != 0)
|
||||||
|
{
|
||||||
|
if (handleMessage(*message))
|
||||||
|
{
|
||||||
|
delete message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* parent) :
|
||||||
|
RollupWidget(parent),
|
||||||
|
ui(new Ui::UDPSinkGUI),
|
||||||
|
m_pluginAPI(pluginAPI),
|
||||||
|
m_deviceAPI(deviceAPI),
|
||||||
|
m_channelMarker(this),
|
||||||
|
m_doApplySettings(true)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||||
|
connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked()));
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
|
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
|
||||||
|
m_udpSink = new UDPSink(m_pluginAPI->getMainWindowMessageQueue(), this, m_spectrumVis);
|
||||||
|
m_channelizer = new UpChannelizer(m_udpSink);
|
||||||
|
m_threadedChannelizer = new ThreadedBasebandSampleSource(m_channelizer, this);
|
||||||
|
m_deviceAPI->addThreadedSource(m_threadedChannelizer);
|
||||||
|
|
||||||
|
ui->fmDeviation->setEnabled(false);
|
||||||
|
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
|
||||||
|
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||||
|
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
|
||||||
|
|
||||||
|
ui->glSpectrum->setCenterFrequency(0);
|
||||||
|
ui->glSpectrum->setSampleRate(ui->sampleRate->text().toInt());
|
||||||
|
ui->glSpectrum->setDisplayWaterfall(true);
|
||||||
|
ui->glSpectrum->setDisplayMaxHold(true);
|
||||||
|
m_spectrumVis->configure(m_spectrumVis->getInputMessageQueue(), 64, 10, FFTWindow::BlackmanHarris);
|
||||||
|
|
||||||
|
ui->glSpectrum->connectTimer(m_pluginAPI->getMainWindow()->getMasterTimer());
|
||||||
|
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
||||||
|
|
||||||
|
//m_channelMarker = new ChannelMarker(this);
|
||||||
|
m_channelMarker.setBandwidth(16000);
|
||||||
|
m_channelMarker.setCenterFrequency(0);
|
||||||
|
m_channelMarker.setColor(Qt::green);
|
||||||
|
m_channelMarker.setVisible(true);
|
||||||
|
|
||||||
|
connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged()));
|
||||||
|
|
||||||
|
m_deviceAPI->registerChannelInstance(m_channelID, this);
|
||||||
|
m_deviceAPI->addChannelMarker(&m_channelMarker);
|
||||||
|
m_deviceAPI->addRollupWidget(this);
|
||||||
|
|
||||||
|
applySettings();
|
||||||
|
|
||||||
|
connect(m_udpSink->getOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
||||||
|
}
|
||||||
|
|
||||||
|
UDPSinkGUI::~UDPSinkGUI()
|
||||||
|
{
|
||||||
|
m_deviceAPI->removeChannelInstance(this);
|
||||||
|
m_deviceAPI->removeThreadedSource(m_threadedChannelizer);
|
||||||
|
delete m_threadedChannelizer;
|
||||||
|
delete m_channelizer;
|
||||||
|
delete m_udpSink;
|
||||||
|
delete m_spectrumVis;
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::blockApplySettings(bool block)
|
||||||
|
{
|
||||||
|
m_doApplySettings = !block;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::applySettings()
|
||||||
|
{
|
||||||
|
if (m_doApplySettings)
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
|
||||||
|
Real inputSampleRate = ui->sampleRate->text().toDouble(&ok);
|
||||||
|
|
||||||
|
if((!ok) || (inputSampleRate < 1000))
|
||||||
|
{
|
||||||
|
inputSampleRate = 48000;
|
||||||
|
}
|
||||||
|
|
||||||
|
Real rfBandwidth = ui->rfBandwidth->text().toDouble(&ok);
|
||||||
|
|
||||||
|
if((!ok) || (rfBandwidth > inputSampleRate))
|
||||||
|
{
|
||||||
|
rfBandwidth = inputSampleRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_udpAddress = ui->udpAddress->text();
|
||||||
|
|
||||||
|
int udpPort = ui->udpPort->text().toInt(&ok);
|
||||||
|
|
||||||
|
if((!ok) || (udpPort < 1024) || (udpPort > 65535))
|
||||||
|
{
|
||||||
|
udpPort = 9999;
|
||||||
|
}
|
||||||
|
|
||||||
|
int fmDeviation = ui->fmDeviation->text().toInt(&ok);
|
||||||
|
|
||||||
|
if ((!ok) || (fmDeviation < 1))
|
||||||
|
{
|
||||||
|
fmDeviation = 2500;
|
||||||
|
}
|
||||||
|
|
||||||
|
setTitleColor(m_channelMarker.getColor());
|
||||||
|
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
||||||
|
ui->sampleRate->setText(QString("%1").arg(inputSampleRate, 0));
|
||||||
|
ui->rfBandwidth->setText(QString("%1").arg(rfBandwidth, 0));
|
||||||
|
//ui->udpAddress->setText(m_udpAddress);
|
||||||
|
ui->udpPort->setText(QString("%1").arg(udpPort));
|
||||||
|
ui->fmDeviation->setText(QString("%1").arg(fmDeviation));
|
||||||
|
m_channelMarker.disconnect(this, SLOT(channelMarkerChanged()));
|
||||||
|
m_channelMarker.setBandwidth((int)rfBandwidth);
|
||||||
|
connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged()));
|
||||||
|
ui->glSpectrum->setSampleRate(inputSampleRate);
|
||||||
|
|
||||||
|
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
|
||||||
|
inputSampleRate,
|
||||||
|
m_channelMarker.getCenterFrequency());
|
||||||
|
|
||||||
|
UDPSink::SampleFormat sampleFormat;
|
||||||
|
|
||||||
|
switch(ui->sampleFormat->currentIndex())
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
sampleFormat = UDPSink::FormatS16LE;
|
||||||
|
ui->fmDeviation->setEnabled(false);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
sampleFormat = UDPSink::FormatNFM;
|
||||||
|
ui->fmDeviation->setEnabled(true);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
sampleFormat = UDPSink::FormatNFMMono;
|
||||||
|
ui->fmDeviation->setEnabled(true);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
sampleFormat = UDPSink::FormatLSB;
|
||||||
|
ui->fmDeviation->setEnabled(false);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
sampleFormat = UDPSink::FormatUSB;
|
||||||
|
ui->fmDeviation->setEnabled(false);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
sampleFormat = UDPSink::FormatLSBMono;
|
||||||
|
ui->fmDeviation->setEnabled(false);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
sampleFormat = UDPSink::FormatUSBMono;
|
||||||
|
ui->fmDeviation->setEnabled(false);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
sampleFormat = UDPSink::FormatAMMono;
|
||||||
|
ui->fmDeviation->setEnabled(false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sampleFormat = UDPSink::FormatS16LE;
|
||||||
|
ui->fmDeviation->setEnabled(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sampleFormat = sampleFormat;
|
||||||
|
m_inputSampleRate = inputSampleRate;
|
||||||
|
m_rfBandwidth = rfBandwidth;
|
||||||
|
m_fmDeviation = fmDeviation;
|
||||||
|
m_udpPort = udpPort;
|
||||||
|
|
||||||
|
m_udpSink->configure(m_udpSink->getInputMessageQueue(),
|
||||||
|
sampleFormat,
|
||||||
|
inputSampleRate,
|
||||||
|
rfBandwidth,
|
||||||
|
fmDeviation,
|
||||||
|
m_udpAddress,
|
||||||
|
udpPort);
|
||||||
|
|
||||||
|
ui->applyBtn->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
87
plugins/channeltx/udpsink/udpsinkgui.h
Normal file
87
plugins/channeltx/udpsink/udpsinkgui.h
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2017 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// //
|
||||||
|
// 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_UDPSINK_UDPSINKGUI_H_
|
||||||
|
#define PLUGINS_CHANNELTX_UDPSINK_UDPSINKGUI_H_
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
#include "gui/rollupwidget.h"
|
||||||
|
#include "plugin/plugingui.h"
|
||||||
|
#include "dsp/channelmarker.h"
|
||||||
|
|
||||||
|
#include "udpsink.h"
|
||||||
|
|
||||||
|
class PluginAPI;
|
||||||
|
class DeviceSinkAPI;
|
||||||
|
class ThreadedBasebandSampleSource;
|
||||||
|
class UpChannelizer;
|
||||||
|
class UDPSink;
|
||||||
|
class SpectrumVis;
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class UDPSinkGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
class UDPSinkGUI : public RollupWidget, public PluginGUI {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
static UDPSinkGUI* create(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI);
|
||||||
|
void destroy();
|
||||||
|
|
||||||
|
void setName(const QString& name);
|
||||||
|
QString getName() const;
|
||||||
|
virtual qint64 getCenterFrequency() const;
|
||||||
|
virtual void setCenterFrequency(qint64 centerFrequency);
|
||||||
|
virtual void resetToDefaults();
|
||||||
|
virtual QByteArray serialize() const;
|
||||||
|
virtual bool deserialize(const QByteArray& data);
|
||||||
|
virtual bool handleMessage(const Message& message);
|
||||||
|
|
||||||
|
static const QString m_channelID;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void handleSourceMessages();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::UDPSinkGUI* ui;
|
||||||
|
PluginAPI* m_pluginAPI;
|
||||||
|
DeviceSinkAPI* m_deviceAPI;
|
||||||
|
ThreadedBasebandSampleSource* m_threadedChannelizer;
|
||||||
|
UpChannelizer* m_channelizer;
|
||||||
|
SpectrumVis* m_spectrumVis;
|
||||||
|
UDPSink* m_udpSink;
|
||||||
|
ChannelMarker m_channelMarker;
|
||||||
|
|
||||||
|
// settings
|
||||||
|
UDPSink::SampleFormat m_sampleFormat;
|
||||||
|
Real m_inputSampleRate;
|
||||||
|
Real m_rfBandwidth;
|
||||||
|
int m_fmDeviation;
|
||||||
|
int m_volume;
|
||||||
|
QString m_udpAddress;
|
||||||
|
int m_udpPort;
|
||||||
|
bool m_doApplySettings;
|
||||||
|
|
||||||
|
explicit UDPSinkGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* parent = NULL);
|
||||||
|
virtual ~UDPSinkGUI();
|
||||||
|
|
||||||
|
void blockApplySettings(bool block);
|
||||||
|
void applySettings();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* PLUGINS_CHANNELTX_UDPSINK_UDPSINKGUI_H_ */
|
522
plugins/channeltx/udpsink/udpsinkgui.ui
Normal file
522
plugins/channeltx/udpsink/udpsinkgui.ui
Normal file
@ -0,0 +1,522 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>UDPSinkGUI</class>
|
||||||
|
<widget class="RollupWidget" name="UDPSinkGUI">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>316</width>
|
||||||
|
<height>355</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>316</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Sans Serif</family>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>UDP Sample Source</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="widget" native="true">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>2</x>
|
||||||
|
<y>2</y>
|
||||||
|
<width>312</width>
|
||||||
|
<height>142</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>312</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<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>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Format</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QComboBox" name="sampleFormat">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Samples format</string>
|
||||||
|
</property>
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>S16LE I/Q</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>S16LE NFM</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>S16LE NFM Mono</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>S16LE LSB</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>S16LE USB</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>S16LE LSB Mono</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>S16LE USB Mono</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>S16LE AM Mono</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<layout class="QHBoxLayout" name="ChannelPowerLayout">
|
||||||
|
<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="toolTip">
|
||||||
|
<string>Channel power</string>
|
||||||
|
</property>
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0.0</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="channelPowerUnits">
|
||||||
|
<property name="text">
|
||||||
|
<string> dB</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Rate (Hz)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="2">
|
||||||
|
<layout class="QHBoxLayout" name="BoostLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="applyBtn">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Apply text input and/or samples format</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Apply</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="DeltaFrequencyLayout">
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="deltaFrequencyLabel">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>16777215</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>DejaVu Sans 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="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="Text">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>26</red>
|
||||||
|
<green>26</green>
|
||||||
|
<blue>26</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
<colorrole role="BrightText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="Text">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>26</red>
|
||||||
|
<green>26</green>
|
||||||
|
<blue>26</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
<colorrole role="BrightText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="Text">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>118</red>
|
||||||
|
<green>118</green>
|
||||||
|
<blue>117</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
<colorrole role="BrightText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>8</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string> Hz</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="PortLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="fmDevLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>FMd (Hz)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="fmDeviation">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>FM deviation in Hz (for S16LE NFM format)</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>2500</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="2">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>RF BW (Hz)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="2">
|
||||||
|
<widget class="QLineEdit" name="rfBandwidth">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Signal bandwidth</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>32000</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="AudioPortLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="volumeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Vol</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSlider" name="volume">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Audio volume</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="pageStep">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>20</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="volumeText">
|
||||||
|
<property name="text">
|
||||||
|
<string>20</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QLineEdit" name="sampleRate">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Samples rate</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>48000</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="AddressLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="Addresslabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Addr</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="udpAddress">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Remote address</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="udpPortlabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>D</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="udpPort">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Remote data port</string>
|
||||||
|
</property>
|
||||||
|
<property name="inputMask">
|
||||||
|
<string>00000</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>9999</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="spectrumBox" native="true">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>15</x>
|
||||||
|
<y>160</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>156</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Channel Spectrum</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<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>
|
||||||
|
<widget class="GLSpectrum" name="glSpectrum" native="true">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Sans Serif</family>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="GLSpectrumGUI" name="spectrumGUI" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>RollupWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/rollupwidget.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>
|
||||||
|
</customwidgets>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>sampleRate</tabstop>
|
||||||
|
<tabstop>rfBandwidth</tabstop>
|
||||||
|
</tabstops>
|
||||||
|
<resources>
|
||||||
|
<include location="../../../sdrbase/resources/res.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
71
plugins/channeltx/udpsink/udpsinkplugin.cpp
Normal file
71
plugins/channeltx/udpsink/udpsinkplugin.cpp
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2017 F4EXB //
|
||||||
|
// written by Edouard Griffiths //
|
||||||
|
// //
|
||||||
|
// 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 //
|
||||||
|
// //
|
||||||
|
// 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 "udpsinkplugin.h"
|
||||||
|
|
||||||
|
#include <QtPlugin>
|
||||||
|
#include "plugin/pluginapi.h"
|
||||||
|
|
||||||
|
#include "udpsinkgui.h"
|
||||||
|
|
||||||
|
const PluginDescriptor UDPSinkPlugin::m_pluginDescriptor = {
|
||||||
|
QString("UDP Channel Sink"),
|
||||||
|
QString("3.6.0"),
|
||||||
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
|
true,
|
||||||
|
QString("https://github.com/f4exb/sdrangel")
|
||||||
|
};
|
||||||
|
|
||||||
|
UDPSinkPlugin::UDPSinkPlugin(QObject* parent) :
|
||||||
|
QObject(parent),
|
||||||
|
m_pluginAPI(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const PluginDescriptor& UDPSinkPlugin::getPluginDescriptor() const
|
||||||
|
{
|
||||||
|
return m_pluginDescriptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkPlugin::initPlugin(PluginAPI* pluginAPI)
|
||||||
|
{
|
||||||
|
m_pluginAPI = pluginAPI;
|
||||||
|
|
||||||
|
// register TCP Channel Source
|
||||||
|
m_pluginAPI->registerTxChannel(UDPSinkGUI::m_channelID, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
PluginGUI* UDPSinkPlugin::createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI)
|
||||||
|
{
|
||||||
|
if(channelName == UDPSinkGUI::m_channelID)
|
||||||
|
{
|
||||||
|
UDPSinkGUI* gui = UDPSinkGUI::create(m_pluginAPI, deviceAPI);
|
||||||
|
// deviceAPI->registerChannelInstance("sdrangel.channel.udpsrc", gui);
|
||||||
|
// m_pluginAPI->addChannelRollup(gui);
|
||||||
|
return gui;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkPlugin::createInstanceUDPSink(DeviceSinkAPI *deviceAPI)
|
||||||
|
{
|
||||||
|
UDPSinkGUI::create(m_pluginAPI, deviceAPI);
|
||||||
|
// deviceAPI->registerChannelInstance("sdrangel.channel.udpsrc", gui);
|
||||||
|
// m_pluginAPI->addChannelRollup(gui);
|
||||||
|
}
|
48
plugins/channeltx/udpsink/udpsinkplugin.h
Normal file
48
plugins/channeltx/udpsink/udpsinkplugin.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2017 F4EXB //
|
||||||
|
// written by Edouard Griffiths //
|
||||||
|
// //
|
||||||
|
// 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 //
|
||||||
|
// //
|
||||||
|
// 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_UDPSINKPLUGIN_H
|
||||||
|
#define INCLUDE_UDPSINKPLUGIN_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "plugin/plugininterface.h"
|
||||||
|
|
||||||
|
class DeviceSinkAPI;
|
||||||
|
|
||||||
|
class UDPSinkPlugin : public QObject, PluginInterface {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES(PluginInterface)
|
||||||
|
Q_PLUGIN_METADATA(IID "sdrangel.channeltx.udpsink")
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit UDPSinkPlugin(QObject* parent = 0);
|
||||||
|
|
||||||
|
const PluginDescriptor& getPluginDescriptor() const;
|
||||||
|
void initPlugin(PluginAPI* pluginAPI);
|
||||||
|
|
||||||
|
PluginGUI* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const PluginDescriptor m_pluginDescriptor;
|
||||||
|
|
||||||
|
PluginAPI* m_pluginAPI;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void createInstanceUDPSink(DeviceSinkAPI *deviceAPI);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INCLUDE_UDPSINKPLUGIN_H
|
Loading…
x
Reference in New Issue
Block a user