1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -05:00

SDRdaemon: channel source make updates from meta data

This commit is contained in:
f4exb 2018-08-27 02:41:06 +02:00
parent 77ed548034
commit 790a62cba3
4 changed files with 27 additions and 13 deletions

View File

@ -134,7 +134,7 @@ void SDRDaemonChannelSink::feed(const SampleVector::const_iterator& begin, const
qDebug() << "SDRDaemonChannelSink::feed: meta: "
<< "|" << metaData.m_centerFrequency
<< ":" << metaData.m_sampleRate
<< ":" << (int) metaData.m_sampleBytes
<< ":" << (int) (metaData.m_sampleBytes & 0xF)
<< ":" << (int) metaData.m_sampleBits
<< "|" << (int) metaData.m_nbOriginalBlocks
<< ":" << (int) metaData.m_nbFECBlocks

View File

@ -28,6 +28,7 @@
#include "util/simpleserializer.h"
#include "dsp/threadedbasebandsamplesource.h"
#include "dsp/upchannelizer.h"
#include "dsp/devicesamplesink.h"
#include "device/devicesinkapi.h"
#include "sdrdaemonchannelsource.h"
#include "channel/sdrdaemonchannelsourcethread.h"
@ -105,7 +106,19 @@ void SDRDaemonChannelSource::stop()
bool SDRDaemonChannelSource::handleMessage(const Message& cmd __attribute__((unused)))
{
if (MsgConfigureSDRDaemonChannelSource::match(cmd))
if (UpChannelizer::MsgChannelizerNotification::match(cmd))
{
UpChannelizer::MsgChannelizerNotification& notif = (UpChannelizer::MsgChannelizerNotification&) cmd;
qDebug() << "SDRDaemonChannelSource::handleMessage: UpChannelizer::MsgChannelizerNotification:"
<< " basebandSampleRate: " << notif.getBasebandSampleRate()
<< " outputSampleRate: " << notif.getSampleRate()
<< " inputFrequencyOffset: " << notif.getFrequencyOffset();
//applyChannelSettings(notif.getBasebandSampleRate(), notif.getSampleRate(), notif.getFrequencyOffset());
return true;
}
else if (MsgConfigureSDRDaemonChannelSource::match(cmd))
{
MsgConfigureSDRDaemonChannelSource& cfg = (MsgConfigureSDRDaemonChannelSource&) cmd;
qDebug() << "SDRDaemonChannelSource::handleMessage: MsgConfigureSDRDaemonChannelSource";
@ -242,8 +255,17 @@ bool SDRDaemonChannelSource::handleDataBlock(SDRDaemonDataBlock& dataBlock)
if (crc32.checksum() == metaData->m_crc32)
{
if (!(m_currentMeta == *metaData)) {
if (!(m_currentMeta == *metaData))
{
printMeta("SDRDaemonChannelSource::handleDataBlock", metaData);
if (m_currentMeta.m_centerFrequency != metaData->m_centerFrequency) {
m_deviceAPI->getSampleSink()->setCenterFrequency(metaData->m_centerFrequency);
}
if (m_currentMeta.m_sampleRate != metaData->m_sampleRate) {
m_channelizer->configure(m_channelizer->getInputMessageQueue(), metaData->m_sampleRate, 0);
}
}
m_currentMeta = *metaData;
@ -273,7 +295,7 @@ void SDRDaemonChannelSource::handleData()
void SDRDaemonChannelSource::printMeta(const QString& header, SDRDaemonMetaDataFEC *metaData)
{
qDebug() << header << ": "
qDebug().noquote() << header << ": "
<< "|" << metaData->m_centerFrequency
<< ":" << metaData->m_sampleRate
<< ":" << (int) (metaData->m_sampleBytes & 0xF)

View File

@ -184,14 +184,6 @@ void SDRDaemonChannelSourceThread::readPendingDatagrams()
}
m_dataBlocks[dataBlockIndex]->m_rxControlBlock.m_blockCount++;
// // if enough data blocks to decode push into data queue
// if (m_dataBlocks[dataBlockIndex]->m_rxControlBlock.m_blockCount == SDRDaemonNbOrginalBlocks)
// {
// //qDebug("SDRDaemonChannelSourceThread::readPendingDatagrams: push frame %u", superBlock.m_header.m_frameIndex);
// m_dataQueue->push(m_dataBlocks[dataBlockIndex]);
// m_dataBlocks[dataBlockIndex] = new SDRDaemonDataBlock();
// }
}
else
{

View File

@ -37,7 +37,7 @@ struct SDRDaemonMetaDataFEC
{
uint32_t m_centerFrequency; //!< 4 center frequency in kHz
uint32_t m_sampleRate; //!< 8 sample rate in Hz
uint8_t m_sampleBytes; //!< 9 number of bytes per sample (2 or 3)
uint8_t m_sampleBytes; //!< 9 4 LSB: number of bytes per sample (2 or 3)
uint8_t m_sampleBits; //!< 10 number of effective bits per sample (deprecated)
uint8_t m_nbOriginalBlocks; //!< 11 number of blocks with original (protected) data
uint8_t m_nbFECBlocks; //!< 12 number of blocks carrying FEC