1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-24 19:00:36 -05:00

SDRdaemmon: channel source: allow passing of data address and port at startup

This commit is contained in:
f4exb 2018-08-28 23:31:07 +02:00
parent b07277a5e2
commit 5013e77f24
3 changed files with 18 additions and 14 deletions

View File

@ -44,9 +44,7 @@ SDRDaemonChannelSource::SDRDaemonChannelSource(DeviceSinkAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_sourceThread(0),
m_running(false),
m_samplesCount(0),
m_dataAddress("127.0.0.1"),
m_dataPort(9090)
m_samplesCount(0)
{
setObjectName(m_channelId);
@ -84,7 +82,7 @@ void SDRDaemonChannelSource::start()
m_sourceThread = new SDRDaemonChannelSourceThread(&m_dataQueue);
m_sourceThread->startStop(true);
m_sourceThread->dataBind(m_dataAddress, m_dataPort);
m_sourceThread->dataBind(m_settings.m_dataAddress, m_settings.m_dataPort);
m_running = true;
}
@ -102,6 +100,16 @@ void SDRDaemonChannelSource::stop()
m_running = false;
}
void SDRDaemonChannelSource::setDataLink(const QString& dataAddress, uint16_t dataPort)
{
SDRDaemonChannelSourceSettings settings = m_settings;
settings.m_dataAddress = dataAddress;
settings.m_dataPort = dataPort;
MsgConfigureSDRDaemonChannelSource *msg = MsgConfigureSDRDaemonChannelSource::create(settings, false);
m_inputMessageQueue.push(msg);
}
bool SDRDaemonChannelSource::handleMessage(const Message& cmd __attribute__((unused)))
{
if (UpChannelizer::MsgChannelizerNotification::match(cmd))
@ -161,20 +169,16 @@ void SDRDaemonChannelSource::applySettings(const SDRDaemonChannelSourceSettings&
bool change = false;
if ((m_settings.m_dataAddress != settings.m_dataAddress) || force)
{
m_dataAddress = settings.m_dataAddress;
if ((m_settings.m_dataAddress != settings.m_dataAddress) || force) {
change = true;
}
if ((m_settings.m_dataPort != settings.m_dataPort) || force)
{
m_dataPort = settings.m_dataPort;
if ((m_settings.m_dataPort != settings.m_dataPort) || force) {
change = true;
}
if (change && m_sourceThread) {
m_sourceThread->dataBind(m_dataAddress, m_dataPort);
m_sourceThread->dataBind(settings.m_dataAddress, settings.m_dataPort);
}
m_settings = settings;

View File

@ -80,6 +80,8 @@ public:
virtual QByteArray serialize() const;
virtual bool deserialize(const QByteArray& data);
void setDataLink(const QString& dataAddress, uint16_t dataPort);
static const QString m_channelIdURI;
static const QString m_channelId;
@ -96,9 +98,6 @@ private:
SDRDaemonChannelSourceSettings m_settings;
uint64_t m_samplesCount;
QString m_dataAddress;
uint16_t m_dataPort;
CM256::cm256_block m_cm256DescriptorBlocks[2*SDRDaemonNbOrginalBlocks]; //!< CM256 decoder descriptors (block addresses and block indexes)
SDRDaemonMetaDataFEC m_currentMeta;

View File

@ -107,6 +107,7 @@ SDRDaemonMain::SDRDaemonMain(qtwebapp::LoggerWithFile *logger, const SDRDaemonPa
info.noquote();
info << msg;
m_channelSource = new SDRDaemonChannelSource(m_deviceSinkAPI);
m_channelSource->setDataLink(parser.getDataAddress(), parser.getDataPort());
}
else
{