mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
Renamed UDPSink to UDPSource
This commit is contained in:
parent
87b9cff3c2
commit
f58cc3cc07
@ -75,8 +75,6 @@ private:
|
|||||||
|
|
||||||
int m_srate;
|
int m_srate;
|
||||||
|
|
||||||
//UDPSink<Real> m_udpDebug; // UDP debug
|
|
||||||
|
|
||||||
static const Real m_pllBeta;
|
static const Real m_pllBeta;
|
||||||
static const Real m_fsc;
|
static const Real m_fsc;
|
||||||
};
|
};
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
project(udpsink)
|
project(udpsource)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
|
|
||||||
set(udpsink_SOURCES
|
set(udpsource_SOURCES
|
||||||
udpsink.cpp
|
udpsource.cpp
|
||||||
udpsinkgui.cpp
|
udpsourcegui.cpp
|
||||||
udpsinkplugin.cpp
|
udpsourceplugin.cpp
|
||||||
udpsinkudphandler.cpp
|
udpsourceudphandler.cpp
|
||||||
udpsinkmsg.cpp
|
udpsourcemsg.cpp
|
||||||
udpsinksettings.cpp
|
udpsourcesettings.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(udpsink_HEADERS
|
set(udpsource_HEADERS
|
||||||
udpsink.h
|
udpsource.h
|
||||||
udpsinkgui.h
|
udpsourcegui.h
|
||||||
udpsinkplugin.h
|
udpsourceplugin.h
|
||||||
udpsinkudphandler.h
|
udpsourceudphandler.h
|
||||||
udpsinkmsg.h
|
udpsourcemsg.h
|
||||||
udpsinksettings.h
|
udpsourcesettings.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(udpsink_FORMS
|
set(udpsource_FORMS
|
||||||
udpsinkgui.ui
|
udpsourcegui.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
@ -35,21 +35,21 @@ add_definitions(${QT_DEFINITIONS})
|
|||||||
add_definitions(-DQT_PLUGIN)
|
add_definitions(-DQT_PLUGIN)
|
||||||
add_definitions(-DQT_SHARED)
|
add_definitions(-DQT_SHARED)
|
||||||
|
|
||||||
qt5_wrap_ui(udpsink_FORMS_HEADERS ${udpsink_FORMS})
|
qt5_wrap_ui(udpsource_FORMS_HEADERS ${udpsource_FORMS})
|
||||||
|
|
||||||
add_library(modudpsink SHARED
|
add_library(udpsource SHARED
|
||||||
${udpsink_SOURCES}
|
${udpsource_SOURCES}
|
||||||
${udpsink_HEADERS_MOC}
|
${udpsource_HEADERS_MOC}
|
||||||
${udpsink_FORMS_HEADERS}
|
${udpsource_FORMS_HEADERS}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(modudpsink
|
target_link_libraries(udpsource
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
sdrbase
|
sdrbase
|
||||||
sdrgui
|
sdrgui
|
||||||
swagger
|
swagger
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(modudpsink Qt5::Core Qt5::Widgets Qt5::Network)
|
target_link_libraries(udpsource Qt5::Core Qt5::Widgets Qt5::Network)
|
||||||
|
|
||||||
install(TARGETS modudpsink DESTINATION lib/plugins/channeltx)
|
install(TARGETS udpsource DESTINATION lib/plugins/channeltx)
|
||||||
|
@ -26,18 +26,18 @@
|
|||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "util/db.h"
|
#include "util/db.h"
|
||||||
|
|
||||||
#include "udpsinkmsg.h"
|
#include "udpsource.h"
|
||||||
#include "udpsink.h"
|
#include "udpsourcemsg.h"
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(UDPSink::MsgConfigureUDPSink, Message)
|
MESSAGE_CLASS_DEFINITION(UDPSource::MsgConfigureUDPSink, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(UDPSink::MsgConfigureChannelizer, Message)
|
MESSAGE_CLASS_DEFINITION(UDPSource::MsgConfigureChannelizer, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkSpectrum, Message)
|
MESSAGE_CLASS_DEFINITION(UDPSource::MsgUDPSinkSpectrum, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(UDPSink::MsgResetReadIndex, Message)
|
MESSAGE_CLASS_DEFINITION(UDPSource::MsgResetReadIndex, Message)
|
||||||
|
|
||||||
const QString UDPSink::m_channelIdURI = "sdrangel.channeltx.udpsink";
|
const QString UDPSource::m_channelIdURI = "sdrangel.channeltx.udpsource";
|
||||||
const QString UDPSink::m_channelId = "UDPSink";
|
const QString UDPSource::m_channelId = "UDPSource";
|
||||||
|
|
||||||
UDPSink::UDPSink(DeviceSinkAPI *deviceAPI) :
|
UDPSource::UDPSource(DeviceSinkAPI *deviceAPI) :
|
||||||
ChannelSourceAPI(m_channelIdURI),
|
ChannelSourceAPI(m_channelIdURI),
|
||||||
m_deviceAPI(deviceAPI),
|
m_deviceAPI(deviceAPI),
|
||||||
m_basebandSampleRate(48000),
|
m_basebandSampleRate(48000),
|
||||||
@ -80,7 +80,7 @@ UDPSink::UDPSink(DeviceSinkAPI *deviceAPI) :
|
|||||||
m_deviceAPI->addChannelAPI(this);
|
m_deviceAPI->addChannelAPI(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
UDPSink::~UDPSink()
|
UDPSource::~UDPSource()
|
||||||
{
|
{
|
||||||
m_deviceAPI->removeChannelAPI(this);
|
m_deviceAPI->removeChannelAPI(this);
|
||||||
m_deviceAPI->removeThreadedSource(m_threadedChannelizer);
|
m_deviceAPI->removeThreadedSource(m_threadedChannelizer);
|
||||||
@ -90,18 +90,18 @@ UDPSink::~UDPSink()
|
|||||||
delete[] m_SSBFilterBuffer;
|
delete[] m_SSBFilterBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSink::start()
|
void UDPSource::start()
|
||||||
{
|
{
|
||||||
m_udpHandler.start();
|
m_udpHandler.start();
|
||||||
applyChannelSettings(m_basebandSampleRate, m_outputSampleRate, m_inputFrequencyOffset, true);
|
applyChannelSettings(m_basebandSampleRate, m_outputSampleRate, m_inputFrequencyOffset, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSink::stop()
|
void UDPSource::stop()
|
||||||
{
|
{
|
||||||
m_udpHandler.stop();
|
m_udpHandler.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSink::pull(Sample& sample)
|
void UDPSource::pull(Sample& sample)
|
||||||
{
|
{
|
||||||
if (m_settings.m_channelMute)
|
if (m_settings.m_channelMute)
|
||||||
{
|
{
|
||||||
@ -147,9 +147,9 @@ void UDPSink::pull(Sample& sample)
|
|||||||
sample.m_imag = (FixReal) ci.imag();
|
sample.m_imag = (FixReal) ci.imag();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSink::modulateSample()
|
void UDPSource::modulateSample()
|
||||||
{
|
{
|
||||||
if (m_settings.m_sampleFormat == UDPSinkSettings::FormatSnLE) // Linear I/Q transponding
|
if (m_settings.m_sampleFormat == UDPSourceSettings::FormatSnLE) // Linear I/Q transponding
|
||||||
{
|
{
|
||||||
Sample s;
|
Sample s;
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ void UDPSink::modulateSample()
|
|||||||
m_modSample.imag(0.0f);
|
m_modSample.imag(0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_settings.m_sampleFormat == UDPSinkSettings::FormatNFM)
|
else if (m_settings.m_sampleFormat == UDPSourceSettings::FormatNFM)
|
||||||
{
|
{
|
||||||
qint16 t;
|
qint16 t;
|
||||||
readMonoSample(t);
|
readMonoSample(t);
|
||||||
@ -196,7 +196,7 @@ void UDPSink::modulateSample()
|
|||||||
m_modSample.imag(0.0f);
|
m_modSample.imag(0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_settings.m_sampleFormat == UDPSinkSettings::FormatAM)
|
else if (m_settings.m_sampleFormat == UDPSourceSettings::FormatAM)
|
||||||
{
|
{
|
||||||
qint16 t;
|
qint16 t;
|
||||||
readMonoSample(t);
|
readMonoSample(t);
|
||||||
@ -217,7 +217,7 @@ void UDPSink::modulateSample()
|
|||||||
m_modSample.imag(0.0f);
|
m_modSample.imag(0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((m_settings.m_sampleFormat == UDPSinkSettings::FormatLSB) || (m_settings.m_sampleFormat == UDPSinkSettings::FormatUSB))
|
else if ((m_settings.m_sampleFormat == UDPSourceSettings::FormatLSB) || (m_settings.m_sampleFormat == UDPSourceSettings::FormatUSB))
|
||||||
{
|
{
|
||||||
qint16 t;
|
qint16 t;
|
||||||
Complex c, ci;
|
Complex c, ci;
|
||||||
@ -235,7 +235,7 @@ void UDPSink::modulateSample()
|
|||||||
ci.real((t / SDR_TX_SCALEF) * m_settings.m_gainOut);
|
ci.real((t / SDR_TX_SCALEF) * m_settings.m_gainOut);
|
||||||
ci.imag(0.0f);
|
ci.imag(0.0f);
|
||||||
|
|
||||||
n_out = m_SSBFilter->runSSB(ci, &filtered, (m_settings.m_sampleFormat == UDPSinkSettings::FormatUSB));
|
n_out = m_SSBFilter->runSSB(ci, &filtered, (m_settings.m_sampleFormat == UDPSourceSettings::FormatUSB));
|
||||||
|
|
||||||
if (n_out > 0)
|
if (n_out > 0)
|
||||||
{
|
{
|
||||||
@ -279,7 +279,7 @@ void UDPSink::modulateSample()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSink::calculateLevel(Real sample)
|
void UDPSource::calculateLevel(Real sample)
|
||||||
{
|
{
|
||||||
if (m_levelCalcCount < m_levelNbSamples)
|
if (m_levelCalcCount < m_levelNbSamples)
|
||||||
{
|
{
|
||||||
@ -298,7 +298,7 @@ void UDPSink::calculateLevel(Real sample)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSink::calculateLevel(Complex sample)
|
void UDPSource::calculateLevel(Complex sample)
|
||||||
{
|
{
|
||||||
Real t = std::abs(sample);
|
Real t = std::abs(sample);
|
||||||
|
|
||||||
@ -318,12 +318,12 @@ void UDPSink::calculateLevel(Complex sample)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UDPSink::handleMessage(const Message& cmd)
|
bool UDPSource::handleMessage(const Message& cmd)
|
||||||
{
|
{
|
||||||
if (UpChannelizer::MsgChannelizerNotification::match(cmd))
|
if (UpChannelizer::MsgChannelizerNotification::match(cmd))
|
||||||
{
|
{
|
||||||
UpChannelizer::MsgChannelizerNotification& notif = (UpChannelizer::MsgChannelizerNotification&) cmd;
|
UpChannelizer::MsgChannelizerNotification& notif = (UpChannelizer::MsgChannelizerNotification&) cmd;
|
||||||
qDebug() << "UDPSink::handleMessage: MsgChannelizerNotification";
|
qDebug() << "UDPSource::handleMessage: MsgChannelizerNotification";
|
||||||
|
|
||||||
applyChannelSettings(notif.getBasebandSampleRate(), notif.getSampleRate(), notif.getFrequencyOffset());
|
applyChannelSettings(notif.getBasebandSampleRate(), notif.getSampleRate(), notif.getFrequencyOffset());
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ bool UDPSink::handleMessage(const Message& cmd)
|
|||||||
else if (MsgConfigureChannelizer::match(cmd))
|
else if (MsgConfigureChannelizer::match(cmd))
|
||||||
{
|
{
|
||||||
MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd;
|
MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd;
|
||||||
qDebug() << "UDPSink::handleMessage: MsgConfigureChannelizer:"
|
qDebug() << "UDPSource::handleMessage: MsgConfigureChannelizer:"
|
||||||
<< " sampleRate: " << cfg.getSampleRate()
|
<< " sampleRate: " << cfg.getSampleRate()
|
||||||
<< " centerFrequency: " << cfg.getCenterFrequency();
|
<< " centerFrequency: " << cfg.getCenterFrequency();
|
||||||
|
|
||||||
@ -345,15 +345,15 @@ bool UDPSink::handleMessage(const Message& cmd)
|
|||||||
else if (MsgConfigureUDPSink::match(cmd))
|
else if (MsgConfigureUDPSink::match(cmd))
|
||||||
{
|
{
|
||||||
MsgConfigureUDPSink& cfg = (MsgConfigureUDPSink&) cmd;
|
MsgConfigureUDPSink& cfg = (MsgConfigureUDPSink&) cmd;
|
||||||
qDebug() << "UDPSink::handleMessage: MsgConfigureUDPSink";
|
qDebug() << "UDPSource::handleMessage: MsgConfigureUDPSink";
|
||||||
|
|
||||||
applySettings(cfg.getSettings(), cfg.getForce());
|
applySettings(cfg.getSettings(), cfg.getForce());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (UDPSinkMessages::MsgSampleRateCorrection::match(cmd))
|
else if (UDPSourceMessages::MsgSampleRateCorrection::match(cmd))
|
||||||
{
|
{
|
||||||
UDPSinkMessages::MsgSampleRateCorrection& cfg = (UDPSinkMessages::MsgSampleRateCorrection&) cmd;
|
UDPSourceMessages::MsgSampleRateCorrection& cfg = (UDPSourceMessages::MsgSampleRateCorrection&) cmd;
|
||||||
Real newSampleRate = m_actualInputSampleRate + cfg.getCorrectionFactor() * m_actualInputSampleRate;
|
Real newSampleRate = m_actualInputSampleRate + cfg.getCorrectionFactor() * m_actualInputSampleRate;
|
||||||
|
|
||||||
// exclude values too way out nominal sample rate (20%)
|
// exclude values too way out nominal sample rate (20%)
|
||||||
@ -378,7 +378,7 @@ bool UDPSink::handleMessage(const Message& cmd)
|
|||||||
if (m_sampleRateAvgCounter == m_sampleRateAverageItems)
|
if (m_sampleRateAvgCounter == m_sampleRateAverageItems)
|
||||||
{
|
{
|
||||||
float avgRate = m_sampleRateSum / m_sampleRateAverageItems;
|
float avgRate = m_sampleRateSum / m_sampleRateAverageItems;
|
||||||
qDebug("UDPSink::handleMessage: MsgSampleRateCorrection: corr: %+.6f new rate: %.0f: avg rate: %.0f",
|
qDebug("UDPSource::handleMessage: MsgSampleRateCorrection: corr: %+.6f new rate: %.0f: avg rate: %.0f",
|
||||||
cfg.getCorrectionFactor(),
|
cfg.getCorrectionFactor(),
|
||||||
m_actualInputSampleRate,
|
m_actualInputSampleRate,
|
||||||
avgRate);
|
avgRate);
|
||||||
@ -388,7 +388,7 @@ bool UDPSink::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// qDebug("UDPSink::handleMessage: MsgSampleRateCorrection: corr: %+.6f new rate: %.0f",
|
// qDebug("UDPSource::handleMessage: MsgSampleRateCorrection: corr: %+.6f new rate: %.0f",
|
||||||
// cfg.getCorrectionFactor(),
|
// cfg.getCorrectionFactor(),
|
||||||
// m_actualInputSampleRate);
|
// m_actualInputSampleRate);
|
||||||
// }
|
// }
|
||||||
@ -407,7 +407,7 @@ bool UDPSink::handleMessage(const Message& cmd)
|
|||||||
{
|
{
|
||||||
MsgUDPSinkSpectrum& spc = (MsgUDPSinkSpectrum&) cmd;
|
MsgUDPSinkSpectrum& spc = (MsgUDPSinkSpectrum&) cmd;
|
||||||
m_spectrumEnabled = spc.getEnabled();
|
m_spectrumEnabled = spc.getEnabled();
|
||||||
qDebug() << "UDPSink::handleMessage: MsgUDPSinkSpectrum: m_spectrumEnabled: " << m_spectrumEnabled;
|
qDebug() << "UDPSource::handleMessage: MsgUDPSinkSpectrum: m_spectrumEnabled: " << m_spectrumEnabled;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -417,7 +417,7 @@ bool UDPSink::handleMessage(const Message& cmd)
|
|||||||
m_udpHandler.resetReadIndex();
|
m_udpHandler.resetReadIndex();
|
||||||
m_settingsMutex.unlock();
|
m_settingsMutex.unlock();
|
||||||
|
|
||||||
qDebug() << "UDPSink::handleMessage: MsgResetReadIndex";
|
qDebug() << "UDPSource::handleMessage: MsgResetReadIndex";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -438,21 +438,21 @@ bool UDPSink::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSink::setSpectrum(bool enabled)
|
void UDPSource::setSpectrum(bool enabled)
|
||||||
{
|
{
|
||||||
Message* cmd = MsgUDPSinkSpectrum::create(enabled);
|
Message* cmd = MsgUDPSinkSpectrum::create(enabled);
|
||||||
getInputMessageQueue()->push(cmd);
|
getInputMessageQueue()->push(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSink::resetReadIndex()
|
void UDPSource::resetReadIndex()
|
||||||
{
|
{
|
||||||
Message* cmd = MsgResetReadIndex::create();
|
Message* cmd = MsgResetReadIndex::create();
|
||||||
getInputMessageQueue()->push(cmd);
|
getInputMessageQueue()->push(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSink::applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force)
|
void UDPSource::applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force)
|
||||||
{
|
{
|
||||||
qDebug() << "UDPSink::applyChannelSettings:"
|
qDebug() << "UDPSource::applyChannelSettings:"
|
||||||
<< " basebandSampleRate: " << basebandSampleRate
|
<< " basebandSampleRate: " << basebandSampleRate
|
||||||
<< " outputSampleRate: " << outputSampleRate
|
<< " outputSampleRate: " << outputSampleRate
|
||||||
<< " inputFrequencyOffset: " << inputFrequencyOffset;
|
<< " inputFrequencyOffset: " << inputFrequencyOffset;
|
||||||
@ -480,9 +480,9 @@ void UDPSink::applyChannelSettings(int basebandSampleRate, int outputSampleRate,
|
|||||||
m_inputFrequencyOffset = inputFrequencyOffset;
|
m_inputFrequencyOffset = inputFrequencyOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSink::applySettings(const UDPSinkSettings& settings, bool force)
|
void UDPSource::applySettings(const UDPSourceSettings& settings, bool force)
|
||||||
{
|
{
|
||||||
qDebug() << "UDPSink::applySettings:"
|
qDebug() << "UDPSource::applySettings:"
|
||||||
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
|
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
|
||||||
<< " m_sampleFormat: " << settings.m_sampleFormat
|
<< " m_sampleFormat: " << settings.m_sampleFormat
|
||||||
<< " m_inputSampleRate: " << settings.m_inputSampleRate
|
<< " m_inputSampleRate: " << settings.m_inputSampleRate
|
||||||
@ -575,12 +575,12 @@ void UDPSink::applySettings(const UDPSinkSettings& settings, bool force)
|
|||||||
m_settings = settings;
|
m_settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray UDPSink::serialize() const
|
QByteArray UDPSource::serialize() const
|
||||||
{
|
{
|
||||||
return m_settings.serialize();
|
return m_settings.serialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UDPSink::deserialize(const QByteArray& data)
|
bool UDPSource::deserialize(const QByteArray& data)
|
||||||
{
|
{
|
||||||
if (m_settings.deserialize(data))
|
if (m_settings.deserialize(data))
|
||||||
{
|
{
|
||||||
@ -597,7 +597,7 @@ bool UDPSink::deserialize(const QByteArray& data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPSink::webapiSettingsGet(
|
int UDPSource::webapiSettingsGet(
|
||||||
SWGSDRangel::SWGChannelSettings& response,
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
QString& errorMessage __attribute__((unused)))
|
QString& errorMessage __attribute__((unused)))
|
||||||
{
|
{
|
||||||
@ -607,17 +607,17 @@ int UDPSink::webapiSettingsGet(
|
|||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPSink::webapiSettingsPutPatch(
|
int UDPSource::webapiSettingsPutPatch(
|
||||||
bool force,
|
bool force,
|
||||||
const QStringList& channelSettingsKeys,
|
const QStringList& channelSettingsKeys,
|
||||||
SWGSDRangel::SWGChannelSettings& response,
|
SWGSDRangel::SWGChannelSettings& response,
|
||||||
QString& errorMessage __attribute__((unused)))
|
QString& errorMessage __attribute__((unused)))
|
||||||
{
|
{
|
||||||
UDPSinkSettings settings = m_settings;
|
UDPSourceSettings settings = m_settings;
|
||||||
bool frequencyOffsetChanged = false;
|
bool frequencyOffsetChanged = false;
|
||||||
|
|
||||||
if (channelSettingsKeys.contains("sampleFormat")) {
|
if (channelSettingsKeys.contains("sampleFormat")) {
|
||||||
settings.m_sampleFormat = (UDPSinkSettings::SampleFormat) response.getUdpSinkSettings()->getSampleFormat();
|
settings.m_sampleFormat = (UDPSourceSettings::SampleFormat) response.getUdpSinkSettings()->getSampleFormat();
|
||||||
}
|
}
|
||||||
if (channelSettingsKeys.contains("inputSampleRate")) {
|
if (channelSettingsKeys.contains("inputSampleRate")) {
|
||||||
settings.m_inputSampleRate = response.getUdpSinkSettings()->getInputSampleRate();
|
settings.m_inputSampleRate = response.getUdpSinkSettings()->getInputSampleRate();
|
||||||
@ -678,7 +678,7 @@ int UDPSink::webapiSettingsPutPatch(
|
|||||||
|
|
||||||
if (frequencyOffsetChanged)
|
if (frequencyOffsetChanged)
|
||||||
{
|
{
|
||||||
UDPSink::MsgConfigureChannelizer *msgChan = UDPSink::MsgConfigureChannelizer::create(
|
UDPSource::MsgConfigureChannelizer *msgChan = UDPSource::MsgConfigureChannelizer::create(
|
||||||
settings.m_inputSampleRate,
|
settings.m_inputSampleRate,
|
||||||
settings.m_inputFrequencyOffset);
|
settings.m_inputFrequencyOffset);
|
||||||
m_inputMessageQueue.push(msgChan);
|
m_inputMessageQueue.push(msgChan);
|
||||||
@ -698,7 +698,7 @@ int UDPSink::webapiSettingsPutPatch(
|
|||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPSink::webapiReportGet(
|
int UDPSource::webapiReportGet(
|
||||||
SWGSDRangel::SWGChannelReport& response,
|
SWGSDRangel::SWGChannelReport& response,
|
||||||
QString& errorMessage __attribute__((unused)))
|
QString& errorMessage __attribute__((unused)))
|
||||||
{
|
{
|
||||||
@ -708,7 +708,7 @@ int UDPSink::webapiReportGet(
|
|||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSink::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const UDPSinkSettings& settings)
|
void UDPSource::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const UDPSourceSettings& settings)
|
||||||
{
|
{
|
||||||
response.getUdpSinkSettings()->setSampleFormat((int) settings.m_sampleFormat);
|
response.getUdpSinkSettings()->setSampleFormat((int) settings.m_sampleFormat);
|
||||||
response.getUdpSinkSettings()->setInputSampleRate(settings.m_inputSampleRate);
|
response.getUdpSinkSettings()->setInputSampleRate(settings.m_inputSampleRate);
|
||||||
@ -742,7 +742,7 @@ void UDPSink::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSink::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
void UDPSource::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
||||||
{
|
{
|
||||||
response.getUdpSinkReport()->setInputPowerDb(CalcDb::dbPower(getInMagSq()));
|
response.getUdpSinkReport()->setInputPowerDb(CalcDb::dbPower(getInMagSq()));
|
||||||
response.getUdpSinkReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
|
response.getUdpSinkReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
|
@ -14,8 +14,8 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef PLUGINS_CHANNELTX_UDPSINK_UDPSINK_H_
|
#ifndef PLUGINS_CHANNELTX_UDPSINK_UDPSOURCE_H_
|
||||||
#define PLUGINS_CHANNELTX_UDPSINK_UDPSINK_H_
|
#define PLUGINS_CHANNELTX_UDPSINK_UDPSOURCE_H_
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
@ -28,14 +28,14 @@
|
|||||||
#include "dsp/fftfilt.h"
|
#include "dsp/fftfilt.h"
|
||||||
#include "util/message.h"
|
#include "util/message.h"
|
||||||
|
|
||||||
#include "udpsinkudphandler.h"
|
#include "udpsourcesettings.h"
|
||||||
#include "udpsinksettings.h"
|
#include "udpsourceudphandler.h"
|
||||||
|
|
||||||
class DeviceSinkAPI;
|
class DeviceSinkAPI;
|
||||||
class ThreadedBasebandSampleSource;
|
class ThreadedBasebandSampleSource;
|
||||||
class UpChannelizer;
|
class UpChannelizer;
|
||||||
|
|
||||||
class UDPSink : public BasebandSampleSource, public ChannelSourceAPI {
|
class UDPSource : public BasebandSampleSource, public ChannelSourceAPI {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -43,19 +43,19 @@ public:
|
|||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const UDPSinkSettings& getSettings() const { return m_settings; }
|
const UDPSourceSettings& getSettings() const { return m_settings; }
|
||||||
bool getForce() const { return m_force; }
|
bool getForce() const { return m_force; }
|
||||||
|
|
||||||
static MsgConfigureUDPSink* create(const UDPSinkSettings& settings, bool force)
|
static MsgConfigureUDPSink* create(const UDPSourceSettings& settings, bool force)
|
||||||
{
|
{
|
||||||
return new MsgConfigureUDPSink(settings, force);
|
return new MsgConfigureUDPSink(settings, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UDPSinkSettings m_settings;
|
UDPSourceSettings m_settings;
|
||||||
bool m_force;
|
bool m_force;
|
||||||
|
|
||||||
MsgConfigureUDPSink(const UDPSinkSettings& settings, bool force) :
|
MsgConfigureUDPSink(const UDPSourceSettings& settings, bool force) :
|
||||||
Message(),
|
Message(),
|
||||||
m_settings(settings),
|
m_settings(settings),
|
||||||
m_force(force)
|
m_force(force)
|
||||||
@ -86,8 +86,8 @@ public:
|
|||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
UDPSink(DeviceSinkAPI *deviceAPI);
|
UDPSource(DeviceSinkAPI *deviceAPI);
|
||||||
virtual ~UDPSink();
|
virtual ~UDPSource();
|
||||||
virtual void destroy() { delete this; }
|
virtual void destroy() { delete this; }
|
||||||
|
|
||||||
void setSpectrumSink(BasebandSampleSink* spectrum) { m_spectrum = spectrum; }
|
void setSpectrumSink(BasebandSampleSink* spectrum) { m_spectrum = spectrum; }
|
||||||
@ -183,7 +183,7 @@ private:
|
|||||||
int m_basebandSampleRate;
|
int m_basebandSampleRate;
|
||||||
Real m_outputSampleRate;
|
Real m_outputSampleRate;
|
||||||
int m_inputFrequencyOffset;
|
int m_inputFrequencyOffset;
|
||||||
UDPSinkSettings m_settings;
|
UDPSourceSettings m_settings;
|
||||||
|
|
||||||
Real m_squelch;
|
Real m_squelch;
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ private:
|
|||||||
MovingAverage<double> m_movingAverage;
|
MovingAverage<double> m_movingAverage;
|
||||||
MovingAverage<double> m_inMovingAverage;
|
MovingAverage<double> m_inMovingAverage;
|
||||||
|
|
||||||
UDPSinkUDPHandler m_udpHandler;
|
UDPSourceUDPHandler m_udpHandler;
|
||||||
Real m_actualInputSampleRate; //!< sample rate with UDP buffer skew compensation
|
Real m_actualInputSampleRate; //!< sample rate with UDP buffer skew compensation
|
||||||
double m_sampleRateSum;
|
double m_sampleRateSum;
|
||||||
int m_sampleRateAvgCounter;
|
int m_sampleRateAvgCounter;
|
||||||
@ -232,12 +232,12 @@ private:
|
|||||||
static const int m_ssbFftLen = 1024;
|
static const int m_ssbFftLen = 1024;
|
||||||
|
|
||||||
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force = false);
|
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force = false);
|
||||||
void applySettings(const UDPSinkSettings& settings, bool force = false);
|
void applySettings(const UDPSourceSettings& settings, bool force = false);
|
||||||
void modulateSample();
|
void modulateSample();
|
||||||
void calculateLevel(Real sample);
|
void calculateLevel(Real sample);
|
||||||
void calculateLevel(Complex sample);
|
void calculateLevel(Complex sample);
|
||||||
|
|
||||||
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const UDPSinkSettings& settings);
|
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const UDPSourceSettings& settings);
|
||||||
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response);
|
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response);
|
||||||
|
|
||||||
inline void calculateSquelch(double value)
|
inline void calculateSquelch(double value)
|
||||||
@ -318,4 +318,4 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* PLUGINS_CHANNELTX_UDPSINK_UDPSINK_H_ */
|
#endif /* PLUGINS_CHANNELTX_UDPSINK_UDPSOURCE_H_ */
|
@ -14,6 +14,8 @@
|
|||||||
// 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 "udpsourcegui.h"
|
||||||
|
|
||||||
#include "device/devicesinkapi.h"
|
#include "device/devicesinkapi.h"
|
||||||
#include "device/deviceuiset.h"
|
#include "device/deviceuiset.h"
|
||||||
#include "dsp/spectrumvis.h"
|
#include "dsp/spectrumvis.h"
|
||||||
@ -24,53 +26,52 @@
|
|||||||
#include "plugin/pluginapi.h"
|
#include "plugin/pluginapi.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
#include "udpsinkgui.h"
|
#include "ui_udpsourcegui.h"
|
||||||
#include "ui_udpsinkgui.h"
|
|
||||||
|
|
||||||
UDPSinkGUI* UDPSinkGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx)
|
UDPSourceGUI* UDPSourceGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx)
|
||||||
{
|
{
|
||||||
UDPSinkGUI* gui = new UDPSinkGUI(pluginAPI, deviceUISet, channelTx);
|
UDPSourceGUI* gui = new UDPSourceGUI(pluginAPI, deviceUISet, channelTx);
|
||||||
return gui;
|
return gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::destroy()
|
void UDPSourceGUI::destroy()
|
||||||
{
|
{
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::setName(const QString& name)
|
void UDPSourceGUI::setName(const QString& name)
|
||||||
{
|
{
|
||||||
setObjectName(name);
|
setObjectName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString UDPSinkGUI::getName() const
|
QString UDPSourceGUI::getName() const
|
||||||
{
|
{
|
||||||
return objectName();
|
return objectName();
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 UDPSinkGUI::getCenterFrequency() const {
|
qint64 UDPSourceGUI::getCenterFrequency() const {
|
||||||
return m_channelMarker.getCenterFrequency();
|
return m_channelMarker.getCenterFrequency();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::setCenterFrequency(qint64 centerFrequency)
|
void UDPSourceGUI::setCenterFrequency(qint64 centerFrequency)
|
||||||
{
|
{
|
||||||
m_channelMarker.setCenterFrequency(centerFrequency);
|
m_channelMarker.setCenterFrequency(centerFrequency);
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::resetToDefaults()
|
void UDPSourceGUI::resetToDefaults()
|
||||||
{
|
{
|
||||||
m_settings.resetToDefaults();
|
m_settings.resetToDefaults();
|
||||||
displaySettings();
|
displaySettings();
|
||||||
applySettings(true);
|
applySettings(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray UDPSinkGUI::serialize() const
|
QByteArray UDPSourceGUI::serialize() const
|
||||||
{
|
{
|
||||||
return m_settings.serialize();
|
return m_settings.serialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UDPSinkGUI::deserialize(const QByteArray& data)
|
bool UDPSourceGUI::deserialize(const QByteArray& data)
|
||||||
{
|
{
|
||||||
if(m_settings.deserialize(data))
|
if(m_settings.deserialize(data))
|
||||||
{
|
{
|
||||||
@ -83,11 +84,11 @@ bool UDPSinkGUI::deserialize(const QByteArray& data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UDPSinkGUI::handleMessage(const Message& message)
|
bool UDPSourceGUI::handleMessage(const Message& message)
|
||||||
{
|
{
|
||||||
if (UDPSink::MsgConfigureUDPSink::match(message))
|
if (UDPSource::MsgConfigureUDPSink::match(message))
|
||||||
{
|
{
|
||||||
const UDPSink::MsgConfigureUDPSink& cfg = (UDPSink::MsgConfigureUDPSink&) message;
|
const UDPSource::MsgConfigureUDPSink& cfg = (UDPSource::MsgConfigureUDPSink&) message;
|
||||||
m_settings = cfg.getSettings();
|
m_settings = cfg.getSettings();
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
displaySettings();
|
displaySettings();
|
||||||
@ -100,7 +101,7 @@ bool UDPSinkGUI::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::handleSourceMessages()
|
void UDPSourceGUI::handleSourceMessages()
|
||||||
{
|
{
|
||||||
Message* message;
|
Message* message;
|
||||||
|
|
||||||
@ -113,9 +114,9 @@ void UDPSinkGUI::handleSourceMessages()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent) :
|
UDPSourceGUI::UDPSourceGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent) :
|
||||||
RollupWidget(parent),
|
RollupWidget(parent),
|
||||||
ui(new Ui::UDPSinkGUI),
|
ui(new Ui::UDPSourceGUI),
|
||||||
m_pluginAPI(pluginAPI),
|
m_pluginAPI(pluginAPI),
|
||||||
m_deviceUISet(deviceUISet),
|
m_deviceUISet(deviceUISet),
|
||||||
m_tickCount(0),
|
m_tickCount(0),
|
||||||
@ -129,9 +130,9 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandS
|
|||||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
m_spectrumVis = new SpectrumVis(SDR_TX_SCALEF, ui->glSpectrum);
|
m_spectrumVis = new SpectrumVis(SDR_TX_SCALEF, ui->glSpectrum);
|
||||||
m_udpSink = (UDPSink*) channelTx; //new UDPSink(m_deviceUISet->m_deviceSinkAPI);
|
m_udpSource = (UDPSource*) channelTx;
|
||||||
m_udpSink->setSpectrumSink(m_spectrumVis);
|
m_udpSource->setSpectrumSink(m_spectrumVis);
|
||||||
m_udpSink->setMessageQueueToGUI(getInputMessageQueue());
|
m_udpSource->setMessageQueueToGUI(getInputMessageQueue());
|
||||||
|
|
||||||
ui->fmDeviation->setEnabled(false);
|
ui->fmDeviation->setEnabled(false);
|
||||||
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
|
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
|
||||||
@ -161,7 +162,7 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandS
|
|||||||
m_channelMarker.blockSignals(false);
|
m_channelMarker.blockSignals(false);
|
||||||
m_channelMarker.setVisible(true); // activate signal on the last setting only
|
m_channelMarker.setVisible(true); // activate signal on the last setting only
|
||||||
|
|
||||||
m_deviceUISet->registerTxChannelInstance(UDPSink::m_channelIdURI, this);
|
m_deviceUISet->registerTxChannelInstance(UDPSource::m_channelIdURI, this);
|
||||||
m_deviceUISet->addChannelMarker(&m_channelMarker);
|
m_deviceUISet->addChannelMarker(&m_channelMarker);
|
||||||
m_deviceUISet->addRollupWidget(this);
|
m_deviceUISet->addRollupWidget(this);
|
||||||
|
|
||||||
@ -170,43 +171,43 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandS
|
|||||||
ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum);
|
ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum);
|
||||||
|
|
||||||
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
||||||
connect(m_udpSink, SIGNAL(levelChanged(qreal, qreal, int)), ui->volumeMeter, SLOT(levelChanged(qreal, qreal, int)));
|
connect(m_udpSource, SIGNAL(levelChanged(qreal, qreal, int)), ui->volumeMeter, SLOT(levelChanged(qreal, qreal, int)));
|
||||||
|
|
||||||
displaySettings();
|
displaySettings();
|
||||||
applySettings(true);
|
applySettings(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
UDPSinkGUI::~UDPSinkGUI()
|
UDPSourceGUI::~UDPSourceGUI()
|
||||||
{
|
{
|
||||||
m_deviceUISet->removeTxChannelInstance(this);
|
m_deviceUISet->removeTxChannelInstance(this);
|
||||||
delete m_udpSink; // TODO: check this: when the GUI closes it has to delete the modulator
|
delete m_udpSource; // TODO: check this: when the GUI closes it has to delete the modulator
|
||||||
delete m_spectrumVis;
|
delete m_spectrumVis;
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::blockApplySettings(bool block)
|
void UDPSourceGUI::blockApplySettings(bool block)
|
||||||
{
|
{
|
||||||
m_doApplySettings = !block;
|
m_doApplySettings = !block;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::applySettings(bool force)
|
void UDPSourceGUI::applySettings(bool force)
|
||||||
{
|
{
|
||||||
if (m_doApplySettings)
|
if (m_doApplySettings)
|
||||||
{
|
{
|
||||||
UDPSink::MsgConfigureChannelizer *msgChan = UDPSink::MsgConfigureChannelizer::create(
|
UDPSource::MsgConfigureChannelizer *msgChan = UDPSource::MsgConfigureChannelizer::create(
|
||||||
m_settings.m_inputSampleRate,
|
m_settings.m_inputSampleRate,
|
||||||
m_settings.m_inputFrequencyOffset);
|
m_settings.m_inputFrequencyOffset);
|
||||||
m_udpSink->getInputMessageQueue()->push(msgChan);
|
m_udpSource->getInputMessageQueue()->push(msgChan);
|
||||||
|
|
||||||
UDPSink::MsgConfigureUDPSink* message = UDPSink::MsgConfigureUDPSink::create( m_settings, force);
|
UDPSource::MsgConfigureUDPSink* message = UDPSource::MsgConfigureUDPSink::create( m_settings, force);
|
||||||
m_udpSink->getInputMessageQueue()->push(message);
|
m_udpSource->getInputMessageQueue()->push(message);
|
||||||
|
|
||||||
ui->applyBtn->setEnabled(false);
|
ui->applyBtn->setEnabled(false);
|
||||||
ui->applyBtn->setStyleSheet("QPushButton { background:rgb(79,79,79); }");
|
ui->applyBtn->setStyleSheet("QPushButton { background:rgb(79,79,79); }");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::displaySettings()
|
void UDPSourceGUI::displaySettings()
|
||||||
{
|
{
|
||||||
m_channelMarker.blockSignals(true);
|
m_channelMarker.blockSignals(true);
|
||||||
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
|
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
|
||||||
@ -258,29 +259,29 @@ void UDPSinkGUI::displaySettings()
|
|||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::channelMarkerChangedByCursor()
|
void UDPSourceGUI::channelMarkerChangedByCursor()
|
||||||
{
|
{
|
||||||
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
||||||
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_deltaFrequency_changed(qint64 value)
|
void UDPSourceGUI::on_deltaFrequency_changed(qint64 value)
|
||||||
{
|
{
|
||||||
m_settings.m_inputFrequencyOffset = value;
|
m_settings.m_inputFrequencyOffset = value;
|
||||||
m_channelMarker.setCenterFrequency(value);
|
m_channelMarker.setCenterFrequency(value);
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_sampleFormat_currentIndexChanged(int index)
|
void UDPSourceGUI::on_sampleFormat_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if (index == (int) UDPSinkSettings::FormatNFM) {
|
if (index == (int) UDPSourceSettings::FormatNFM) {
|
||||||
ui->fmDeviation->setEnabled(true);
|
ui->fmDeviation->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
ui->fmDeviation->setEnabled(false);
|
ui->fmDeviation->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index == (int) UDPSinkSettings::FormatAM) {
|
if (index == (int) UDPSourceSettings::FormatAM) {
|
||||||
ui->amModPercent->setEnabled(true);
|
ui->amModPercent->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
ui->amModPercent->setEnabled(false);
|
ui->amModPercent->setEnabled(false);
|
||||||
@ -292,14 +293,14 @@ void UDPSinkGUI::on_sampleFormat_currentIndexChanged(int index)
|
|||||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_localUDPAddress_editingFinished()
|
void UDPSourceGUI::on_localUDPAddress_editingFinished()
|
||||||
{
|
{
|
||||||
m_settings.m_udpAddress = ui->localUDPAddress->text();
|
m_settings.m_udpAddress = ui->localUDPAddress->text();
|
||||||
ui->applyBtn->setEnabled(true);
|
ui->applyBtn->setEnabled(true);
|
||||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_localUDPPort_editingFinished()
|
void UDPSourceGUI::on_localUDPPort_editingFinished()
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
quint16 udpPort = ui->localUDPPort->text().toInt(&ok);
|
quint16 udpPort = ui->localUDPPort->text().toInt(&ok);
|
||||||
@ -315,7 +316,7 @@ void UDPSinkGUI::on_localUDPPort_editingFinished()
|
|||||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_sampleRate_textEdited(const QString& arg1 __attribute__((unused)))
|
void UDPSourceGUI::on_sampleRate_textEdited(const QString& arg1 __attribute__((unused)))
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
Real inputSampleRate = ui->sampleRate->text().toDouble(&ok);
|
Real inputSampleRate = ui->sampleRate->text().toDouble(&ok);
|
||||||
@ -331,7 +332,7 @@ void UDPSinkGUI::on_sampleRate_textEdited(const QString& arg1 __attribute__((unu
|
|||||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_rfBandwidth_textEdited(const QString& arg1 __attribute__((unused)))
|
void UDPSourceGUI::on_rfBandwidth_textEdited(const QString& arg1 __attribute__((unused)))
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
Real rfBandwidth = ui->rfBandwidth->text().toDouble(&ok);
|
Real rfBandwidth = ui->rfBandwidth->text().toDouble(&ok);
|
||||||
@ -352,7 +353,7 @@ void UDPSinkGUI::on_rfBandwidth_textEdited(const QString& arg1 __attribute__((un
|
|||||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_fmDeviation_textEdited(const QString& arg1 __attribute__((unused)))
|
void UDPSourceGUI::on_fmDeviation_textEdited(const QString& arg1 __attribute__((unused)))
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
int fmDeviation = ui->fmDeviation->text().toInt(&ok);
|
int fmDeviation = ui->fmDeviation->text().toInt(&ok);
|
||||||
@ -368,7 +369,7 @@ void UDPSinkGUI::on_fmDeviation_textEdited(const QString& arg1 __attribute__((un
|
|||||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_amModPercent_textEdited(const QString& arg1 __attribute__((unused)))
|
void UDPSourceGUI::on_amModPercent_textEdited(const QString& arg1 __attribute__((unused)))
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
int amModPercent = ui->amModPercent->text().toInt(&ok);
|
int amModPercent = ui->amModPercent->text().toInt(&ok);
|
||||||
@ -385,21 +386,21 @@ void UDPSinkGUI::on_amModPercent_textEdited(const QString& arg1 __attribute__((u
|
|||||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_gainIn_valueChanged(int value)
|
void UDPSourceGUI::on_gainIn_valueChanged(int value)
|
||||||
{
|
{
|
||||||
m_settings.m_gainIn = value / 10.0;
|
m_settings.m_gainIn = value / 10.0;
|
||||||
ui->gainInText->setText(tr("%1").arg(m_settings.m_gainIn, 0, 'f', 1));
|
ui->gainInText->setText(tr("%1").arg(m_settings.m_gainIn, 0, 'f', 1));
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_gainOut_valueChanged(int value)
|
void UDPSourceGUI::on_gainOut_valueChanged(int value)
|
||||||
{
|
{
|
||||||
m_settings.m_gainOut = value / 10.0;
|
m_settings.m_gainOut = value / 10.0;
|
||||||
ui->gainOutText->setText(tr("%1").arg(m_settings.m_gainOut, 0, 'f', 1));
|
ui->gainOutText->setText(tr("%1").arg(m_settings.m_gainOut, 0, 'f', 1));
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_squelch_valueChanged(int value)
|
void UDPSourceGUI::on_squelch_valueChanged(int value)
|
||||||
{
|
{
|
||||||
m_settings.m_squelchEnabled = (value != -100);
|
m_settings.m_squelchEnabled = (value != -100);
|
||||||
m_settings.m_squelch = value * 1.0;
|
m_settings.m_squelch = value * 1.0;
|
||||||
@ -413,20 +414,20 @@ void UDPSinkGUI::on_squelch_valueChanged(int value)
|
|||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_squelchGate_valueChanged(int value)
|
void UDPSourceGUI::on_squelchGate_valueChanged(int value)
|
||||||
{
|
{
|
||||||
m_settings.m_squelchGate = value / 100.0;
|
m_settings.m_squelchGate = value / 100.0;
|
||||||
ui->squelchGateText->setText(tr("%1").arg(roundf(value * 10.0), 0, 'f', 0));
|
ui->squelchGateText->setText(tr("%1").arg(roundf(value * 10.0), 0, 'f', 0));
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_channelMute_toggled(bool checked)
|
void UDPSourceGUI::on_channelMute_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_channelMute = checked;
|
m_settings.m_channelMute = checked;
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_applyBtn_clicked()
|
void UDPSourceGUI::on_applyBtn_clicked()
|
||||||
{
|
{
|
||||||
if (m_rfBandwidthChanged)
|
if (m_rfBandwidthChanged)
|
||||||
{
|
{
|
||||||
@ -439,32 +440,32 @@ void UDPSinkGUI::on_applyBtn_clicked()
|
|||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_resetUDPReadIndex_clicked()
|
void UDPSourceGUI::on_resetUDPReadIndex_clicked()
|
||||||
{
|
{
|
||||||
m_udpSink->resetReadIndex();
|
m_udpSource->resetReadIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_autoRWBalance_toggled(bool checked)
|
void UDPSourceGUI::on_autoRWBalance_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_autoRWBalance = checked;
|
m_settings.m_autoRWBalance = checked;
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_stereoInput_toggled(bool checked)
|
void UDPSourceGUI::on_stereoInput_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_stereoInput = checked;
|
m_settings.m_stereoInput = checked;
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
void UDPSourceGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
||||||
{
|
{
|
||||||
if ((widget == ui->spectrumBox) && (m_udpSink != 0))
|
if ((widget == ui->spectrumBox) && (m_udpSource != 0))
|
||||||
{
|
{
|
||||||
m_udpSink->setSpectrum(rollDown);
|
m_udpSource->setSpectrum(rollDown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::onMenuDialogCalled(const QPoint &p)
|
void UDPSourceGUI::onMenuDialogCalled(const QPoint &p)
|
||||||
{
|
{
|
||||||
BasicChannelSettingsDialog dialog(&m_channelMarker, this);
|
BasicChannelSettingsDialog dialog(&m_channelMarker, this);
|
||||||
dialog.move(p);
|
dialog.move(p);
|
||||||
@ -479,20 +480,20 @@ void UDPSinkGUI::onMenuDialogCalled(const QPoint &p)
|
|||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::leaveEvent(QEvent*)
|
void UDPSourceGUI::leaveEvent(QEvent*)
|
||||||
{
|
{
|
||||||
m_channelMarker.setHighlighted(false);
|
m_channelMarker.setHighlighted(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::enterEvent(QEvent*)
|
void UDPSourceGUI::enterEvent(QEvent*)
|
||||||
{
|
{
|
||||||
m_channelMarker.setHighlighted(true);
|
m_channelMarker.setHighlighted(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::tick()
|
void UDPSourceGUI::tick()
|
||||||
{
|
{
|
||||||
m_channelPowerAvg(m_udpSink->getMagSq());
|
m_channelPowerAvg(m_udpSource->getMagSq());
|
||||||
m_inPowerAvg(m_udpSink->getInMagSq());
|
m_inPowerAvg(m_udpSource->getInMagSq());
|
||||||
|
|
||||||
if (m_tickCount % 4 == 0)
|
if (m_tickCount % 4 == 0)
|
||||||
{
|
{
|
||||||
@ -502,13 +503,13 @@ void UDPSinkGUI::tick()
|
|||||||
ui->inputPower->setText(tr("%1").arg(inPowDb, 0, 'f', 1));
|
ui->inputPower->setText(tr("%1").arg(inPowDb, 0, 'f', 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t bufferGauge = m_udpSink->getBufferGauge();
|
int32_t bufferGauge = m_udpSource->getBufferGauge();
|
||||||
ui->bufferGaugeNegative->setValue((bufferGauge < 0 ? -bufferGauge : 0));
|
ui->bufferGaugeNegative->setValue((bufferGauge < 0 ? -bufferGauge : 0));
|
||||||
ui->bufferGaugePositive->setValue((bufferGauge < 0 ? 0 : bufferGauge));
|
ui->bufferGaugePositive->setValue((bufferGauge < 0 ? 0 : bufferGauge));
|
||||||
QString s = QString::number(bufferGauge, 'f', 0);
|
QString s = QString::number(bufferGauge, 'f', 0);
|
||||||
ui->bufferRWBalanceText->setText(tr("%1").arg(s));
|
ui->bufferRWBalanceText->setText(tr("%1").arg(s));
|
||||||
|
|
||||||
if (m_udpSink->getSquelchOpen()) {
|
if (m_udpSource->getSquelchOpen()) {
|
||||||
ui->channelMute->setStyleSheet("QToolButton { background-color : green; }");
|
ui->channelMute->setStyleSheet("QToolButton { background-color : green; }");
|
||||||
} else {
|
} else {
|
||||||
ui->channelMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
ui->channelMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||||
@ -517,32 +518,32 @@ void UDPSinkGUI::tick()
|
|||||||
m_tickCount++;
|
m_tickCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::setSampleFormatIndex(const UDPSinkSettings::SampleFormat& sampleFormat)
|
void UDPSourceGUI::setSampleFormatIndex(const UDPSourceSettings::SampleFormat& sampleFormat)
|
||||||
{
|
{
|
||||||
switch(sampleFormat)
|
switch(sampleFormat)
|
||||||
{
|
{
|
||||||
case UDPSinkSettings::FormatSnLE:
|
case UDPSourceSettings::FormatSnLE:
|
||||||
ui->sampleFormat->setCurrentIndex(0);
|
ui->sampleFormat->setCurrentIndex(0);
|
||||||
ui->fmDeviation->setEnabled(false);
|
ui->fmDeviation->setEnabled(false);
|
||||||
ui->stereoInput->setChecked(true);
|
ui->stereoInput->setChecked(true);
|
||||||
ui->stereoInput->setEnabled(false);
|
ui->stereoInput->setEnabled(false);
|
||||||
break;
|
break;
|
||||||
case UDPSinkSettings::FormatNFM:
|
case UDPSourceSettings::FormatNFM:
|
||||||
ui->sampleFormat->setCurrentIndex(1);
|
ui->sampleFormat->setCurrentIndex(1);
|
||||||
ui->fmDeviation->setEnabled(true);
|
ui->fmDeviation->setEnabled(true);
|
||||||
ui->stereoInput->setEnabled(true);
|
ui->stereoInput->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case UDPSinkSettings::FormatLSB:
|
case UDPSourceSettings::FormatLSB:
|
||||||
ui->sampleFormat->setCurrentIndex(2);
|
ui->sampleFormat->setCurrentIndex(2);
|
||||||
ui->fmDeviation->setEnabled(false);
|
ui->fmDeviation->setEnabled(false);
|
||||||
ui->stereoInput->setEnabled(true);
|
ui->stereoInput->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case UDPSinkSettings::FormatUSB:
|
case UDPSourceSettings::FormatUSB:
|
||||||
ui->sampleFormat->setCurrentIndex(3);
|
ui->sampleFormat->setCurrentIndex(3);
|
||||||
ui->fmDeviation->setEnabled(false);
|
ui->fmDeviation->setEnabled(false);
|
||||||
ui->stereoInput->setEnabled(true);
|
ui->stereoInput->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case UDPSinkSettings::FormatAM:
|
case UDPSourceSettings::FormatAM:
|
||||||
ui->sampleFormat->setCurrentIndex(4);
|
ui->sampleFormat->setCurrentIndex(4);
|
||||||
ui->fmDeviation->setEnabled(false);
|
ui->fmDeviation->setEnabled(false);
|
||||||
ui->stereoInput->setEnabled(true);
|
ui->stereoInput->setEnabled(true);
|
||||||
@ -556,38 +557,38 @@ void UDPSinkGUI::setSampleFormatIndex(const UDPSinkSettings::SampleFormat& sampl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::setSampleFormat(int index)
|
void UDPSourceGUI::setSampleFormat(int index)
|
||||||
{
|
{
|
||||||
switch(index)
|
switch(index)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatSnLE;
|
m_settings.m_sampleFormat = UDPSourceSettings::FormatSnLE;
|
||||||
ui->fmDeviation->setEnabled(false);
|
ui->fmDeviation->setEnabled(false);
|
||||||
ui->stereoInput->setChecked(true);
|
ui->stereoInput->setChecked(true);
|
||||||
ui->stereoInput->setEnabled(false);
|
ui->stereoInput->setEnabled(false);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatNFM;
|
m_settings.m_sampleFormat = UDPSourceSettings::FormatNFM;
|
||||||
ui->fmDeviation->setEnabled(true);
|
ui->fmDeviation->setEnabled(true);
|
||||||
ui->stereoInput->setEnabled(true);
|
ui->stereoInput->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatLSB;
|
m_settings.m_sampleFormat = UDPSourceSettings::FormatLSB;
|
||||||
ui->fmDeviation->setEnabled(false);
|
ui->fmDeviation->setEnabled(false);
|
||||||
ui->stereoInput->setEnabled(true);
|
ui->stereoInput->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatUSB;
|
m_settings.m_sampleFormat = UDPSourceSettings::FormatUSB;
|
||||||
ui->fmDeviation->setEnabled(false);
|
ui->fmDeviation->setEnabled(false);
|
||||||
ui->stereoInput->setEnabled(true);
|
ui->stereoInput->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatAM;
|
m_settings.m_sampleFormat = UDPSourceSettings::FormatAM;
|
||||||
ui->fmDeviation->setEnabled(false);
|
ui->fmDeviation->setEnabled(false);
|
||||||
ui->stereoInput->setEnabled(true);
|
ui->stereoInput->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
m_settings.m_sampleFormat = UDPSinkSettings::FormatSnLE;
|
m_settings.m_sampleFormat = UDPSourceSettings::FormatSnLE;
|
||||||
ui->fmDeviation->setEnabled(false);
|
ui->fmDeviation->setEnabled(false);
|
||||||
ui->stereoInput->setChecked(true);
|
ui->stereoInput->setChecked(true);
|
||||||
ui->stereoInput->setEnabled(false);
|
ui->stereoInput->setEnabled(false);
|
@ -14,8 +14,8 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef PLUGINS_CHANNELTX_UDPSINK_UDPSINKGUI_H_
|
#ifndef PLUGINS_CHANNELTX_UDPSINK_UDPSOURCEGUI_H_
|
||||||
#define PLUGINS_CHANNELTX_UDPSINK_UDPSINKGUI_H_
|
#define PLUGINS_CHANNELTX_UDPSINK_UDPSOURCEGUI_H_
|
||||||
|
|
||||||
#include <plugin/plugininstancegui.h>
|
#include <plugin/plugininstancegui.h>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@ -25,8 +25,8 @@
|
|||||||
#include "util/messagequeue.h"
|
#include "util/messagequeue.h"
|
||||||
#include "util/movingaverage.h"
|
#include "util/movingaverage.h"
|
||||||
|
|
||||||
#include "udpsink.h"
|
#include "udpsource.h"
|
||||||
#include "udpsinksettings.h"
|
#include "udpsourcesettings.h"
|
||||||
|
|
||||||
class PluginAPI;
|
class PluginAPI;
|
||||||
class DeviceUISet;
|
class DeviceUISet;
|
||||||
@ -34,14 +34,14 @@ class BasebandSampleSource;
|
|||||||
class SpectrumVis;
|
class SpectrumVis;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class UDPSinkGUI;
|
class UDPSourceGUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
class UDPSinkGUI : public RollupWidget, public PluginInstanceGUI {
|
class UDPSourceGUI : public RollupWidget, public PluginInstanceGUI {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static UDPSinkGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx);
|
static UDPSourceGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx);
|
||||||
virtual void destroy();
|
virtual void destroy();
|
||||||
|
|
||||||
void setName(const QString& name);
|
void setName(const QString& name);
|
||||||
@ -58,30 +58,30 @@ public slots:
|
|||||||
void channelMarkerChangedByCursor();
|
void channelMarkerChangedByCursor();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::UDPSinkGUI* ui;
|
Ui::UDPSourceGUI* ui;
|
||||||
PluginAPI* m_pluginAPI;
|
PluginAPI* m_pluginAPI;
|
||||||
DeviceUISet* m_deviceUISet;
|
DeviceUISet* m_deviceUISet;
|
||||||
SpectrumVis* m_spectrumVis;
|
SpectrumVis* m_spectrumVis;
|
||||||
UDPSink* m_udpSink;
|
UDPSource* m_udpSource;
|
||||||
MovingAverageUtil<double, double, 4> m_channelPowerAvg;
|
MovingAverageUtil<double, double, 4> m_channelPowerAvg;
|
||||||
MovingAverageUtil<double, double, 4> m_inPowerAvg;
|
MovingAverageUtil<double, double, 4> m_inPowerAvg;
|
||||||
uint32_t m_tickCount;
|
uint32_t m_tickCount;
|
||||||
ChannelMarker m_channelMarker;
|
ChannelMarker m_channelMarker;
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
UDPSinkSettings m_settings;
|
UDPSourceSettings m_settings;
|
||||||
bool m_rfBandwidthChanged;
|
bool m_rfBandwidthChanged;
|
||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
MessageQueue m_inputMessageQueue;
|
MessageQueue m_inputMessageQueue;
|
||||||
|
|
||||||
explicit UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = NULL);
|
explicit UDPSourceGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = NULL);
|
||||||
virtual ~UDPSinkGUI();
|
virtual ~UDPSourceGUI();
|
||||||
|
|
||||||
void blockApplySettings(bool block);
|
void blockApplySettings(bool block);
|
||||||
void applySettings(bool force = false);
|
void applySettings(bool force = false);
|
||||||
void displaySettings();
|
void displaySettings();
|
||||||
void setSampleFormat(int index);
|
void setSampleFormat(int index);
|
||||||
void setSampleFormatIndex(const UDPSinkSettings::SampleFormat& sampleFormat);
|
void setSampleFormatIndex(const UDPSourceSettings::SampleFormat& sampleFormat);
|
||||||
|
|
||||||
void leaveEvent(QEvent*);
|
void leaveEvent(QEvent*);
|
||||||
void enterEvent(QEvent*);
|
void enterEvent(QEvent*);
|
||||||
@ -110,4 +110,4 @@ private slots:
|
|||||||
void tick();
|
void tick();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* PLUGINS_CHANNELTX_UDPSINK_UDPSINKGUI_H_ */
|
#endif /* PLUGINS_CHANNELTX_UDPSINK_UDPSOURCEGUI_H_ */
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>UDPSinkGUI</class>
|
<class>UDPSourceGUI</class>
|
||||||
<widget class="RollupWidget" name="UDPSinkGUI">
|
<widget class="RollupWidget" name="UDPSourceGUI">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -29,13 +29,13 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>UDP Sample Sink</string>
|
<string>UDP Source Sink</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTipDuration">
|
<property name="toolTipDuration">
|
||||||
<number>-1</number>
|
<number>-1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="statusTip">
|
<property name="statusTip">
|
||||||
<string>UDP Sample Sink</string>
|
<string>UDP Source Sink</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="widget" native="true">
|
<widget class="QWidget" name="widget" native="true">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
@ -14,7 +14,7 @@
|
|||||||
// 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 "udpsinkmsg.h"
|
#include "udpsourcemsg.h"
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(UDPSinkMessages::MsgSampleRateCorrection, Message)
|
MESSAGE_CLASS_DEFINITION(UDPSourceMessages::MsgSampleRateCorrection, Message)
|
||||||
|
|
@ -14,15 +14,15 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef PLUGINS_CHANNELTX_UDPSINK_UDPSINKMSG_H_
|
#ifndef PLUGINS_CHANNELTX_UDPSINK_UDPSOURCEMSG_H_
|
||||||
#define PLUGINS_CHANNELTX_UDPSINK_UDPSINKMSG_H_
|
#define PLUGINS_CHANNELTX_UDPSINK_UDPSOURCEMSG_H_
|
||||||
|
|
||||||
#include "util/message.h"
|
#include "util/message.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Message(s) used to communicate back from UDPSinkUDPHandler to UDPSink
|
* Message(s) used to communicate back from UDPSinkUDPHandler to UDPSource
|
||||||
*/
|
*/
|
||||||
class UDPSinkMessages
|
class UDPSourceMessages
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
class MsgSampleRateCorrection : public Message {
|
class MsgSampleRateCorrection : public Message {
|
||||||
@ -50,4 +50,4 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* PLUGINS_CHANNELTX_UDPSINK_UDPSINKMSG_H_ */
|
#endif /* PLUGINS_CHANNELTX_UDPSINK_UDPSOURCEMSG_H_ */
|
@ -15,66 +15,66 @@
|
|||||||
// 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 "udpsinkplugin.h"
|
#include "udpsourceplugin.h"
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include "plugin/pluginapi.h"
|
#include "plugin/pluginapi.h"
|
||||||
|
|
||||||
#ifndef SERVER_MODE
|
#ifndef SERVER_MODE
|
||||||
#include "udpsinkgui.h"
|
#include "udpsourcegui.h"
|
||||||
#endif
|
#endif
|
||||||
#include "udpsink.h"
|
#include "udpsource.h"
|
||||||
|
|
||||||
const PluginDescriptor UDPSinkPlugin::m_pluginDescriptor = {
|
const PluginDescriptor UDPSourcePlugin::m_pluginDescriptor = {
|
||||||
QString("UDP Channel Sink"),
|
QString("UDP Channel Source"),
|
||||||
QString("4.0.7"),
|
QString("4.1.0"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
QString("https://github.com/f4exb/sdrangel")
|
QString("https://github.com/f4exb/sdrangel")
|
||||||
};
|
};
|
||||||
|
|
||||||
UDPSinkPlugin::UDPSinkPlugin(QObject* parent) :
|
UDPSourcePlugin::UDPSourcePlugin(QObject* parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_pluginAPI(0)
|
m_pluginAPI(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const PluginDescriptor& UDPSinkPlugin::getPluginDescriptor() const
|
const PluginDescriptor& UDPSourcePlugin::getPluginDescriptor() const
|
||||||
{
|
{
|
||||||
return m_pluginDescriptor;
|
return m_pluginDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkPlugin::initPlugin(PluginAPI* pluginAPI)
|
void UDPSourcePlugin::initPlugin(PluginAPI* pluginAPI)
|
||||||
{
|
{
|
||||||
m_pluginAPI = pluginAPI;
|
m_pluginAPI = pluginAPI;
|
||||||
|
|
||||||
// register TCP Channel Source
|
// register TCP Channel Source
|
||||||
m_pluginAPI->registerTxChannel(UDPSink::m_channelIdURI, UDPSink::m_channelId, this);
|
m_pluginAPI->registerTxChannel(UDPSource::m_channelIdURI, UDPSource::m_channelId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SERVER_MODE
|
#ifdef SERVER_MODE
|
||||||
PluginInstanceGUI* UDPSinkPlugin::createTxChannelGUI(
|
PluginInstanceGUI* UDPSourcePlugin::createTxChannelGUI(
|
||||||
DeviceUISet *deviceUISet __attribute__((unused)),
|
DeviceUISet *deviceUISet __attribute__((unused)),
|
||||||
BasebandSampleSource *txChannel __attribute__((unused)))
|
BasebandSampleSource *txChannel __attribute__((unused)))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PluginInstanceGUI* UDPSinkPlugin::createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
|
PluginInstanceGUI* UDPSourcePlugin::createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
|
||||||
{
|
{
|
||||||
return UDPSinkGUI::create(m_pluginAPI, deviceUISet, txChannel);
|
return UDPSourceGUI::create(m_pluginAPI, deviceUISet, txChannel);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BasebandSampleSource* UDPSinkPlugin::createTxChannelBS(DeviceSinkAPI *deviceAPI)
|
BasebandSampleSource* UDPSourcePlugin::createTxChannelBS(DeviceSinkAPI *deviceAPI)
|
||||||
{
|
{
|
||||||
return new UDPSink(deviceAPI);
|
return new UDPSource(deviceAPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChannelSourceAPI* UDPSinkPlugin::createTxChannelCS(DeviceSinkAPI *deviceAPI)
|
ChannelSourceAPI* UDPSourcePlugin::createTxChannelCS(DeviceSinkAPI *deviceAPI)
|
||||||
{
|
{
|
||||||
return new UDPSink(deviceAPI);
|
return new UDPSource(deviceAPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -24,13 +24,13 @@
|
|||||||
class DeviceUISet;
|
class DeviceUISet;
|
||||||
class BasebandSampleSource;
|
class BasebandSampleSource;
|
||||||
|
|
||||||
class UDPSinkPlugin : public QObject, PluginInterface {
|
class UDPSourcePlugin : public QObject, PluginInterface {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(PluginInterface)
|
Q_INTERFACES(PluginInterface)
|
||||||
Q_PLUGIN_METADATA(IID "sdrangel.channeltx.udpsink")
|
Q_PLUGIN_METADATA(IID "sdrangel.channeltx.udpsink")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit UDPSinkPlugin(QObject* parent = 0);
|
explicit UDPSourcePlugin(QObject* parent = 0);
|
||||||
|
|
||||||
const PluginDescriptor& getPluginDescriptor() const;
|
const PluginDescriptor& getPluginDescriptor() const;
|
||||||
void initPlugin(PluginAPI* pluginAPI);
|
void initPlugin(PluginAPI* pluginAPI);
|
@ -14,21 +14,22 @@
|
|||||||
// 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 "udpsourcesettings.h"
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "settings/serializable.h"
|
#include "settings/serializable.h"
|
||||||
#include "udpsinksettings.h"
|
|
||||||
|
|
||||||
UDPSinkSettings::UDPSinkSettings() :
|
UDPSourceSettings::UDPSourceSettings() :
|
||||||
m_channelMarker(0),
|
m_channelMarker(0),
|
||||||
m_spectrumGUI(0)
|
m_spectrumGUI(0)
|
||||||
{
|
{
|
||||||
resetToDefaults();
|
resetToDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkSettings::resetToDefaults()
|
void UDPSourceSettings::resetToDefaults()
|
||||||
{
|
{
|
||||||
m_sampleFormat = FormatSnLE;
|
m_sampleFormat = FormatSnLE;
|
||||||
m_inputSampleRate = 48000;
|
m_inputSampleRate = 48000;
|
||||||
@ -51,7 +52,7 @@ void UDPSinkSettings::resetToDefaults()
|
|||||||
m_title = "UDP Sample Sink";
|
m_title = "UDP Sample Sink";
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray UDPSinkSettings::serialize() const
|
QByteArray UDPSourceSettings::serialize() const
|
||||||
{
|
{
|
||||||
SimpleSerializer s(1);
|
SimpleSerializer s(1);
|
||||||
s.writeS32(2, m_inputFrequencyOffset);
|
s.writeS32(2, m_inputFrequencyOffset);
|
||||||
@ -82,7 +83,7 @@ QByteArray UDPSinkSettings::serialize() const
|
|||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UDPSinkSettings::deserialize(const QByteArray& data)
|
bool UDPSourceSettings::deserialize(const QByteArray& data)
|
||||||
{
|
{
|
||||||
SimpleDeserializer d(data);
|
SimpleDeserializer d(data);
|
||||||
|
|
@ -14,16 +14,18 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef PLUGINS_CHANNELTX_UDPSINK_UDPSINKSETTINGS_H_
|
#ifndef PLUGINS_CHANNELTX_UDPSINK_UDPSOURCESETTINGS_H_
|
||||||
#define PLUGINS_CHANNELTX_UDPSINK_UDPSINKSETTINGS_H_
|
#define PLUGINS_CHANNELTX_UDPSINK_UDPSOURCESETTINGS_H_
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "dsp/dsptypes.h"
|
||||||
|
|
||||||
class Serializable;
|
class Serializable;
|
||||||
|
|
||||||
struct UDPSinkSettings
|
struct UDPSourceSettings
|
||||||
{
|
{
|
||||||
enum SampleFormat {
|
enum SampleFormat {
|
||||||
FormatSnLE,
|
FormatSnLE,
|
||||||
@ -59,7 +61,7 @@ struct UDPSinkSettings
|
|||||||
Serializable *m_channelMarker;
|
Serializable *m_channelMarker;
|
||||||
Serializable *m_spectrumGUI;
|
Serializable *m_spectrumGUI;
|
||||||
|
|
||||||
UDPSinkSettings();
|
UDPSourceSettings();
|
||||||
void resetToDefaults();
|
void resetToDefaults();
|
||||||
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
|
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
|
||||||
void setSpectrumGUI(Serializable *spectrumGUI) { m_spectrumGUI = spectrumGUI; }
|
void setSpectrumGUI(Serializable *spectrumGUI) { m_spectrumGUI = spectrumGUI; }
|
||||||
@ -70,4 +72,4 @@ struct UDPSinkSettings
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* PLUGINS_CHANNELTX_UDPSINK_UDPSINKSETTINGS_H_ */
|
#endif /* PLUGINS_CHANNELTX_UDPSINK_UDPSOURCESETTINGS_H_ */
|
@ -14,16 +14,17 @@
|
|||||||
// 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 "udpsourceudphandler.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "udpsinkmsg.h"
|
#include "udpsourcemsg.h"
|
||||||
#include "udpsinkudphandler.h"
|
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(UDPSinkUDPHandler::MsgUDPAddressAndPort, Message)
|
MESSAGE_CLASS_DEFINITION(UDPSourceUDPHandler::MsgUDPAddressAndPort, Message)
|
||||||
|
|
||||||
UDPSinkUDPHandler::UDPSinkUDPHandler() :
|
UDPSourceUDPHandler::UDPSourceUDPHandler() :
|
||||||
m_dataSocket(0),
|
m_dataSocket(0),
|
||||||
m_dataAddress(QHostAddress::LocalHost),
|
m_dataAddress(QHostAddress::LocalHost),
|
||||||
m_remoteAddress(QHostAddress::LocalHost),
|
m_remoteAddress(QHostAddress::LocalHost),
|
||||||
@ -46,12 +47,12 @@ UDPSinkUDPHandler::UDPSinkUDPHandler() :
|
|||||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleMessages()));
|
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleMessages()));
|
||||||
}
|
}
|
||||||
|
|
||||||
UDPSinkUDPHandler::~UDPSinkUDPHandler()
|
UDPSourceUDPHandler::~UDPSourceUDPHandler()
|
||||||
{
|
{
|
||||||
delete[] m_udpBuf;
|
delete[] m_udpBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkUDPHandler::start()
|
void UDPSourceUDPHandler::start()
|
||||||
{
|
{
|
||||||
qDebug("UDPSinkUDPHandler::start");
|
qDebug("UDPSinkUDPHandler::start");
|
||||||
|
|
||||||
@ -77,7 +78,7 @@ void UDPSinkUDPHandler::start()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkUDPHandler::stop()
|
void UDPSourceUDPHandler::stop()
|
||||||
{
|
{
|
||||||
qDebug("UDPSinkUDPHandler::stop");
|
qDebug("UDPSinkUDPHandler::stop");
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ void UDPSinkUDPHandler::stop()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkUDPHandler::dataReadyRead()
|
void UDPSourceUDPHandler::dataReadyRead()
|
||||||
{
|
{
|
||||||
while (m_dataSocket->hasPendingDatagrams() && m_dataConnected)
|
while (m_dataSocket->hasPendingDatagrams() && m_dataConnected)
|
||||||
{
|
{
|
||||||
@ -127,7 +128,7 @@ void UDPSinkUDPHandler::dataReadyRead()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkUDPHandler::moveData(char *blk)
|
void UDPSourceUDPHandler::moveData(char *blk)
|
||||||
{
|
{
|
||||||
memcpy(m_udpBuf[m_writeFrameIndex], blk, m_udpBlockSize);
|
memcpy(m_udpBuf[m_writeFrameIndex], blk, m_udpBlockSize);
|
||||||
|
|
||||||
@ -138,7 +139,7 @@ void UDPSinkUDPHandler::moveData(char *blk)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkUDPHandler::readSample(qint16 &t)
|
void UDPSourceUDPHandler::readSample(qint16 &t)
|
||||||
{
|
{
|
||||||
if (m_readFrameIndex == m_writeFrameIndex) // block until more writes
|
if (m_readFrameIndex == m_writeFrameIndex) // block until more writes
|
||||||
{
|
{
|
||||||
@ -151,7 +152,7 @@ void UDPSinkUDPHandler::readSample(qint16 &t)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkUDPHandler::readSample(AudioSample &a)
|
void UDPSourceUDPHandler::readSample(AudioSample &a)
|
||||||
{
|
{
|
||||||
if (m_readFrameIndex == m_writeFrameIndex) // block until more writes
|
if (m_readFrameIndex == m_writeFrameIndex) // block until more writes
|
||||||
{
|
{
|
||||||
@ -165,7 +166,7 @@ void UDPSinkUDPHandler::readSample(AudioSample &a)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkUDPHandler::readSample(Sample &s)
|
void UDPSourceUDPHandler::readSample(Sample &s)
|
||||||
{
|
{
|
||||||
if (m_readFrameIndex == m_writeFrameIndex) // block until more writes
|
if (m_readFrameIndex == m_writeFrameIndex) // block until more writes
|
||||||
{
|
{
|
||||||
@ -179,7 +180,7 @@ void UDPSinkUDPHandler::readSample(Sample &s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkUDPHandler::advanceReadPointer(int nbBytes)
|
void UDPSourceUDPHandler::advanceReadPointer(int nbBytes)
|
||||||
{
|
{
|
||||||
if (m_readIndex < m_udpBlockSize - 2*nbBytes)
|
if (m_readIndex < m_udpBlockSize - 2*nbBytes)
|
||||||
{
|
{
|
||||||
@ -209,7 +210,7 @@ void UDPSinkUDPHandler::advanceReadPointer(int nbBytes)
|
|||||||
float dd = d - m_d; // derivative
|
float dd = d - m_d; // derivative
|
||||||
float c = (d / 15.0) + (dd / 20.0); // damping and scaling
|
float c = (d / 15.0) + (dd / 20.0); // damping and scaling
|
||||||
c = c < -0.05 ? -0.05 : c > 0.05 ? 0.05 : c; // limit
|
c = c < -0.05 ? -0.05 : c > 0.05 ? 0.05 : c; // limit
|
||||||
UDPSinkMessages::MsgSampleRateCorrection *msg = UDPSinkMessages::MsgSampleRateCorrection::create(c, d);
|
UDPSourceMessages::MsgSampleRateCorrection *msg = UDPSourceMessages::MsgSampleRateCorrection::create(c, d);
|
||||||
|
|
||||||
if (m_autoRWBalance && m_feedbackMessageQueue) {
|
if (m_autoRWBalance && m_feedbackMessageQueue) {
|
||||||
m_feedbackMessageQueue->push(msg);
|
m_feedbackMessageQueue->push(msg);
|
||||||
@ -222,13 +223,13 @@ void UDPSinkUDPHandler::advanceReadPointer(int nbBytes)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkUDPHandler::configureUDPLink(const QString& address, quint16 port)
|
void UDPSourceUDPHandler::configureUDPLink(const QString& address, quint16 port)
|
||||||
{
|
{
|
||||||
Message* msg = MsgUDPAddressAndPort::create(address, port);
|
Message* msg = MsgUDPAddressAndPort::create(address, port);
|
||||||
m_inputMessageQueue.push(msg);
|
m_inputMessageQueue.push(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkUDPHandler::applyUDPLink(const QString& address, quint16 port)
|
void UDPSourceUDPHandler::applyUDPLink(const QString& address, quint16 port)
|
||||||
{
|
{
|
||||||
qDebug("UDPSinkUDPHandler::configureUDPLink: %s:%d", address.toStdString().c_str(), port);
|
qDebug("UDPSinkUDPHandler::configureUDPLink: %s:%d", address.toStdString().c_str(), port);
|
||||||
bool addressOK = m_dataAddress.setAddress(address);
|
bool addressOK = m_dataAddress.setAddress(address);
|
||||||
@ -245,7 +246,7 @@ void UDPSinkUDPHandler::applyUDPLink(const QString& address, quint16 port)
|
|||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkUDPHandler::resetReadIndex()
|
void UDPSourceUDPHandler::resetReadIndex()
|
||||||
{
|
{
|
||||||
m_readFrameIndex = (m_writeFrameIndex + (m_nbUDPFrames/2)) % m_nbUDPFrames;
|
m_readFrameIndex = (m_writeFrameIndex + (m_nbUDPFrames/2)) % m_nbUDPFrames;
|
||||||
m_rwDelta = m_nbUDPFrames/2;
|
m_rwDelta = m_nbUDPFrames/2;
|
||||||
@ -253,7 +254,7 @@ void UDPSinkUDPHandler::resetReadIndex()
|
|||||||
m_d = 0.0f;
|
m_d = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkUDPHandler::resizeBuffer(float sampleRate)
|
void UDPSourceUDPHandler::resizeBuffer(float sampleRate)
|
||||||
{
|
{
|
||||||
int halfNbFrames = std::max((sampleRate / 375.0), (m_minNbUDPFrames / 2.0));
|
int halfNbFrames = std::max((sampleRate / 375.0), (m_minNbUDPFrames / 2.0));
|
||||||
qDebug("UDPSinkUDPHandler::resizeBuffer: nb_frames: %d", 2*halfNbFrames);
|
qDebug("UDPSinkUDPHandler::resizeBuffer: nb_frames: %d", 2*halfNbFrames);
|
||||||
@ -271,7 +272,7 @@ void UDPSinkUDPHandler::resizeBuffer(float sampleRate)
|
|||||||
resetReadIndex();
|
resetReadIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkUDPHandler::handleMessages()
|
void UDPSourceUDPHandler::handleMessages()
|
||||||
{
|
{
|
||||||
Message* message;
|
Message* message;
|
||||||
|
|
||||||
@ -284,11 +285,11 @@ void UDPSinkUDPHandler::handleMessages()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UDPSinkUDPHandler::handleMessage(const Message& cmd)
|
bool UDPSourceUDPHandler::handleMessage(const Message& cmd)
|
||||||
{
|
{
|
||||||
if (UDPSinkUDPHandler::MsgUDPAddressAndPort::match(cmd))
|
if (UDPSourceUDPHandler::MsgUDPAddressAndPort::match(cmd))
|
||||||
{
|
{
|
||||||
UDPSinkUDPHandler::MsgUDPAddressAndPort& notif = (UDPSinkUDPHandler::MsgUDPAddressAndPort&) cmd;
|
UDPSourceUDPHandler::MsgUDPAddressAndPort& notif = (UDPSourceUDPHandler::MsgUDPAddressAndPort&) cmd;
|
||||||
applyUDPLink(notif.getAddress(), notif.getPort());
|
applyUDPLink(notif.getAddress(), notif.getPort());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
@ -14,8 +14,8 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef PLUGINS_CHANNELTX_UDPSINK_UDPSINKUDPHANDLER_H_
|
#ifndef PLUGINS_CHANNELTX_UDPSINK_UDPSOURCEUDPHANDLER_H_
|
||||||
#define PLUGINS_CHANNELTX_UDPSINK_UDPSINKUDPHANDLER_H_
|
#define PLUGINS_CHANNELTX_UDPSINK_UDPSOURCEUDPHANDLER_H_
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QUdpSocket>
|
#include <QUdpSocket>
|
||||||
@ -27,12 +27,12 @@
|
|||||||
#include "util/message.h"
|
#include "util/message.h"
|
||||||
#include "util/messagequeue.h"
|
#include "util/messagequeue.h"
|
||||||
|
|
||||||
class UDPSinkUDPHandler : public QObject
|
class UDPSourceUDPHandler : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
UDPSinkUDPHandler();
|
UDPSourceUDPHandler();
|
||||||
virtual ~UDPSinkUDPHandler();
|
virtual ~UDPSourceUDPHandler();
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
void stop();
|
void stop();
|
||||||
@ -120,4 +120,4 @@ private slots:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* PLUGINS_CHANNELTX_UDPSINK_UDPSINKUDPHANDLER_H_ */
|
#endif /* PLUGINS_CHANNELTX_UDPSINK_UDPSOURCEUDPHANDLER_H_ */
|
@ -1,22 +1,22 @@
|
|||||||
project(udpsink)
|
project(udpsource)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
set(PLUGIN_PREFIX "../../../plugins/channeltx/udpsink")
|
set(PLUGIN_PREFIX "../../../plugins/channeltx/udpsink")
|
||||||
|
|
||||||
set(udpsink_SOURCES
|
set(udpsource_SOURCES
|
||||||
${PLUGIN_PREFIX}/udpsink.cpp
|
${PLUGIN_PREFIX}/udpsource.cpp
|
||||||
${PLUGIN_PREFIX}/udpsinkplugin.cpp
|
${PLUGIN_PREFIX}/udpsourceplugin.cpp
|
||||||
${PLUGIN_PREFIX}/udpsinkudphandler.cpp
|
${PLUGIN_PREFIX}/udpsourceudphandler.cpp
|
||||||
${PLUGIN_PREFIX}/udpsinkmsg.cpp
|
${PLUGIN_PREFIX}/udpsourcemsg.cpp
|
||||||
${PLUGIN_PREFIX}/udpsinksettings.cpp
|
${PLUGIN_PREFIX}/udpsourcesettings.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(udpsink_HEADERS
|
set(udpsource_HEADERS
|
||||||
${PLUGIN_PREFIX}/udpsink.h
|
${PLUGIN_PREFIX}/udpsource.h
|
||||||
${PLUGIN_PREFIX}/udpsinkplugin.h
|
${PLUGIN_PREFIX}/udpsourceplugin.h
|
||||||
${PLUGIN_PREFIX}/udpsinkudphandler.h
|
${PLUGIN_PREFIX}/udpsourceudphandler.h
|
||||||
${PLUGIN_PREFIX}/udpsinkmsg.h
|
${PLUGIN_PREFIX}/udpsourcemsg.h
|
||||||
${PLUGIN_PREFIX}/udpsinksettings.h
|
${PLUGIN_PREFIX}/udpsourcesettings.h
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
@ -29,17 +29,17 @@ add_definitions(${QT_DEFINITIONS})
|
|||||||
add_definitions(-DQT_PLUGIN)
|
add_definitions(-DQT_PLUGIN)
|
||||||
add_definitions(-DQT_SHARED)
|
add_definitions(-DQT_SHARED)
|
||||||
|
|
||||||
add_library(modudpsinksrv SHARED
|
add_library(udpsourcesrv SHARED
|
||||||
${udpsink_SOURCES}
|
${udpsource_SOURCES}
|
||||||
${udpsink_HEADERS_MOC}
|
${udpsource_HEADERS_MOC}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(modudpsinksrv
|
target_link_libraries(udpsourcesrv
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
sdrbase
|
sdrbase
|
||||||
swagger
|
swagger
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(modudpsinksrv Qt5::Core Qt5::Network)
|
target_link_libraries(udpsourcesrv Qt5::Core Qt5::Network)
|
||||||
|
|
||||||
install(TARGETS modudpsinksrv DESTINATION lib/pluginssrv/channeltx)
|
install(TARGETS udpsourcesrv DESTINATION lib/pluginssrv/channeltx)
|
||||||
|
@ -2208,7 +2208,7 @@ bool WebAPIRequestMapper::validateChannelSettings(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (*channelType == "UDPSink")
|
else if (*channelType == "UDPSource")
|
||||||
{
|
{
|
||||||
if (channelSettings.getTx() != 0)
|
if (channelSettings.getTx() != 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user