mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 01:39:05 -05:00
Renamed UDPSrc to UDPSink
This commit is contained in:
parent
f8e90827ac
commit
06acb17e3a
@ -3,21 +3,21 @@ project(udpsrc)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
|
||||
set(udpsrc_SOURCES
|
||||
udpsrc.cpp
|
||||
udpsrcgui.cpp
|
||||
udpsrcplugin.cpp
|
||||
udpsrcsettings.cpp
|
||||
udpsink.cpp
|
||||
udpsinkgui.cpp
|
||||
udpsinkplugin.cpp
|
||||
udpsinksettings.cpp
|
||||
)
|
||||
|
||||
set(udpsrc_HEADERS
|
||||
udpsrc.h
|
||||
udpsrcgui.h
|
||||
udpsrcplugin.h
|
||||
udpsrcsettings.h
|
||||
udpsink.h
|
||||
udpsinkgui.h
|
||||
udpsinkplugin.h
|
||||
udpsinksettings.h
|
||||
)
|
||||
|
||||
set(udpsrc_FORMS
|
||||
udpsrcgui.ui
|
||||
udpsinkgui.ui
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
@ -30,18 +30,18 @@
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "device/devicesourceapi.h"
|
||||
|
||||
#include "udpsrc.h"
|
||||
#include "udpsink.h"
|
||||
|
||||
const Real UDPSrc::m_agcTarget = 16384.0f;
|
||||
const Real UDPSink::m_agcTarget = 16384.0f;
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(UDPSrc::MsgConfigureUDPSrc, Message)
|
||||
MESSAGE_CLASS_DEFINITION(UDPSrc::MsgConfigureChannelizer, Message)
|
||||
MESSAGE_CLASS_DEFINITION(UDPSrc::MsgUDPSrcSpectrum, Message)
|
||||
MESSAGE_CLASS_DEFINITION(UDPSink::MsgConfigureUDPSrc, Message)
|
||||
MESSAGE_CLASS_DEFINITION(UDPSink::MsgConfigureChannelizer, Message)
|
||||
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSrcSpectrum, Message)
|
||||
|
||||
const QString UDPSrc::m_channelIdURI = "sdrangel.channel.udpsrc";
|
||||
const QString UDPSrc::m_channelId = "UDPSrc";
|
||||
const QString UDPSink::m_channelIdURI = "sdrangel.channel.udpsrc";
|
||||
const QString UDPSink::m_channelId = "UDPSrc";
|
||||
|
||||
UDPSrc::UDPSrc(DeviceSourceAPI *deviceAPI) :
|
||||
UDPSink::UDPSink(DeviceSourceAPI *deviceAPI) :
|
||||
ChannelSinkAPI(m_channelIdURI),
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_inputSampleRate(48000),
|
||||
@ -112,7 +112,7 @@ UDPSrc::UDPSrc(DeviceSourceAPI *deviceAPI) :
|
||||
m_deviceAPI->addChannelAPI(this);
|
||||
}
|
||||
|
||||
UDPSrc::~UDPSrc()
|
||||
UDPSink::~UDPSink()
|
||||
{
|
||||
delete m_audioSocket;
|
||||
delete m_udpBuffer24;
|
||||
@ -127,13 +127,13 @@ UDPSrc::~UDPSrc()
|
||||
delete UDPFilter;
|
||||
}
|
||||
|
||||
void UDPSrc::setSpectrum(MessageQueue* messageQueue, bool enabled)
|
||||
void UDPSink::setSpectrum(MessageQueue* messageQueue, bool enabled)
|
||||
{
|
||||
Message* cmd = MsgUDPSrcSpectrum::create(enabled);
|
||||
messageQueue->push(cmd);
|
||||
}
|
||||
|
||||
void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly)
|
||||
void UDPSink::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly)
|
||||
{
|
||||
Complex ci;
|
||||
fftfilt::cmplx* sideband;
|
||||
@ -153,10 +153,10 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
double agcFactor = 1.0;
|
||||
|
||||
if ((m_settings.m_agc) &&
|
||||
(m_settings.m_sampleFormat != UDPSrcSettings::FormatNFM) &&
|
||||
(m_settings.m_sampleFormat != UDPSrcSettings::FormatNFMMono) &&
|
||||
(m_settings.m_sampleFormat != UDPSrcSettings::FormatIQ16) &&
|
||||
(m_settings.m_sampleFormat != UDPSrcSettings::FormatIQ24))
|
||||
(m_settings.m_sampleFormat != UDPSinkSettings::FormatNFM) &&
|
||||
(m_settings.m_sampleFormat != UDPSinkSettings::FormatNFMMono) &&
|
||||
(m_settings.m_sampleFormat != UDPSinkSettings::FormatIQ16) &&
|
||||
(m_settings.m_sampleFormat != UDPSinkSettings::FormatIQ24))
|
||||
{
|
||||
agcFactor = m_agc.feedAndGetValue(ci);
|
||||
inMagSq = m_agc.getMagSq();
|
||||
@ -176,7 +176,7 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
|
||||
calculateSquelch(m_inMagsq);
|
||||
|
||||
if (m_settings.m_sampleFormat == UDPSrcSettings::FormatLSB) // binaural LSB
|
||||
if (m_settings.m_sampleFormat == UDPSinkSettings::FormatLSB) // binaural LSB
|
||||
{
|
||||
ci *= agcFactor;
|
||||
int n_out = UDPFilter->runSSB(ci, &sideband, false);
|
||||
@ -192,7 +192,7 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_settings.m_sampleFormat == UDPSrcSettings::FormatUSB) // binaural USB
|
||||
if (m_settings.m_sampleFormat == UDPSinkSettings::FormatUSB) // binaural USB
|
||||
{
|
||||
ci *= agcFactor;
|
||||
int n_out = UDPFilter->runSSB(ci, &sideband, true);
|
||||
@ -208,19 +208,19 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatNFM)
|
||||
else if (m_settings.m_sampleFormat == UDPSinkSettings::FormatNFM)
|
||||
{
|
||||
Real discri = m_squelchOpen ? m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_gain : 0;
|
||||
udpWriteNorm(discri, discri);
|
||||
m_outMovingAverage.feed(discri*discri);
|
||||
}
|
||||
else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatNFMMono)
|
||||
else if (m_settings.m_sampleFormat == UDPSinkSettings::FormatNFMMono)
|
||||
{
|
||||
Real discri = m_squelchOpen ? m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_gain : 0;
|
||||
udpWriteNormMono(discri);
|
||||
m_outMovingAverage.feed(discri*discri);
|
||||
}
|
||||
else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatLSBMono) // Monaural LSB
|
||||
else if (m_settings.m_sampleFormat == UDPSinkSettings::FormatLSBMono) // Monaural LSB
|
||||
{
|
||||
ci *= agcFactor;
|
||||
int n_out = UDPFilter->runSSB(ci, &sideband, false);
|
||||
@ -235,7 +235,7 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatUSBMono) // Monaural USB
|
||||
else if (m_settings.m_sampleFormat == UDPSinkSettings::FormatUSBMono) // Monaural USB
|
||||
{
|
||||
ci *= agcFactor;
|
||||
int n_out = UDPFilter->runSSB(ci, &sideband, true);
|
||||
@ -250,14 +250,14 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatAMMono)
|
||||
else if (m_settings.m_sampleFormat == UDPSinkSettings::FormatAMMono)
|
||||
{
|
||||
Real amplitude = m_squelchOpen ? sqrt(inMagSq) * agcFactor * m_settings.m_gain : 0;
|
||||
FixReal demod = (FixReal) amplitude;
|
||||
udpWriteMono(demod);
|
||||
m_outMovingAverage.feed((amplitude/SDR_RX_SCALEF)*(amplitude/SDR_RX_SCALEF));
|
||||
}
|
||||
else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatAMNoDCMono)
|
||||
else if (m_settings.m_sampleFormat == UDPSinkSettings::FormatAMNoDCMono)
|
||||
{
|
||||
if (m_squelchOpen)
|
||||
{
|
||||
@ -274,7 +274,7 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
m_outMovingAverage.feed(0);
|
||||
}
|
||||
}
|
||||
else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatAMBPFMono)
|
||||
else if (m_settings.m_sampleFormat == UDPSinkSettings::FormatAMBPFMono)
|
||||
{
|
||||
if (m_squelchOpen)
|
||||
{
|
||||
@ -320,17 +320,17 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
m_settingsMutex.unlock();
|
||||
}
|
||||
|
||||
void UDPSrc::start()
|
||||
void UDPSink::start()
|
||||
{
|
||||
m_phaseDiscri.reset();
|
||||
applyChannelSettings(m_inputSampleRate, m_inputFrequencyOffset, true);
|
||||
}
|
||||
|
||||
void UDPSrc::stop()
|
||||
void UDPSink::stop()
|
||||
{
|
||||
}
|
||||
|
||||
bool UDPSrc::handleMessage(const Message& cmd)
|
||||
bool UDPSink::handleMessage(const Message& cmd)
|
||||
{
|
||||
if (DownChannelizer::MsgChannelizerNotification::match(cmd))
|
||||
{
|
||||
@ -392,7 +392,7 @@ bool UDPSrc::handleMessage(const Message& cmd)
|
||||
}
|
||||
}
|
||||
|
||||
void UDPSrc::audioReadyRead()
|
||||
void UDPSink::audioReadyRead()
|
||||
{
|
||||
while (m_audioSocket->hasPendingDatagrams())
|
||||
{
|
||||
@ -460,7 +460,7 @@ void UDPSrc::audioReadyRead()
|
||||
//qDebug("UDPSrc::audioReadyRead: done");
|
||||
}
|
||||
|
||||
void UDPSrc::applyChannelSettings(int inputSampleRate, int inputFrequencyOffset, bool force)
|
||||
void UDPSink::applyChannelSettings(int inputSampleRate, int inputFrequencyOffset, bool force)
|
||||
{
|
||||
qDebug() << "UDPSrc::applyChannelSettings:"
|
||||
<< " inputSampleRate: " << inputSampleRate
|
||||
@ -484,7 +484,7 @@ void UDPSrc::applyChannelSettings(int inputSampleRate, int inputFrequencyOffset,
|
||||
m_inputFrequencyOffset = inputFrequencyOffset;
|
||||
}
|
||||
|
||||
void UDPSrc::applySettings(const UDPSrcSettings& settings, bool force)
|
||||
void UDPSink::applySettings(const UDPSinkSettings& settings, bool force)
|
||||
{
|
||||
qDebug() << "UDPSrc::applySettings:"
|
||||
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
|
||||
@ -514,10 +514,10 @@ void UDPSrc::applySettings(const UDPSrcSettings& settings, bool force)
|
||||
m_interpolator.create(16, m_inputSampleRate, settings.m_rfBandwidth / 2.0);
|
||||
m_sampleDistanceRemain = m_inputSampleRate / settings.m_outputSampleRate;
|
||||
|
||||
if ((settings.m_sampleFormat == UDPSrcSettings::FormatLSB) ||
|
||||
(settings.m_sampleFormat == UDPSrcSettings::FormatLSBMono) ||
|
||||
(settings.m_sampleFormat == UDPSrcSettings::FormatUSB) ||
|
||||
(settings.m_sampleFormat == UDPSrcSettings::FormatUSBMono))
|
||||
if ((settings.m_sampleFormat == UDPSinkSettings::FormatLSB) ||
|
||||
(settings.m_sampleFormat == UDPSinkSettings::FormatLSBMono) ||
|
||||
(settings.m_sampleFormat == UDPSinkSettings::FormatUSB) ||
|
||||
(settings.m_sampleFormat == UDPSinkSettings::FormatUSBMono))
|
||||
{
|
||||
m_squelchGate = settings.m_outputSampleRate * 0.05;
|
||||
}
|
||||
@ -555,10 +555,10 @@ void UDPSrc::applySettings(const UDPSrcSettings& settings, bool force)
|
||||
|
||||
if ((settings.m_squelchGate != m_settings.m_squelchGate) || force)
|
||||
{
|
||||
if ((settings.m_sampleFormat == UDPSrcSettings::FormatLSB) ||
|
||||
(settings.m_sampleFormat == UDPSrcSettings::FormatLSBMono) ||
|
||||
(settings.m_sampleFormat == UDPSrcSettings::FormatUSB) ||
|
||||
(settings.m_sampleFormat == UDPSrcSettings::FormatUSBMono))
|
||||
if ((settings.m_sampleFormat == UDPSinkSettings::FormatLSB) ||
|
||||
(settings.m_sampleFormat == UDPSinkSettings::FormatLSBMono) ||
|
||||
(settings.m_sampleFormat == UDPSinkSettings::FormatUSB) ||
|
||||
(settings.m_sampleFormat == UDPSinkSettings::FormatUSBMono))
|
||||
{
|
||||
m_squelchGate = settings.m_outputSampleRate * 0.05;
|
||||
}
|
||||
@ -620,12 +620,12 @@ void UDPSrc::applySettings(const UDPSrcSettings& settings, bool force)
|
||||
m_settings = settings;
|
||||
}
|
||||
|
||||
QByteArray UDPSrc::serialize() const
|
||||
QByteArray UDPSink::serialize() const
|
||||
{
|
||||
return m_settings.serialize();
|
||||
}
|
||||
|
||||
bool UDPSrc::deserialize(const QByteArray& data)
|
||||
bool UDPSink::deserialize(const QByteArray& data)
|
||||
{
|
||||
if (m_settings.deserialize(data))
|
||||
{
|
||||
@ -642,7 +642,7 @@ bool UDPSrc::deserialize(const QByteArray& data)
|
||||
}
|
||||
}
|
||||
|
||||
int UDPSrc::webapiSettingsGet(
|
||||
int UDPSink::webapiSettingsGet(
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
@ -652,20 +652,20 @@ int UDPSrc::webapiSettingsGet(
|
||||
return 200;
|
||||
}
|
||||
|
||||
int UDPSrc::webapiSettingsPutPatch(
|
||||
int UDPSink::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
UDPSrcSettings settings = m_settings;
|
||||
UDPSinkSettings settings = m_settings;
|
||||
bool frequencyOffsetChanged = false;
|
||||
|
||||
if (channelSettingsKeys.contains("outputSampleRate")) {
|
||||
settings.m_outputSampleRate = response.getUdpSrcSettings()->getOutputSampleRate();
|
||||
}
|
||||
if (channelSettingsKeys.contains("sampleFormat")) {
|
||||
settings.m_sampleFormat = (UDPSrcSettings::SampleFormat) response.getUdpSrcSettings()->getSampleFormat();
|
||||
settings.m_sampleFormat = (UDPSinkSettings::SampleFormat) response.getUdpSrcSettings()->getSampleFormat();
|
||||
}
|
||||
if (channelSettingsKeys.contains("inputFrequencyOffset"))
|
||||
{
|
||||
@ -723,7 +723,7 @@ int UDPSrc::webapiSettingsPutPatch(
|
||||
|
||||
if (frequencyOffsetChanged)
|
||||
{
|
||||
UDPSrc::MsgConfigureChannelizer *msgChan = UDPSrc::MsgConfigureChannelizer::create(
|
||||
UDPSink::MsgConfigureChannelizer *msgChan = UDPSink::MsgConfigureChannelizer::create(
|
||||
(int) settings.m_outputSampleRate,
|
||||
(int) settings.m_inputFrequencyOffset);
|
||||
m_inputMessageQueue.push(msgChan);
|
||||
@ -744,7 +744,7 @@ int UDPSrc::webapiSettingsPutPatch(
|
||||
return 200;
|
||||
}
|
||||
|
||||
int UDPSrc::webapiReportGet(
|
||||
int UDPSink::webapiReportGet(
|
||||
SWGSDRangel::SWGChannelReport& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
@ -754,7 +754,7 @@ int UDPSrc::webapiReportGet(
|
||||
return 200;
|
||||
}
|
||||
|
||||
void UDPSrc::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const UDPSrcSettings& settings)
|
||||
void UDPSink::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const UDPSinkSettings& settings)
|
||||
{
|
||||
response.getUdpSrcSettings()->setOutputSampleRate(settings.m_outputSampleRate);
|
||||
response.getUdpSrcSettings()->setSampleFormat((int) settings.m_sampleFormat);
|
||||
@ -788,7 +788,7 @@ void UDPSrc::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
|
||||
}
|
||||
}
|
||||
|
||||
void UDPSrc::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
||||
void UDPSink::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
||||
{
|
||||
response.getUdpSrcReport()->setChannelPowerDb(CalcDb::dbPower(getInMagSq()));
|
||||
response.getUdpSrcReport()->setOutputPowerDb(CalcDb::dbPower(getMagSq()));
|
@ -34,14 +34,14 @@
|
||||
#include "util/message.h"
|
||||
#include "audio/audiofifo.h"
|
||||
|
||||
#include "udpsrcsettings.h"
|
||||
#include "udpsinksettings.h"
|
||||
|
||||
class QUdpSocket;
|
||||
class DeviceSourceAPI;
|
||||
class ThreadedBasebandSampleSink;
|
||||
class DownChannelizer;
|
||||
|
||||
class UDPSrc : public BasebandSampleSink, public ChannelSinkAPI {
|
||||
class UDPSink : public BasebandSampleSink, public ChannelSinkAPI {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@ -49,19 +49,19 @@ public:
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const UDPSrcSettings& getSettings() const { return m_settings; }
|
||||
const UDPSinkSettings& getSettings() const { return m_settings; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureUDPSrc* create(const UDPSrcSettings& settings, bool force)
|
||||
static MsgConfigureUDPSrc* create(const UDPSinkSettings& settings, bool force)
|
||||
{
|
||||
return new MsgConfigureUDPSrc(settings, force);
|
||||
}
|
||||
|
||||
private:
|
||||
UDPSrcSettings m_settings;
|
||||
UDPSinkSettings m_settings;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigureUDPSrc(const UDPSrcSettings& settings, bool force) :
|
||||
MsgConfigureUDPSrc(const UDPSinkSettings& settings, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_force(force)
|
||||
@ -92,8 +92,8 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
UDPSrc(DeviceSourceAPI *deviceAPI);
|
||||
virtual ~UDPSrc();
|
||||
UDPSink(DeviceSourceAPI *deviceAPI);
|
||||
virtual ~UDPSink();
|
||||
virtual void destroy() { delete this; }
|
||||
void setSpectrum(BasebandSampleSink* spectrum) { m_spectrum = spectrum; }
|
||||
|
||||
@ -178,7 +178,7 @@ protected:
|
||||
|
||||
int m_inputSampleRate;
|
||||
int m_inputFrequencyOffset;
|
||||
UDPSrcSettings m_settings;
|
||||
UDPSinkSettings m_settings;
|
||||
|
||||
QUdpSocket *m_audioSocket;
|
||||
|
||||
@ -230,9 +230,9 @@ protected:
|
||||
QMutex m_settingsMutex;
|
||||
|
||||
void applyChannelSettings(int inputSampleRate, int inputFrequencyOffset, bool force = true);
|
||||
void applySettings(const UDPSrcSettings& settings, bool force = false);
|
||||
void applySettings(const UDPSinkSettings& settings, bool force = false);
|
||||
|
||||
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const UDPSrcSettings& settings);
|
||||
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const UDPSinkSettings& settings);
|
||||
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response);
|
||||
|
||||
inline void calculateSquelch(double value)
|
||||
@ -297,9 +297,9 @@ protected:
|
||||
{
|
||||
if (SDR_RX_SAMP_SZ == 16)
|
||||
{
|
||||
if (m_settings.m_sampleFormat == UDPSrcSettings::FormatIQ16) {
|
||||
if (m_settings.m_sampleFormat == UDPSinkSettings::FormatIQ16) {
|
||||
m_udpBuffer16->write(Sample16(real, imag));
|
||||
} else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatIQ24) {
|
||||
} else if (m_settings.m_sampleFormat == UDPSinkSettings::FormatIQ24) {
|
||||
m_udpBuffer24->write(Sample24(real<<8, imag<<8));
|
||||
} else {
|
||||
m_udpBuffer16->write(Sample16(real, imag));
|
||||
@ -307,9 +307,9 @@ protected:
|
||||
}
|
||||
else if (SDR_RX_SAMP_SZ == 24)
|
||||
{
|
||||
if (m_settings.m_sampleFormat == UDPSrcSettings::FormatIQ16) {
|
||||
if (m_settings.m_sampleFormat == UDPSinkSettings::FormatIQ16) {
|
||||
m_udpBuffer16->write(Sample16(real>>8, imag>>8));
|
||||
} else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatIQ24) {
|
||||
} else if (m_settings.m_sampleFormat == UDPSinkSettings::FormatIQ24) {
|
||||
m_udpBuffer24->write(Sample24(real, imag));
|
||||
} else {
|
||||
m_udpBuffer16->write(Sample16(real>>8, imag>>8));
|
@ -9,7 +9,7 @@ CONFIG += plugin
|
||||
|
||||
QT += core gui widgets multimedia network opengl
|
||||
|
||||
TARGET = udpsrc
|
||||
TARGET = udpsink
|
||||
|
||||
DEFINES += USE_SSE2=1
|
||||
QMAKE_CXXFLAGS += -msse2
|
||||
@ -26,17 +26,17 @@ INCLUDEPATH += ../../../swagger/sdrangel/code/qt5/client
|
||||
CONFIG(Release):build_subdir = release
|
||||
CONFIG(Debug):build_subdir = debug
|
||||
|
||||
SOURCES += udpsrc.cpp\
|
||||
udpsrcgui.cpp\
|
||||
udpsrcplugin.cpp\
|
||||
udpsrcsettings.cpp
|
||||
SOURCES += udpsink.cpp\
|
||||
udpsinkgui.cpp\
|
||||
udpsinkplugin.cpp\
|
||||
udpsinksettings.cpp
|
||||
|
||||
HEADERS += udpsrc.h\
|
||||
udpsrcgui.h\
|
||||
udpsrcplugin.h\
|
||||
udpsrcsettings.h
|
||||
HEADERS += udpsink.h\
|
||||
udpsinkgui.h\
|
||||
udpsinkplugin.h\
|
||||
udpsinksettings.h
|
||||
|
||||
FORMS += udpsrcgui.ui
|
||||
FORMS += udpsinkgui.ui
|
||||
|
||||
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
|
||||
LIBS += -L../../../sdrgui/$${build_subdir} -lsdrgui
|
@ -15,8 +15,6 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "udpsrcgui.h"
|
||||
|
||||
#include "device/devicesourceapi.h"
|
||||
#include "device/deviceuiset.h"
|
||||
#include "plugin/pluginapi.h"
|
||||
@ -25,44 +23,45 @@
|
||||
#include "util/simpleserializer.h"
|
||||
#include "util/db.h"
|
||||
#include "gui/basicchannelsettingsdialog.h"
|
||||
#include "ui_udpsrcgui.h"
|
||||
#include "ui_udpsinkgui.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "udpsrc.h"
|
||||
#include "udpsink.h"
|
||||
#include "udpsinkgui.h"
|
||||
|
||||
UDPSrcGUI* UDPSrcGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)
|
||||
UDPSinkGUI* UDPSinkGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)
|
||||
{
|
||||
UDPSrcGUI* gui = new UDPSrcGUI(pluginAPI, deviceUISet, rxChannel);
|
||||
UDPSinkGUI* gui = new UDPSinkGUI(pluginAPI, deviceUISet, rxChannel);
|
||||
return gui;
|
||||
}
|
||||
|
||||
void UDPSrcGUI::destroy()
|
||||
void UDPSinkGUI::destroy()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
void UDPSrcGUI::setName(const QString& name)
|
||||
void UDPSinkGUI::setName(const QString& name)
|
||||
{
|
||||
setObjectName(name);
|
||||
}
|
||||
|
||||
qint64 UDPSrcGUI::getCenterFrequency() const
|
||||
qint64 UDPSinkGUI::getCenterFrequency() const
|
||||
{
|
||||
return m_channelMarker.getCenterFrequency();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::setCenterFrequency(qint64 centerFrequency)
|
||||
void UDPSinkGUI::setCenterFrequency(qint64 centerFrequency)
|
||||
{
|
||||
m_channelMarker.setCenterFrequency(centerFrequency);
|
||||
applySettings();
|
||||
}
|
||||
|
||||
QString UDPSrcGUI::getName() const
|
||||
QString UDPSinkGUI::getName() const
|
||||
{
|
||||
return objectName();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::resetToDefaults()
|
||||
void UDPSinkGUI::resetToDefaults()
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
displaySettings();
|
||||
@ -70,12 +69,12 @@ void UDPSrcGUI::resetToDefaults()
|
||||
applySettings(true);
|
||||
}
|
||||
|
||||
QByteArray UDPSrcGUI::serialize() const
|
||||
QByteArray UDPSinkGUI::serialize() const
|
||||
{
|
||||
return m_settings.serialize();
|
||||
}
|
||||
|
||||
bool UDPSrcGUI::deserialize(const QByteArray& data)
|
||||
bool UDPSinkGUI::deserialize(const QByteArray& data)
|
||||
{
|
||||
if(m_settings.deserialize(data))
|
||||
{
|
||||
@ -89,11 +88,11 @@ bool UDPSrcGUI::deserialize(const QByteArray& data)
|
||||
}
|
||||
}
|
||||
|
||||
bool UDPSrcGUI::handleMessage(const Message& message )
|
||||
bool UDPSinkGUI::handleMessage(const Message& message )
|
||||
{
|
||||
if (UDPSrc::MsgConfigureUDPSrc::match(message))
|
||||
if (UDPSink::MsgConfigureUDPSrc::match(message))
|
||||
{
|
||||
const UDPSrc::MsgConfigureUDPSrc& cfg = (UDPSrc::MsgConfigureUDPSrc&) message;
|
||||
const UDPSink::MsgConfigureUDPSrc& cfg = (UDPSink::MsgConfigureUDPSrc&) message;
|
||||
m_settings = cfg.getSettings();
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
@ -106,7 +105,7 @@ bool UDPSrcGUI::handleMessage(const Message& message )
|
||||
}
|
||||
}
|
||||
|
||||
void UDPSrcGUI::handleSourceMessages()
|
||||
void UDPSinkGUI::handleSourceMessages()
|
||||
{
|
||||
Message* message;
|
||||
|
||||
@ -119,32 +118,32 @@ void UDPSrcGUI::handleSourceMessages()
|
||||
}
|
||||
}
|
||||
|
||||
void UDPSrcGUI::channelMarkerChangedByCursor()
|
||||
void UDPSinkGUI::channelMarkerChangedByCursor()
|
||||
{
|
||||
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
||||
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
||||
applySettingsImmediate();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::channelMarkerHighlightedByCursor()
|
||||
void UDPSinkGUI::channelMarkerHighlightedByCursor()
|
||||
{
|
||||
setHighlighted(m_channelMarker.getHighlighted());
|
||||
}
|
||||
|
||||
void UDPSrcGUI::tick()
|
||||
void UDPSinkGUI::tick()
|
||||
{
|
||||
if (m_tickCount % 4 == 0)
|
||||
{
|
||||
// m_channelPowerAvg.feed(m_udpSrc->getMagSq());
|
||||
// double powDb = CalcDb::dbPower(m_channelPowerAvg.average());
|
||||
double powDb = CalcDb::dbPower(m_udpSrc->getMagSq());
|
||||
double powDb = CalcDb::dbPower(m_udpSink->getMagSq());
|
||||
ui->channelPower->setText(QString::number(powDb, 'f', 1));
|
||||
m_inPowerAvg.feed(m_udpSrc->getInMagSq());
|
||||
m_inPowerAvg.feed(m_udpSink->getInMagSq());
|
||||
double inPowDb = CalcDb::dbPower(m_inPowerAvg.average());
|
||||
ui->inputPower->setText(QString::number(inPowDb, 'f', 1));
|
||||
}
|
||||
|
||||
if (m_udpSrc->getSquelchOpen()) {
|
||||
if (m_udpSink->getSquelchOpen()) {
|
||||
ui->squelchLabel->setStyleSheet("QLabel { background-color : green; }");
|
||||
} else {
|
||||
ui->squelchLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
||||
@ -153,12 +152,12 @@ void UDPSrcGUI::tick()
|
||||
m_tickCount++;
|
||||
}
|
||||
|
||||
UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent) :
|
||||
UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent) :
|
||||
RollupWidget(parent),
|
||||
ui(new Ui::UDPSrcGUI),
|
||||
ui(new Ui::UDPSinkGUI),
|
||||
m_pluginAPI(pluginAPI),
|
||||
m_deviceUISet(deviceUISet),
|
||||
m_udpSrc(0),
|
||||
m_udpSink(0),
|
||||
m_channelMarker(this),
|
||||
m_channelPowerAvg(4, 1e-10),
|
||||
m_inPowerAvg(4, 1e-10),
|
||||
@ -172,9 +171,9 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
m_spectrumVis = new SpectrumVis(SDR_RX_SCALEF, ui->glSpectrum);
|
||||
m_udpSrc = (UDPSrc*) rxChannel; //new UDPSrc(m_deviceUISet->m_deviceSourceAPI);
|
||||
m_udpSrc->setSpectrum(m_spectrumVis);
|
||||
m_udpSrc->setMessageQueueToGUI(getInputMessageQueue());
|
||||
m_udpSink = (UDPSink*) rxChannel; //new UDPSrc(m_deviceUISet->m_deviceSourceAPI);
|
||||
m_udpSink->setSpectrum(m_spectrumVis);
|
||||
m_udpSink->setMessageQueueToGUI(getInputMessageQueue());
|
||||
|
||||
ui->fmDeviation->setEnabled(false);
|
||||
|
||||
@ -211,7 +210,7 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
|
||||
m_settings.setChannelMarker(&m_channelMarker);
|
||||
m_settings.setSpectrumGUI(ui->spectrumGUI);
|
||||
|
||||
m_deviceUISet->registerRxChannelInstance(UDPSrc::m_channelIdURI, this);
|
||||
m_deviceUISet->registerRxChannelInstance(UDPSink::m_channelIdURI, this);
|
||||
m_deviceUISet->addChannelMarker(&m_channelMarker);
|
||||
m_deviceUISet->addRollupWidget(this);
|
||||
|
||||
@ -226,20 +225,20 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
|
||||
applySettings(true);
|
||||
}
|
||||
|
||||
UDPSrcGUI::~UDPSrcGUI()
|
||||
UDPSinkGUI::~UDPSinkGUI()
|
||||
{
|
||||
m_deviceUISet->removeRxChannelInstance(this);
|
||||
delete m_udpSrc; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete m_udpSink; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete m_spectrumVis;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void UDPSrcGUI::blockApplySettings(bool block)
|
||||
void UDPSinkGUI::blockApplySettings(bool block)
|
||||
{
|
||||
m_doApplySettings = !block;
|
||||
}
|
||||
|
||||
void UDPSrcGUI::displaySettings()
|
||||
void UDPSinkGUI::displaySettings()
|
||||
{
|
||||
m_channelMarker.blockSignals(true);
|
||||
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
|
||||
@ -290,41 +289,41 @@ void UDPSrcGUI::displaySettings()
|
||||
ui->glSpectrum->setSampleRate(m_settings.m_outputSampleRate);
|
||||
}
|
||||
|
||||
void UDPSrcGUI::setSampleFormatIndex(const UDPSrcSettings::SampleFormat& sampleFormat)
|
||||
void UDPSinkGUI::setSampleFormatIndex(const UDPSinkSettings::SampleFormat& sampleFormat)
|
||||
{
|
||||
switch(sampleFormat)
|
||||
{
|
||||
case UDPSrcSettings::FormatIQ16:
|
||||
case UDPSinkSettings::FormatIQ16:
|
||||
ui->sampleFormat->setCurrentIndex(0);
|
||||
break;
|
||||
case UDPSrcSettings::FormatIQ24:
|
||||
case UDPSinkSettings::FormatIQ24:
|
||||
ui->sampleFormat->setCurrentIndex(1);
|
||||
break;
|
||||
case UDPSrcSettings::FormatNFM:
|
||||
case UDPSinkSettings::FormatNFM:
|
||||
ui->sampleFormat->setCurrentIndex(2);
|
||||
break;
|
||||
case UDPSrcSettings::FormatNFMMono:
|
||||
case UDPSinkSettings::FormatNFMMono:
|
||||
ui->sampleFormat->setCurrentIndex(3);
|
||||
break;
|
||||
case UDPSrcSettings::FormatLSB:
|
||||
case UDPSinkSettings::FormatLSB:
|
||||
ui->sampleFormat->setCurrentIndex(4);
|
||||
break;
|
||||
case UDPSrcSettings::FormatUSB:
|
||||
case UDPSinkSettings::FormatUSB:
|
||||
ui->sampleFormat->setCurrentIndex(5);
|
||||
break;
|
||||
case UDPSrcSettings::FormatLSBMono:
|
||||
case UDPSinkSettings::FormatLSBMono:
|
||||
ui->sampleFormat->setCurrentIndex(6);
|
||||
break;
|
||||
case UDPSrcSettings::FormatUSBMono:
|
||||
case UDPSinkSettings::FormatUSBMono:
|
||||
ui->sampleFormat->setCurrentIndex(7);
|
||||
break;
|
||||
case UDPSrcSettings::FormatAMMono:
|
||||
case UDPSinkSettings::FormatAMMono:
|
||||
ui->sampleFormat->setCurrentIndex(8);
|
||||
break;
|
||||
case UDPSrcSettings::FormatAMNoDCMono:
|
||||
case UDPSinkSettings::FormatAMNoDCMono:
|
||||
ui->sampleFormat->setCurrentIndex(9);
|
||||
break;
|
||||
case UDPSrcSettings::FormatAMBPFMono:
|
||||
case UDPSinkSettings::FormatAMBPFMono:
|
||||
ui->sampleFormat->setCurrentIndex(10);
|
||||
break;
|
||||
default:
|
||||
@ -333,94 +332,94 @@ void UDPSrcGUI::setSampleFormatIndex(const UDPSrcSettings::SampleFormat& sampleF
|
||||
}
|
||||
}
|
||||
|
||||
void UDPSrcGUI::setSampleFormat(int index)
|
||||
void UDPSinkGUI::setSampleFormat(int index)
|
||||
{
|
||||
switch(index)
|
||||
{
|
||||
case 0:
|
||||
m_settings.m_sampleFormat = UDPSrcSettings::FormatIQ16;
|
||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatIQ16;
|
||||
ui->fmDeviation->setEnabled(false);
|
||||
break;
|
||||
case 1:
|
||||
m_settings.m_sampleFormat = UDPSrcSettings::FormatIQ24;
|
||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatIQ24;
|
||||
ui->fmDeviation->setEnabled(false);
|
||||
break;
|
||||
case 2:
|
||||
m_settings.m_sampleFormat = UDPSrcSettings::FormatNFM;
|
||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatNFM;
|
||||
ui->fmDeviation->setEnabled(true);
|
||||
break;
|
||||
case 3:
|
||||
m_settings.m_sampleFormat = UDPSrcSettings::FormatNFMMono;
|
||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatNFMMono;
|
||||
ui->fmDeviation->setEnabled(true);
|
||||
break;
|
||||
case 4:
|
||||
m_settings.m_sampleFormat = UDPSrcSettings::FormatLSB;
|
||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatLSB;
|
||||
ui->fmDeviation->setEnabled(false);
|
||||
break;
|
||||
case 5:
|
||||
m_settings.m_sampleFormat = UDPSrcSettings::FormatUSB;
|
||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatUSB;
|
||||
ui->fmDeviation->setEnabled(false);
|
||||
break;
|
||||
case 6:
|
||||
m_settings.m_sampleFormat = UDPSrcSettings::FormatLSBMono;
|
||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatLSBMono;
|
||||
ui->fmDeviation->setEnabled(false);
|
||||
break;
|
||||
case 7:
|
||||
m_settings.m_sampleFormat = UDPSrcSettings::FormatUSBMono;
|
||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatUSBMono;
|
||||
ui->fmDeviation->setEnabled(false);
|
||||
break;
|
||||
case 8:
|
||||
m_settings.m_sampleFormat = UDPSrcSettings::FormatAMMono;
|
||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatAMMono;
|
||||
ui->fmDeviation->setEnabled(false);
|
||||
break;
|
||||
case 9:
|
||||
m_settings.m_sampleFormat = UDPSrcSettings::FormatAMNoDCMono;
|
||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatAMNoDCMono;
|
||||
ui->fmDeviation->setEnabled(false);
|
||||
break;
|
||||
case 10:
|
||||
m_settings.m_sampleFormat = UDPSrcSettings::FormatAMBPFMono;
|
||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatAMBPFMono;
|
||||
ui->fmDeviation->setEnabled(false);
|
||||
break;
|
||||
default:
|
||||
m_settings.m_sampleFormat = UDPSrcSettings::FormatIQ16;
|
||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatIQ16;
|
||||
ui->fmDeviation->setEnabled(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UDPSrcGUI::applySettingsImmediate(bool force)
|
||||
void UDPSinkGUI::applySettingsImmediate(bool force)
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
UDPSrc::MsgConfigureUDPSrc* message = UDPSrc::MsgConfigureUDPSrc::create( m_settings, force);
|
||||
m_udpSrc->getInputMessageQueue()->push(message);
|
||||
UDPSink::MsgConfigureUDPSrc* message = UDPSink::MsgConfigureUDPSrc::create( m_settings, force);
|
||||
m_udpSink->getInputMessageQueue()->push(message);
|
||||
}
|
||||
}
|
||||
|
||||
void UDPSrcGUI::applySettings(bool force)
|
||||
void UDPSinkGUI::applySettings(bool force)
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
UDPSrc::MsgConfigureChannelizer* channelConfigMsg = UDPSrc::MsgConfigureChannelizer::create(
|
||||
UDPSink::MsgConfigureChannelizer* channelConfigMsg = UDPSink::MsgConfigureChannelizer::create(
|
||||
m_settings.m_outputSampleRate, m_channelMarker.getCenterFrequency());
|
||||
m_udpSrc->getInputMessageQueue()->push(channelConfigMsg);
|
||||
m_udpSink->getInputMessageQueue()->push(channelConfigMsg);
|
||||
|
||||
UDPSrc::MsgConfigureUDPSrc* message = UDPSrc::MsgConfigureUDPSrc::create( m_settings, force);
|
||||
m_udpSrc->getInputMessageQueue()->push(message);
|
||||
UDPSink::MsgConfigureUDPSrc* message = UDPSink::MsgConfigureUDPSrc::create( m_settings, force);
|
||||
m_udpSink->getInputMessageQueue()->push(message);
|
||||
|
||||
ui->applyBtn->setEnabled(false);
|
||||
ui->applyBtn->setStyleSheet("QPushButton { background:rgb(79,79,79); }");
|
||||
}
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_deltaFrequency_changed(qint64 value)
|
||||
void UDPSinkGUI::on_deltaFrequency_changed(qint64 value)
|
||||
{
|
||||
m_channelMarker.setCenterFrequency(value);
|
||||
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_sampleFormat_currentIndexChanged(int index)
|
||||
void UDPSinkGUI::on_sampleFormat_currentIndexChanged(int index)
|
||||
{
|
||||
if ((index == 1) || (index == 2)) {
|
||||
ui->fmDeviation->setEnabled(true);
|
||||
@ -434,14 +433,14 @@ void UDPSrcGUI::on_sampleFormat_currentIndexChanged(int index)
|
||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_outputUDPAddress_editingFinished()
|
||||
void UDPSinkGUI::on_outputUDPAddress_editingFinished()
|
||||
{
|
||||
m_settings.m_udpAddress = ui->outputUDPAddress->text();
|
||||
ui->applyBtn->setEnabled(true);
|
||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_outputUDPPort_editingFinished()
|
||||
void UDPSinkGUI::on_outputUDPPort_editingFinished()
|
||||
{
|
||||
bool ok;
|
||||
quint16 udpPort = ui->outputUDPPort->text().toInt(&ok);
|
||||
@ -457,7 +456,7 @@ void UDPSrcGUI::on_outputUDPPort_editingFinished()
|
||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_inputUDPAudioPort_editingFinished()
|
||||
void UDPSinkGUI::on_inputUDPAudioPort_editingFinished()
|
||||
{
|
||||
bool ok;
|
||||
quint16 udpPort = ui->inputUDPAudioPort->text().toInt(&ok);
|
||||
@ -473,7 +472,7 @@ void UDPSrcGUI::on_inputUDPAudioPort_editingFinished()
|
||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_sampleRate_textEdited(const QString& arg1 __attribute__((unused)))
|
||||
void UDPSinkGUI::on_sampleRate_textEdited(const QString& arg1 __attribute__((unused)))
|
||||
{
|
||||
bool ok;
|
||||
Real outputSampleRate = ui->sampleRate->text().toDouble(&ok);
|
||||
@ -492,7 +491,7 @@ void UDPSrcGUI::on_sampleRate_textEdited(const QString& arg1 __attribute__((unus
|
||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_rfBandwidth_textEdited(const QString& arg1 __attribute__((unused)))
|
||||
void UDPSinkGUI::on_rfBandwidth_textEdited(const QString& arg1 __attribute__((unused)))
|
||||
{
|
||||
bool ok;
|
||||
Real rfBandwidth = ui->rfBandwidth->text().toDouble(&ok);
|
||||
@ -513,7 +512,7 @@ void UDPSrcGUI::on_rfBandwidth_textEdited(const QString& arg1 __attribute__((unu
|
||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_fmDeviation_textEdited(const QString& arg1 __attribute__((unused)))
|
||||
void UDPSinkGUI::on_fmDeviation_textEdited(const QString& arg1 __attribute__((unused)))
|
||||
{
|
||||
bool ok;
|
||||
int fmDeviation = ui->fmDeviation->text().toInt(&ok);
|
||||
@ -532,7 +531,7 @@ void UDPSrcGUI::on_fmDeviation_textEdited(const QString& arg1 __attribute__((unu
|
||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_applyBtn_clicked()
|
||||
void UDPSinkGUI::on_applyBtn_clicked()
|
||||
{
|
||||
if (m_rfBandwidthChanged)
|
||||
{
|
||||
@ -545,39 +544,39 @@ void UDPSrcGUI::on_applyBtn_clicked()
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_audioActive_toggled(bool active)
|
||||
void UDPSinkGUI::on_audioActive_toggled(bool active)
|
||||
{
|
||||
m_settings.m_audioActive = active;
|
||||
applySettingsImmediate();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_audioStereo_toggled(bool stereo)
|
||||
void UDPSinkGUI::on_audioStereo_toggled(bool stereo)
|
||||
{
|
||||
m_settings.m_audioStereo = stereo;
|
||||
applySettingsImmediate();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_agc_toggled(bool agc)
|
||||
void UDPSinkGUI::on_agc_toggled(bool agc)
|
||||
{
|
||||
m_settings.m_agc = agc;
|
||||
applySettingsImmediate();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_gain_valueChanged(int value)
|
||||
void UDPSinkGUI::on_gain_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_gain = value / 10.0;
|
||||
ui->gainText->setText(tr("%1").arg(value/10.0, 0, 'f', 1));
|
||||
applySettingsImmediate();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_volume_valueChanged(int value)
|
||||
void UDPSinkGUI::on_volume_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_volume = value;
|
||||
ui->volumeText->setText(QString("%1").arg(value));
|
||||
applySettingsImmediate();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_squelch_valueChanged(int value)
|
||||
void UDPSinkGUI::on_squelch_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_squelchdB = value;
|
||||
|
||||
@ -595,22 +594,22 @@ void UDPSrcGUI::on_squelch_valueChanged(int value)
|
||||
applySettingsImmediate();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_squelchGate_valueChanged(int value)
|
||||
void UDPSinkGUI::on_squelchGate_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_squelchGate = value;
|
||||
ui->squelchGateText->setText(tr("%1").arg(value*10.0, 0, 'f', 0));
|
||||
applySettingsImmediate();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
||||
void UDPSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
||||
{
|
||||
if ((widget == ui->spectrumBox) && (m_udpSrc != 0))
|
||||
if ((widget == ui->spectrumBox) && (m_udpSink != 0))
|
||||
{
|
||||
m_udpSrc->setSpectrum(m_udpSrc->getInputMessageQueue(), rollDown);
|
||||
m_udpSink->setSpectrum(m_udpSink->getInputMessageQueue(), rollDown);
|
||||
}
|
||||
}
|
||||
|
||||
void UDPSrcGUI::onMenuDialogCalled(const QPoint &p)
|
||||
void UDPSinkGUI::onMenuDialogCalled(const QPoint &p)
|
||||
{
|
||||
BasicChannelSettingsDialog dialog(&m_channelMarker, this);
|
||||
dialog.move(p);
|
||||
@ -627,12 +626,12 @@ void UDPSrcGUI::onMenuDialogCalled(const QPoint &p)
|
||||
applySettingsImmediate();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::leaveEvent(QEvent*)
|
||||
void UDPSinkGUI::leaveEvent(QEvent*)
|
||||
{
|
||||
m_channelMarker.setHighlighted(false);
|
||||
}
|
||||
|
||||
void UDPSrcGUI::enterEvent(QEvent*)
|
||||
void UDPSinkGUI::enterEvent(QEvent*)
|
||||
{
|
||||
m_channelMarker.setHighlighted(true);
|
||||
}
|
@ -25,23 +25,23 @@
|
||||
#include "dsp/movingaverage.h"
|
||||
#include "util/messagequeue.h"
|
||||
|
||||
#include "udpsrc.h"
|
||||
#include "udpsrcsettings.h"
|
||||
#include "udpsink.h"
|
||||
#include "udpsinksettings.h"
|
||||
|
||||
class PluginAPI;
|
||||
class DeviceUISet;
|
||||
class UDPSrc;
|
||||
class UDPSink;
|
||||
class SpectrumVis;
|
||||
|
||||
namespace Ui {
|
||||
class UDPSrcGUI;
|
||||
class UDPSinkGUI;
|
||||
}
|
||||
|
||||
class UDPSrcGUI : public RollupWidget, public PluginInstanceGUI {
|
||||
class UDPSinkGUI : public RollupWidget, public PluginInstanceGUI {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static UDPSrcGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel);
|
||||
static UDPSinkGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel);
|
||||
virtual void destroy();
|
||||
|
||||
void setName(const QString& name);
|
||||
@ -60,11 +60,11 @@ public slots:
|
||||
void channelMarkerHighlightedByCursor();
|
||||
|
||||
private:
|
||||
Ui::UDPSrcGUI* ui;
|
||||
Ui::UDPSinkGUI* ui;
|
||||
PluginAPI* m_pluginAPI;
|
||||
DeviceUISet* m_deviceUISet;
|
||||
UDPSrc* m_udpSrc;
|
||||
UDPSrcSettings m_settings;
|
||||
UDPSink* m_udpSink;
|
||||
UDPSinkSettings m_settings;
|
||||
ChannelMarker m_channelMarker;
|
||||
MovingAverage<double> m_channelPowerAvg;
|
||||
MovingAverage<double> m_inPowerAvg;
|
||||
@ -78,15 +78,15 @@ private:
|
||||
// RF path
|
||||
SpectrumVis* m_spectrumVis;
|
||||
|
||||
explicit UDPSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = 0);
|
||||
virtual ~UDPSrcGUI();
|
||||
explicit UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = 0);
|
||||
virtual ~UDPSinkGUI();
|
||||
|
||||
void blockApplySettings(bool block);
|
||||
void applySettings(bool force = false);
|
||||
void applySettingsImmediate(bool force = false);
|
||||
void displaySettings();
|
||||
void setSampleFormat(int index);
|
||||
void setSampleFormatIndex(const UDPSrcSettings::SampleFormat& sampleFormat);
|
||||
void setSampleFormatIndex(const UDPSinkSettings::SampleFormat& sampleFormat);
|
||||
|
||||
void leaveEvent(QEvent*);
|
||||
void enterEvent(QEvent*);
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>UDPSrcGUI</class>
|
||||
<widget class="RollupWidget" name="UDPSrcGUI">
|
||||
<class>UDPSinkGUI</class>
|
||||
<widget class="RollupWidget" name="UDPSinkGUI">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -29,10 +29,10 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>UDP Sample Source</string>
|
||||
<string>UDP Sample Sink</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>UDP Sample Source</string>
|
||||
<string>UDP Sample Sink</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="geometry">
|
@ -15,65 +15,64 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "udpsrcplugin.h"
|
||||
|
||||
#include <QtPlugin>
|
||||
#include "plugin/pluginapi.h"
|
||||
|
||||
#ifndef SERVER_MODE
|
||||
#include "udpsrcgui.h"
|
||||
#include "udpsinkgui.h"
|
||||
#endif
|
||||
#include "udpsrc.h"
|
||||
#include "udpsink.h"
|
||||
#include "udpsinkplugin.h"
|
||||
|
||||
const PluginDescriptor UDPSrcPlugin::m_pluginDescriptor = {
|
||||
QString("UDP Channel Source"),
|
||||
QString("4.0.7"),
|
||||
const PluginDescriptor UDPSinkPlugin::m_pluginDescriptor = {
|
||||
QString("UDP Channel Sink"),
|
||||
QString("4.1.0"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
QString("https://github.com/f4exb/sdrangel")
|
||||
};
|
||||
|
||||
UDPSrcPlugin::UDPSrcPlugin(QObject* parent) :
|
||||
UDPSinkPlugin::UDPSinkPlugin(QObject* parent) :
|
||||
QObject(parent),
|
||||
m_pluginAPI(0)
|
||||
{
|
||||
}
|
||||
|
||||
const PluginDescriptor& UDPSrcPlugin::getPluginDescriptor() const
|
||||
const PluginDescriptor& UDPSinkPlugin::getPluginDescriptor() const
|
||||
{
|
||||
return m_pluginDescriptor;
|
||||
}
|
||||
|
||||
void UDPSrcPlugin::initPlugin(PluginAPI* pluginAPI)
|
||||
void UDPSinkPlugin::initPlugin(PluginAPI* pluginAPI)
|
||||
{
|
||||
m_pluginAPI = pluginAPI;
|
||||
|
||||
// register TCP Channel Source
|
||||
m_pluginAPI->registerRxChannel(UDPSrc::m_channelIdURI, UDPSrc::m_channelId, this);
|
||||
m_pluginAPI->registerRxChannel(UDPSink::m_channelIdURI, UDPSink::m_channelId, this);
|
||||
}
|
||||
|
||||
#ifdef SERVER_MODE
|
||||
PluginInstanceGUI* UDPSrcPlugin::createRxChannelGUI(
|
||||
PluginInstanceGUI* UDPSinkPlugin::createRxChannelGUI(
|
||||
DeviceUISet *deviceUISet __attribute__((unused)),
|
||||
BasebandSampleSink *rxChannel __attribute__((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
PluginInstanceGUI* UDPSrcPlugin::createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)
|
||||
PluginInstanceGUI* UDPSinkPlugin::createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)
|
||||
{
|
||||
return UDPSrcGUI::create(m_pluginAPI, deviceUISet, rxChannel);
|
||||
return UDPSinkGUI::create(m_pluginAPI, deviceUISet, rxChannel);
|
||||
}
|
||||
#endif
|
||||
|
||||
BasebandSampleSink* UDPSrcPlugin::createRxChannelBS(DeviceSourceAPI *deviceAPI)
|
||||
BasebandSampleSink* UDPSinkPlugin::createRxChannelBS(DeviceSourceAPI *deviceAPI)
|
||||
{
|
||||
return new UDPSrc(deviceAPI);
|
||||
return new UDPSink(deviceAPI);
|
||||
}
|
||||
|
||||
ChannelSinkAPI* UDPSrcPlugin::createRxChannelCS(DeviceSourceAPI *deviceAPI)
|
||||
ChannelSinkAPI* UDPSinkPlugin::createRxChannelCS(DeviceSourceAPI *deviceAPI)
|
||||
{
|
||||
return new UDPSrc(deviceAPI);
|
||||
return new UDPSink(deviceAPI);
|
||||
}
|
||||
|
@ -24,13 +24,13 @@
|
||||
class DeviceUISet;
|
||||
class BasebandSampleSink;
|
||||
|
||||
class UDPSrcPlugin : public QObject, PluginInterface {
|
||||
class UDPSinkPlugin : public QObject, PluginInterface {
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(PluginInterface)
|
||||
Q_PLUGIN_METADATA(IID "sdrangel.demod.udpsrc")
|
||||
|
||||
public:
|
||||
explicit UDPSrcPlugin(QObject* parent = 0);
|
||||
explicit UDPSinkPlugin(QObject* parent = 0);
|
||||
|
||||
const PluginDescriptor& getPluginDescriptor() const;
|
||||
void initPlugin(PluginAPI* pluginAPI);
|
@ -19,16 +19,16 @@
|
||||
#include "dsp/dspengine.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "settings/serializable.h"
|
||||
#include "udpsrcsettings.h"
|
||||
#include "udpsinksettings.h"
|
||||
|
||||
UDPSrcSettings::UDPSrcSettings() :
|
||||
UDPSinkSettings::UDPSinkSettings() :
|
||||
m_channelMarker(0),
|
||||
m_spectrumGUI(0)
|
||||
{
|
||||
resetToDefaults();
|
||||
}
|
||||
|
||||
void UDPSrcSettings::resetToDefaults()
|
||||
void UDPSinkSettings::resetToDefaults()
|
||||
{
|
||||
m_outputSampleRate = 48000;
|
||||
m_sampleFormat = FormatIQ16;
|
||||
@ -51,7 +51,7 @@ void UDPSrcSettings::resetToDefaults()
|
||||
m_title = "UDP Sample Source";
|
||||
}
|
||||
|
||||
QByteArray UDPSrcSettings::serialize() const
|
||||
QByteArray UDPSinkSettings::serialize() const
|
||||
{
|
||||
SimpleSerializer s(1);
|
||||
s.writeS32(2, m_inputFrequencyOffset);
|
||||
@ -85,7 +85,7 @@ QByteArray UDPSrcSettings::serialize() const
|
||||
|
||||
}
|
||||
|
||||
bool UDPSrcSettings::deserialize(const QByteArray& data)
|
||||
bool UDPSinkSettings::deserialize(const QByteArray& data)
|
||||
{
|
||||
SimpleDeserializer d(data);
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
class Serializable;
|
||||
|
||||
struct UDPSrcSettings
|
||||
struct UDPSinkSettings
|
||||
{
|
||||
enum SampleFormat {
|
||||
FormatIQ16,
|
||||
@ -65,7 +65,7 @@ struct UDPSrcSettings
|
||||
Serializable *m_channelMarker;
|
||||
Serializable *m_spectrumGUI;
|
||||
|
||||
UDPSrcSettings();
|
||||
UDPSinkSettings();
|
||||
void resetToDefaults();
|
||||
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
|
||||
void setSpectrumGUI(Serializable *spectrumGUI) { m_spectrumGUI = spectrumGUI; }
|
@ -4,15 +4,15 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
set(PLUGIN_PREFIX "../../../plugins/channelrx/udpsrc")
|
||||
|
||||
set(udpsrc_SOURCES
|
||||
${PLUGIN_PREFIX}/udpsrc.cpp
|
||||
${PLUGIN_PREFIX}/udpsrcplugin.cpp
|
||||
${PLUGIN_PREFIX}/udpsrcsettings.cpp
|
||||
${PLUGIN_PREFIX}/udpsink.cpp
|
||||
${PLUGIN_PREFIX}/udpsinkplugin.cpp
|
||||
${PLUGIN_PREFIX}/udpsinksettings.cpp
|
||||
)
|
||||
|
||||
set(udpsrc_HEADERS
|
||||
${PLUGIN_PREFIX}/udpsrc.h
|
||||
${PLUGIN_PREFIX}/udpsrcplugin.h
|
||||
${PLUGIN_PREFIX}/udpsrcsettings.h
|
||||
${PLUGIN_PREFIX}/udpsink.h
|
||||
${PLUGIN_PREFIX}/udpsinkplugin.h
|
||||
${PLUGIN_PREFIX}/udpsinksettings.h
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
Loading…
Reference in New Issue
Block a user