mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-14 20:31:53 -05:00
DATV demod: refactored using the settings scheme
This commit is contained in:
parent
7961f50791
commit
cc8edc9e75
@ -45,7 +45,7 @@ DATVDemod::DATVDemod(DeviceSourceAPI *deviceAPI) :
|
|||||||
m_objRenderThread(nullptr),
|
m_objRenderThread(nullptr),
|
||||||
m_blnRenderingVideo(false),
|
m_blnRenderingVideo(false),
|
||||||
m_blnStartStopVideo(false),
|
m_blnStartStopVideo(false),
|
||||||
m_enmModulation(BPSK /*DATV_FM1*/),
|
m_enmModulation(DATVDemodSettings::BPSK /*DATV_FM1*/),
|
||||||
m_objSettingsMutex(QMutex::NonRecursive)
|
m_objSettingsMutex(QMutex::NonRecursive)
|
||||||
{
|
{
|
||||||
setObjectName("DATVDemod");
|
setObjectName("DATVDemod");
|
||||||
@ -153,97 +153,6 @@ bool DATVDemod::PlayVideo(bool blnStartStop)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DATVDemod::configure(MessageQueue* objMessageQueue,
|
|
||||||
int intRFBandwidth,
|
|
||||||
int intCenterFrequency,
|
|
||||||
dvb_version enmStandard,
|
|
||||||
DATVModulation enmModulation,
|
|
||||||
leansdr::code_rate enmFEC,
|
|
||||||
int intSymbolRate,
|
|
||||||
int intNotchFilters,
|
|
||||||
bool blnAllowDrift,
|
|
||||||
bool blnFastLock,
|
|
||||||
dvb_sampler enmFilter,
|
|
||||||
bool blnHardMetric,
|
|
||||||
float fltRollOff,
|
|
||||||
bool blnViterbi,
|
|
||||||
int intExcursion)
|
|
||||||
{
|
|
||||||
Message* msgCmd = MsgConfigureDATVDemod::create(
|
|
||||||
intRFBandwidth,
|
|
||||||
intCenterFrequency,
|
|
||||||
enmStandard,
|
|
||||||
enmModulation,
|
|
||||||
enmFEC,
|
|
||||||
intSymbolRate,
|
|
||||||
intNotchFilters,
|
|
||||||
blnAllowDrift,
|
|
||||||
blnFastLock,
|
|
||||||
enmFilter,
|
|
||||||
blnHardMetric,
|
|
||||||
fltRollOff,
|
|
||||||
blnViterbi,
|
|
||||||
intExcursion);
|
|
||||||
objMessageQueue->push(msgCmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DATVDemod::InitDATVParameters(int intMsps,
|
|
||||||
int intRFBandwidth,
|
|
||||||
int intCenterFrequency,
|
|
||||||
dvb_version enmStandard,
|
|
||||||
DATVModulation enmModulation,
|
|
||||||
leansdr::code_rate enmFEC,
|
|
||||||
int intSampleRate,
|
|
||||||
int intSymbolRate,
|
|
||||||
int intNotchFilters,
|
|
||||||
bool blnAllowDrift,
|
|
||||||
bool blnFastLock,
|
|
||||||
dvb_sampler enmFilter,
|
|
||||||
bool blnHardMetric,
|
|
||||||
float fltRollOff,
|
|
||||||
bool blnViterbi,
|
|
||||||
int intExcursion)
|
|
||||||
{
|
|
||||||
Real fltLowCut;
|
|
||||||
Real fltHiCut;
|
|
||||||
|
|
||||||
m_objSettingsMutex.lock();
|
|
||||||
|
|
||||||
m_blnInitialized=false;
|
|
||||||
|
|
||||||
//Bandpass filter shaping
|
|
||||||
|
|
||||||
fltLowCut = -((float)intRFBandwidth / 2.0) / (float)intMsps;
|
|
||||||
fltHiCut = ((float)intRFBandwidth / 2.0) / (float)intMsps;
|
|
||||||
m_objRFFilter->create_filter(fltLowCut, fltHiCut);
|
|
||||||
m_objNCO.setFreq(-(float)intCenterFrequency,(float)intMsps);
|
|
||||||
|
|
||||||
//Config update
|
|
||||||
|
|
||||||
m_objRunning.intMsps = intMsps;
|
|
||||||
m_objRunning.intCenterFrequency = intCenterFrequency;
|
|
||||||
m_objRunning.intRFBandwidth = intRFBandwidth;
|
|
||||||
m_objRunning.enmStandard = enmStandard;
|
|
||||||
m_objRunning.enmModulation = enmModulation;
|
|
||||||
m_objRunning.enmFEC = enmFEC;
|
|
||||||
m_objRunning.intSampleRate = intSampleRate;
|
|
||||||
m_objRunning.intSymbolRate = intSymbolRate;
|
|
||||||
m_objRunning.intNotchFilters = intNotchFilters;
|
|
||||||
m_objRunning.blnAllowDrift = blnAllowDrift;
|
|
||||||
m_objRunning.blnFastLock = blnFastLock;
|
|
||||||
m_objRunning.enmFilter = enmFilter;
|
|
||||||
m_objRunning.blnHardMetric = blnHardMetric;
|
|
||||||
m_objRunning.fltRollOff = fltRollOff;
|
|
||||||
m_objRunning.blnViterbi = blnViterbi;
|
|
||||||
m_objRunning.intExcursion = intExcursion;
|
|
||||||
|
|
||||||
m_blnInitialized=true;
|
|
||||||
|
|
||||||
m_objSettingsMutex.unlock();
|
|
||||||
|
|
||||||
m_blnNeedConfigUpdate=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DATVDemod::CleanUpDATVFramework(bool blnRelease)
|
void DATVDemod::CleanUpDATVFramework(bool blnRelease)
|
||||||
{
|
{
|
||||||
if (blnRelease == true)
|
if (blnRelease == true)
|
||||||
@ -516,59 +425,59 @@ void DATVDemod::InitDATVFramework()
|
|||||||
m_lngReadIQ = 0;
|
m_lngReadIQ = 0;
|
||||||
CleanUpDATVFramework(false);
|
CleanUpDATVFramework(false);
|
||||||
|
|
||||||
qDebug() << "DATVDemod::InitDATVParameters:"
|
qDebug() << "DATVDemod::InitDATVFramework:"
|
||||||
<< " Msps: " << m_objRunning.intMsps
|
<< " Msps: " << m_settings.m_msps
|
||||||
<< " Sample Rate: " << m_objRunning.intSampleRate
|
<< " Sample Rate: " << m_settings.m_sampleRate
|
||||||
<< " Symbol Rate: " << m_objRunning.intSymbolRate
|
<< " Symbol Rate: " << m_settings.m_symbolRate
|
||||||
<< " Modulation: " << m_objRunning.enmModulation
|
<< " Modulation: " << m_settings.m_modulation
|
||||||
<< " Notch Filters: " << m_objRunning.intNotchFilters
|
<< " Notch Filters: " << m_settings.m_notchFilters
|
||||||
<< " Allow Drift: " << m_objRunning.blnAllowDrift
|
<< " Allow Drift: " << m_settings.m_allowDrift
|
||||||
<< " Fast Lock: " << m_objRunning.blnFastLock
|
<< " Fast Lock: " << m_settings.m_fastLock
|
||||||
<< " Filter: " << m_objRunning.enmFilter
|
<< " Filter: " << m_settings.m_filter
|
||||||
<< " HARD METRIC: " << m_objRunning.blnHardMetric
|
<< " HARD METRIC: " << m_settings.m_hardMetric
|
||||||
<< " RollOff: " << m_objRunning.fltRollOff
|
<< " RollOff: " << m_settings.m_rollOff
|
||||||
<< " Viterbi: " << m_objRunning.blnViterbi
|
<< " Viterbi: " << m_settings.m_viterbi
|
||||||
<< " Excursion: " << m_objRunning.intExcursion;
|
<< " Excursion: " << m_settings.m_excursion;
|
||||||
|
|
||||||
m_objCfg.standard = m_objRunning.enmStandard;
|
m_objCfg.standard = m_settings.m_standard;
|
||||||
|
|
||||||
m_objCfg.fec = m_objRunning.enmFEC;
|
m_objCfg.fec = m_settings.m_fec;
|
||||||
m_objCfg.Fs = (float) m_objRunning.intSampleRate;
|
m_objCfg.Fs = (float) m_settings.m_sampleRate;
|
||||||
m_objCfg.Fm = (float) m_objRunning.intSymbolRate;
|
m_objCfg.Fm = (float) m_settings.m_symbolRate;
|
||||||
m_objCfg.fastlock = m_objRunning.blnFastLock;
|
m_objCfg.fastlock = m_settings.m_fastLock;
|
||||||
|
|
||||||
m_objCfg.sampler = m_objRunning.enmFilter;
|
m_objCfg.sampler = m_settings.m_filter;
|
||||||
m_objCfg.rolloff = m_objRunning.fltRollOff; //0...1
|
m_objCfg.rolloff = m_settings.m_rollOff; //0...1
|
||||||
m_objCfg.rrc_rej = (float) m_objRunning.intExcursion; //dB
|
m_objCfg.rrc_rej = (float) m_settings.m_excursion; //dB
|
||||||
m_objCfg.rrc_steps = 0; //auto
|
m_objCfg.rrc_steps = 0; //auto
|
||||||
|
|
||||||
switch(m_objRunning.enmModulation)
|
switch(m_settings.m_modulation)
|
||||||
{
|
{
|
||||||
case BPSK:
|
case DATVDemodSettings::BPSK:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::BPSK;
|
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::BPSK;
|
||||||
break;
|
break;
|
||||||
case QPSK:
|
case DATVDemodSettings::QPSK:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::QPSK;
|
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::QPSK;
|
||||||
break;
|
break;
|
||||||
case PSK8:
|
case DATVDemodSettings::PSK8:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::PSK8;
|
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::PSK8;
|
||||||
break;
|
break;
|
||||||
case APSK16:
|
case DATVDemodSettings::APSK16:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::APSK16;
|
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::APSK16;
|
||||||
break;
|
break;
|
||||||
case APSK32:
|
case DATVDemodSettings::APSK32:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::APSK32;
|
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::APSK32;
|
||||||
break;
|
break;
|
||||||
case APSK64E:
|
case DATVDemodSettings::APSK64E:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::APSK64E;
|
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::APSK64E;
|
||||||
break;
|
break;
|
||||||
case QAM16:
|
case DATVDemodSettings::QAM16:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::QAM16;
|
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::QAM16;
|
||||||
break;
|
break;
|
||||||
case QAM64:
|
case DATVDemodSettings::QAM64:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::QAM64;
|
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::QAM64;
|
||||||
break;
|
break;
|
||||||
case QAM256:
|
case DATVDemodSettings::QAM256:
|
||||||
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::QAM256;
|
m_objCfg.constellation = leansdr::cstln_lut<leansdr::eucl_ss, 256>::QAM256;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -576,12 +485,11 @@ void DATVDemod::InitDATVFramework()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_objCfg.allow_drift = m_objRunning.blnAllowDrift;
|
m_objCfg.allow_drift = m_settings.m_allowDrift;
|
||||||
m_objCfg.anf = m_objRunning.intNotchFilters;
|
m_objCfg.anf = m_settings.m_notchFilters;
|
||||||
m_objCfg.hard_metric = m_objRunning.blnHardMetric;
|
m_objCfg.hard_metric = m_settings.m_hardMetric;
|
||||||
m_objCfg.sampler = m_objRunning.enmFilter;
|
m_objCfg.sampler = m_settings.m_filter;
|
||||||
m_objCfg.viterbi = m_objRunning.blnViterbi;
|
m_objCfg.viterbi = m_settings.m_viterbi;
|
||||||
|
|
||||||
|
|
||||||
// Min buffer size for baseband data
|
// Min buffer size for baseband data
|
||||||
// scopes: 1024
|
// scopes: 1024
|
||||||
@ -670,13 +578,13 @@ void DATVDemod::InitDATVFramework()
|
|||||||
|
|
||||||
switch (m_objCfg.sampler)
|
switch (m_objCfg.sampler)
|
||||||
{
|
{
|
||||||
case SAMP_NEAREST:
|
case DATVDemodSettings::SAMP_NEAREST:
|
||||||
sampler = new leansdr::nearest_sampler<float>();
|
sampler = new leansdr::nearest_sampler<float>();
|
||||||
break;
|
break;
|
||||||
case SAMP_LINEAR:
|
case DATVDemodSettings::SAMP_LINEAR:
|
||||||
sampler = new leansdr::linear_sampler<float>();
|
sampler = new leansdr::linear_sampler<float>();
|
||||||
break;
|
break;
|
||||||
case SAMP_RRC:
|
case DATVDemodSettings::SAMP_RRC:
|
||||||
{
|
{
|
||||||
if (m_objCfg.rrc_steps == 0)
|
if (m_objCfg.rrc_steps == 0)
|
||||||
{
|
{
|
||||||
@ -706,7 +614,7 @@ void DATVDemod::InitDATVFramework()
|
|||||||
p_mer,
|
p_mer,
|
||||||
p_sampled);
|
p_sampled);
|
||||||
|
|
||||||
if (m_objCfg.standard == DVB_S)
|
if (m_objCfg.standard == DATVDemodSettings::DVB_S)
|
||||||
{
|
{
|
||||||
if ( m_objCfg.constellation != leansdr::cstln_lut<leansdr::eucl_ss, 256>::QPSK
|
if ( m_objCfg.constellation != leansdr::cstln_lut<leansdr::eucl_ss, 256>::QPSK
|
||||||
&& m_objCfg.constellation != leansdr::cstln_lut<leansdr::eucl_ss, 256>::BPSK )
|
&& m_objCfg.constellation != leansdr::cstln_lut<leansdr::eucl_ss, 256>::BPSK )
|
||||||
@ -715,7 +623,7 @@ void DATVDemod::InitDATVFramework()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_objCfg.standard == DVB_S2)
|
if (m_objCfg.standard == DATVDemodSettings::DVB_S2)
|
||||||
{
|
{
|
||||||
// For DVB-S2 testing only.
|
// For DVB-S2 testing only.
|
||||||
// Constellation should be determined from PL signalling.
|
// Constellation should be determined from PL signalling.
|
||||||
@ -947,14 +855,7 @@ bool DATVDemod::handleMessage(const Message& cmd)
|
|||||||
qDebug() << "DATVDemod::handleMessage: MsgChannelizerNotification:"
|
qDebug() << "DATVDemod::handleMessage: MsgChannelizerNotification:"
|
||||||
<< " m_intSampleRate: " << objNotif.getSampleRate()
|
<< " m_intSampleRate: " << objNotif.getSampleRate()
|
||||||
<< " m_intFrequencyOffset: " << objNotif.getFrequencyOffset();
|
<< " m_intFrequencyOffset: " << objNotif.getFrequencyOffset();
|
||||||
|
applyChannelSettings(objNotif.getSampleRate(), objNotif.getFrequencyOffset());
|
||||||
if (m_objRunning.intMsps != objNotif.getSampleRate())
|
|
||||||
{
|
|
||||||
m_objRunning.intMsps = objNotif.getSampleRate();
|
|
||||||
m_objRunning.intSampleRate = m_objRunning.intMsps;
|
|
||||||
|
|
||||||
ApplySettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -974,57 +875,8 @@ bool DATVDemod::handleMessage(const Message& cmd)
|
|||||||
else if (MsgConfigureDATVDemod::match(cmd))
|
else if (MsgConfigureDATVDemod::match(cmd))
|
||||||
{
|
{
|
||||||
MsgConfigureDATVDemod& objCfg = (MsgConfigureDATVDemod&) cmd;
|
MsgConfigureDATVDemod& objCfg = (MsgConfigureDATVDemod&) cmd;
|
||||||
|
qDebug() << "DATVDemod::handleMessage: MsgConfigureDATVDemod";
|
||||||
|
applySettings(objCfg.getSettings(), objCfg.getForce());
|
||||||
if ((objCfg.m_objMsgConfig.blnAllowDrift != m_objRunning.blnAllowDrift)
|
|
||||||
|| (objCfg.m_objMsgConfig.intRFBandwidth != m_objRunning.intRFBandwidth)
|
|
||||||
|| (objCfg.m_objMsgConfig.intCenterFrequency != m_objRunning.intCenterFrequency)
|
|
||||||
|| (objCfg.m_objMsgConfig.blnFastLock != m_objRunning.blnFastLock)
|
|
||||||
|| (objCfg.m_objMsgConfig.blnHardMetric != m_objRunning.blnHardMetric)
|
|
||||||
|| (objCfg.m_objMsgConfig.enmFilter != m_objRunning.enmFilter)
|
|
||||||
|| (objCfg.m_objMsgConfig.fltRollOff != m_objRunning.fltRollOff)
|
|
||||||
|| (objCfg.m_objMsgConfig.blnViterbi != m_objRunning.blnViterbi)
|
|
||||||
|| (objCfg.m_objMsgConfig.enmFEC != m_objRunning.enmFEC)
|
|
||||||
|| (objCfg.m_objMsgConfig.enmModulation != m_objRunning.enmModulation)
|
|
||||||
|| (objCfg.m_objMsgConfig.enmStandard != m_objRunning.enmStandard)
|
|
||||||
|| (objCfg.m_objMsgConfig.intNotchFilters != m_objRunning.intNotchFilters)
|
|
||||||
|| (objCfg.m_objMsgConfig.intSymbolRate != m_objRunning.intSymbolRate)
|
|
||||||
|| (objCfg.m_objMsgConfig.intExcursion != m_objRunning.intExcursion))
|
|
||||||
{
|
|
||||||
m_objRunning.blnAllowDrift = objCfg.m_objMsgConfig.blnAllowDrift;
|
|
||||||
m_objRunning.blnFastLock = objCfg.m_objMsgConfig.blnFastLock;
|
|
||||||
m_objRunning.blnHardMetric = objCfg.m_objMsgConfig.blnHardMetric;
|
|
||||||
m_objRunning.enmFilter = objCfg.m_objMsgConfig.enmFilter;
|
|
||||||
m_objRunning.fltRollOff = objCfg.m_objMsgConfig.fltRollOff;
|
|
||||||
m_objRunning.blnViterbi = objCfg.m_objMsgConfig.blnViterbi;
|
|
||||||
m_objRunning.enmFEC = objCfg.m_objMsgConfig.enmFEC;
|
|
||||||
m_objRunning.enmModulation = objCfg.m_objMsgConfig.enmModulation;
|
|
||||||
m_objRunning.enmStandard = objCfg.m_objMsgConfig.enmStandard;
|
|
||||||
m_objRunning.intNotchFilters = objCfg.m_objMsgConfig.intNotchFilters;
|
|
||||||
m_objRunning.intSymbolRate = objCfg.m_objMsgConfig.intSymbolRate;
|
|
||||||
m_objRunning.intRFBandwidth = objCfg.m_objMsgConfig.intRFBandwidth;
|
|
||||||
m_objRunning.intCenterFrequency = objCfg.m_objMsgConfig.intCenterFrequency;
|
|
||||||
m_objRunning.intExcursion = objCfg.m_objMsgConfig.intExcursion;
|
|
||||||
|
|
||||||
qDebug() << "ATVDemod::handleMessage: MsgConfigureDATVDemod:"
|
|
||||||
<< " blnAllowDrift: " << objCfg.m_objMsgConfig.blnAllowDrift
|
|
||||||
<< " intRFBandwidth: " << objCfg.m_objMsgConfig.intRFBandwidth
|
|
||||||
<< " intCenterFrequency: " << objCfg.m_objMsgConfig.intCenterFrequency
|
|
||||||
<< " blnFastLock: " << objCfg.m_objMsgConfig.blnFastLock
|
|
||||||
<< " enmFilter: " << objCfg.m_objMsgConfig.enmFilter
|
|
||||||
<< " fltRollOff: " << objCfg.m_objMsgConfig.fltRollOff
|
|
||||||
<< " blnViterbi: " << objCfg.m_objMsgConfig.blnViterbi
|
|
||||||
<< " enmFEC: " << objCfg.m_objMsgConfig.enmFEC
|
|
||||||
<< " enmModulation: " << objCfg.m_objMsgConfig.enmModulation
|
|
||||||
<< " enmStandard: " << objCfg.m_objMsgConfig.enmStandard
|
|
||||||
<< " intNotchFilters: " << objCfg.m_objMsgConfig.intNotchFilters
|
|
||||||
<< " intSymbolRate: " << objCfg.m_objMsgConfig.intSymbolRate
|
|
||||||
<< " intRFBandwidth: " << objCfg.m_objMsgConfig.intRFBandwidth
|
|
||||||
<< " intCenterFrequency: " << objCfg.m_objMsgConfig.intCenterFrequency
|
|
||||||
<< " intExcursion: " << objCfg.m_objMsgConfig.intExcursion;
|
|
||||||
|
|
||||||
ApplySettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1034,31 +886,95 @@ bool DATVDemod::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DATVDemod::ApplySettings()
|
void DATVDemod::applyChannelSettings(int inputSampleRate, int inputFrequencyOffset, bool force)
|
||||||
{
|
{
|
||||||
if (m_objRunning.intMsps == 0) {
|
qDebug() << "DATVDemod::applyChannelSettings:"
|
||||||
|
<< " inputSampleRate: " << inputSampleRate
|
||||||
|
<< " inputFrequencyOffset: " << inputFrequencyOffset;
|
||||||
|
|
||||||
|
if ((m_settings.m_centerFrequency != inputFrequencyOffset) ||
|
||||||
|
(m_settings.m_msps != inputSampleRate) || force)
|
||||||
|
{
|
||||||
|
m_objNCO.setFreq(-(float) inputFrequencyOffset, (float) inputSampleRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_msps != inputSampleRate) || force)
|
||||||
|
{
|
||||||
|
m_objSettingsMutex.lock();
|
||||||
|
//Bandpass filter shaping
|
||||||
|
Real fltLowCut = -((float) m_settings.m_rfBandwidth / 2.0) / (float) inputSampleRate;
|
||||||
|
Real fltHiCut = ((float) m_settings.m_rfBandwidth / 2.0) / (float) inputSampleRate;
|
||||||
|
m_objRFFilter->create_filter(fltLowCut, fltHiCut);
|
||||||
|
m_blnNeedConfigUpdate = true;
|
||||||
|
m_objSettingsMutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_settings.m_msps = inputSampleRate;
|
||||||
|
m_settings.m_sampleRate = m_settings.m_msps;
|
||||||
|
m_settings.m_centerFrequency = inputFrequencyOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DATVDemod::applySettings(const DATVDemodSettings& settings, bool force)
|
||||||
|
{
|
||||||
|
QString msg = tr("DATVDemod::applySettings: force: %1").arg(force);
|
||||||
|
settings.debug(msg);
|
||||||
|
|
||||||
|
if (m_settings.m_msps == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
InitDATVParameters(m_objRunning.intMsps,
|
if (m_settings.isDifferent(settings) || force)
|
||||||
m_objRunning.intRFBandwidth,
|
{
|
||||||
m_objRunning.intCenterFrequency,
|
m_objSettingsMutex.lock();
|
||||||
m_objRunning.enmStandard,
|
|
||||||
m_objRunning.enmModulation,
|
if ((m_settings.m_rfBandwidth != settings.m_rfBandwidth)
|
||||||
m_objRunning.enmFEC,
|
|| force)
|
||||||
m_objRunning.intSampleRate,
|
{
|
||||||
m_objRunning.intSymbolRate,
|
|
||||||
m_objRunning.intNotchFilters,
|
//Bandpass filter shaping
|
||||||
m_objRunning.blnAllowDrift,
|
Real fltLowCut = -((float) settings.m_rfBandwidth / 2.0) / (float) m_settings.m_msps;
|
||||||
m_objRunning.blnFastLock,
|
Real fltHiCut = ((float) settings.m_rfBandwidth / 2.0) / (float) m_settings.m_msps;
|
||||||
m_objRunning.enmFilter,
|
m_objRFFilter->create_filter(fltLowCut, fltHiCut);
|
||||||
m_objRunning.blnHardMetric,
|
}
|
||||||
m_objRunning.fltRollOff,
|
|
||||||
m_objRunning.blnViterbi,
|
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|
||||||
m_objRunning.intExcursion);
|
|| force)
|
||||||
|
{
|
||||||
|
m_objNCO.setFreq(-(float) settings.m_centerFrequency, (float) m_settings.m_msps);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_objSettingsMutex.unlock();
|
||||||
|
m_blnNeedConfigUpdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// void DATVDemod::ApplySettings()
|
||||||
|
// {
|
||||||
|
// if (m_objRunning.intMsps == 0) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// InitDATVParameters(m_objRunning.intMsps,
|
||||||
|
// m_objRunning.intRFBandwidth,
|
||||||
|
// m_objRunning.intCenterFrequency,
|
||||||
|
// m_objRunning.enmStandard,
|
||||||
|
// m_objRunning.enmModulation,
|
||||||
|
// m_objRunning.enmFEC,
|
||||||
|
// m_objRunning.intSampleRate,
|
||||||
|
// m_objRunning.intSymbolRate,
|
||||||
|
// m_objRunning.intNotchFilters,
|
||||||
|
// m_objRunning.blnAllowDrift,
|
||||||
|
// m_objRunning.blnFastLock,
|
||||||
|
// m_objRunning.enmFilter,
|
||||||
|
// m_objRunning.blnHardMetric,
|
||||||
|
// m_objRunning.fltRollOff,
|
||||||
|
// m_objRunning.blnViterbi,
|
||||||
|
// m_objRunning.intExcursion);
|
||||||
|
// }
|
||||||
|
|
||||||
int DATVDemod::GetSampleRate()
|
int DATVDemod::GetSampleRate()
|
||||||
{
|
{
|
||||||
return m_objRunning.intMsps;
|
return m_settings.m_msps;
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ class DownChannelizer;
|
|||||||
#include "datvvideoplayer.h"
|
#include "datvvideoplayer.h"
|
||||||
#include "datvideostream.h"
|
#include "datvideostream.h"
|
||||||
#include "datvideorender.h"
|
#include "datvideorender.h"
|
||||||
|
#include "datvdemodsettings.h"
|
||||||
|
|
||||||
#include "channel/channelsinkapi.h"
|
#include "channel/channelsinkapi.h"
|
||||||
#include "dsp/basebandsamplesink.h"
|
#include "dsp/basebandsamplesink.h"
|
||||||
@ -58,16 +59,16 @@ class DownChannelizer;
|
|||||||
|
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
|
||||||
enum DATVModulation { BPSK, QPSK, PSK8, APSK16, APSK32, APSK64E, QAM16, QAM64, QAM256 };
|
// enum DATVModulation { BPSK, QPSK, PSK8, APSK16, APSK32, APSK64E, QAM16, QAM64, QAM256 };
|
||||||
enum dvb_version { DVB_S, DVB_S2 };
|
// enum dvb_version { DVB_S, DVB_S2 };
|
||||||
enum dvb_sampler { SAMP_NEAREST, SAMP_LINEAR, SAMP_RRC };
|
// enum dvb_sampler { SAMP_NEAREST, SAMP_LINEAR, SAMP_RRC };
|
||||||
|
|
||||||
inline int decimation(float Fin, float Fout) { int d = Fin / Fout; return std::max(d, 1); }
|
inline int decimation(float Fin, float Fout) { int d = Fin / Fout; return std::max(d, 1); }
|
||||||
|
|
||||||
struct config
|
struct config
|
||||||
{
|
{
|
||||||
dvb_version standard;
|
DATVDemodSettings::dvb_version standard;
|
||||||
dvb_sampler sampler;
|
DATVDemodSettings::dvb_sampler sampler;
|
||||||
|
|
||||||
int buf_factor; // Buffer sizing
|
int buf_factor; // Buffer sizing
|
||||||
float Fs; // Sampling frequency (Hz)
|
float Fs; // Sampling frequency (Hz)
|
||||||
@ -93,8 +94,8 @@ struct config
|
|||||||
float Finfo; // Desired refresh rate on fd_info (Hz)
|
float Finfo; // Desired refresh rate on fd_info (Hz)
|
||||||
|
|
||||||
config() :
|
config() :
|
||||||
standard(DVB_S),
|
standard(DATVDemodSettings::DVB_S),
|
||||||
sampler(SAMP_LINEAR),
|
sampler(DATVDemodSettings::SAMP_LINEAR),
|
||||||
buf_factor(4),
|
buf_factor(4),
|
||||||
Fs(2.4e6),
|
Fs(2.4e6),
|
||||||
Fderot(0),
|
Fderot(0),
|
||||||
@ -121,48 +122,6 @@ struct config
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct DATVConfig
|
|
||||||
{
|
|
||||||
int intMsps;
|
|
||||||
int intRFBandwidth;
|
|
||||||
int intCenterFrequency;
|
|
||||||
dvb_version enmStandard;
|
|
||||||
DATVModulation enmModulation;
|
|
||||||
leansdr::code_rate enmFEC;
|
|
||||||
int intSampleRate;
|
|
||||||
int intSymbolRate;
|
|
||||||
int intNotchFilters;
|
|
||||||
bool blnAllowDrift;
|
|
||||||
bool blnFastLock;
|
|
||||||
dvb_sampler enmFilter;
|
|
||||||
bool blnHardMetric;
|
|
||||||
float fltRollOff;
|
|
||||||
bool blnViterbi;
|
|
||||||
int intExcursion;
|
|
||||||
|
|
||||||
DATVConfig() :
|
|
||||||
intMsps(1024000),
|
|
||||||
intRFBandwidth(1024000),
|
|
||||||
intCenterFrequency(0),
|
|
||||||
enmStandard(DVB_S),
|
|
||||||
enmModulation(BPSK),
|
|
||||||
enmFEC(leansdr::FEC12),
|
|
||||||
intSampleRate(1024000),
|
|
||||||
intSymbolRate(250000),
|
|
||||||
intNotchFilters(1),
|
|
||||||
blnAllowDrift(false),
|
|
||||||
blnFastLock(false),
|
|
||||||
enmFilter(SAMP_LINEAR),
|
|
||||||
blnHardMetric(false),
|
|
||||||
fltRollOff(0.35),
|
|
||||||
blnViterbi(false),
|
|
||||||
intExcursion(10)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class DATVDemod : public BasebandSampleSink, public ChannelSinkAPI
|
class DATVDemod : public BasebandSampleSink, public ChannelSinkAPI
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -175,28 +134,11 @@ public:
|
|||||||
virtual void destroy() { delete this; }
|
virtual void destroy() { delete this; }
|
||||||
virtual void getIdentifier(QString& id) { id = objectName(); }
|
virtual void getIdentifier(QString& id) { id = objectName(); }
|
||||||
virtual void getTitle(QString& title) { title = objectName(); }
|
virtual void getTitle(QString& title) { title = objectName(); }
|
||||||
virtual qint64 getCenterFrequency() const { return m_objRunning.intCenterFrequency; }
|
virtual qint64 getCenterFrequency() const { return m_settings.m_centerFrequency; }
|
||||||
|
|
||||||
virtual QByteArray serialize() const { return QByteArray(); }
|
virtual QByteArray serialize() const { return QByteArray(); }
|
||||||
virtual bool deserialize(const QByteArray& data) { (void) data; return false; }
|
virtual bool deserialize(const QByteArray& data) { (void) data; return false; }
|
||||||
|
|
||||||
void configure(
|
|
||||||
MessageQueue* objMessageQueue,
|
|
||||||
int intRFBandwidth,
|
|
||||||
int intCenterFrequency,
|
|
||||||
dvb_version enmStandard,
|
|
||||||
DATVModulation enmModulation,
|
|
||||||
leansdr::code_rate enmFEC,
|
|
||||||
int intSymbolRate,
|
|
||||||
int intNotchFilters,
|
|
||||||
bool blnAllowDrift,
|
|
||||||
bool blnFastLock,
|
|
||||||
dvb_sampler enmFilter,
|
|
||||||
bool blnHardMetric,
|
|
||||||
float fltRollOff,
|
|
||||||
bool blnViterbi,
|
|
||||||
int intfltExcursion);
|
|
||||||
|
|
||||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
||||||
virtual void start();
|
virtual void start();
|
||||||
virtual void stop();
|
virtual void stop();
|
||||||
@ -211,15 +153,15 @@ public:
|
|||||||
int intMsps,
|
int intMsps,
|
||||||
int intRFBandwidth,
|
int intRFBandwidth,
|
||||||
int intCenterFrequency,
|
int intCenterFrequency,
|
||||||
dvb_version enmStandard,
|
DATVDemodSettings::dvb_version enmStandard,
|
||||||
DATVModulation enmModulation,
|
DATVDemodSettings::DATVModulation enmModulation,
|
||||||
leansdr::code_rate enmFEC,
|
leansdr::code_rate enmFEC,
|
||||||
int intSampleRate,
|
int intSampleRate,
|
||||||
int intSymbolRate,
|
int intSymbolRate,
|
||||||
int intNotchFilters,
|
int intNotchFilters,
|
||||||
bool blnAllowDrift,
|
bool blnAllowDrift,
|
||||||
bool blnFastLock,
|
bool blnFastLock,
|
||||||
dvb_sampler enmFilter,
|
DATVDemodSettings::dvb_sampler enmFilter,
|
||||||
bool blnHardMetric,
|
bool blnHardMetric,
|
||||||
float fltRollOff,
|
float fltRollOff,
|
||||||
bool blnViterbi,
|
bool blnViterbi,
|
||||||
@ -253,82 +195,30 @@ public:
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
class MsgConfigureDATVDemod : public Message {
|
||||||
class MsgConfigureDATVDemod : public Message
|
|
||||||
{
|
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static MsgConfigureDATVDemod* create(
|
const DATVDemodSettings& getSettings() const { return m_settings; }
|
||||||
int intRFBandwidth,
|
bool getForce() const { return m_force; }
|
||||||
int intCenterFrequency,
|
|
||||||
dvb_version enmStandard,
|
|
||||||
DATVModulation enmModulation,
|
|
||||||
leansdr::code_rate enmFEC,
|
|
||||||
int intSymbolRate,
|
|
||||||
int intNotchFilters,
|
|
||||||
bool blnAllowDrift,
|
|
||||||
bool blnFastLock,
|
|
||||||
dvb_sampler enmFilter,
|
|
||||||
bool blnHardMetric,
|
|
||||||
float fltRollOff,
|
|
||||||
bool blnViterbi,
|
|
||||||
int intExcursion)
|
|
||||||
{
|
|
||||||
return new MsgConfigureDATVDemod(
|
|
||||||
intRFBandwidth,
|
|
||||||
intCenterFrequency,
|
|
||||||
enmStandard,
|
|
||||||
enmModulation,
|
|
||||||
enmFEC,
|
|
||||||
intSymbolRate,
|
|
||||||
intNotchFilters,
|
|
||||||
blnAllowDrift,
|
|
||||||
blnFastLock,
|
|
||||||
enmFilter,
|
|
||||||
blnHardMetric,
|
|
||||||
fltRollOff,
|
|
||||||
blnViterbi,
|
|
||||||
intExcursion);
|
|
||||||
}
|
|
||||||
|
|
||||||
DATVConfig m_objMsgConfig;
|
static MsgConfigureDATVDemod* create(const DATVDemodSettings& settings, bool force)
|
||||||
|
{
|
||||||
|
return new MsgConfigureDATVDemod(settings, force);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MsgConfigureDATVDemod(
|
DATVDemodSettings m_settings;
|
||||||
int intRFBandwidth,
|
bool m_force;
|
||||||
int intCenterFrequency,
|
|
||||||
dvb_version enmStandard,
|
MsgConfigureDATVDemod(const DATVDemodSettings& settings, bool force) :
|
||||||
DATVModulation enmModulation,
|
Message(),
|
||||||
leansdr::code_rate enmFEC,
|
m_settings(settings),
|
||||||
int intSymbolRate,
|
m_force(force)
|
||||||
int intNotchFilters,
|
{ }
|
||||||
bool blnAllowDrift,
|
|
||||||
bool blnFastLock,
|
|
||||||
dvb_sampler enmFilter,
|
|
||||||
bool blnHardMetric,
|
|
||||||
float fltRollOff,
|
|
||||||
bool blnViterbi,
|
|
||||||
int intExcursion) :
|
|
||||||
Message()
|
|
||||||
{
|
|
||||||
m_objMsgConfig.intRFBandwidth = intRFBandwidth;
|
|
||||||
m_objMsgConfig.intCenterFrequency = intCenterFrequency;
|
|
||||||
m_objMsgConfig.enmStandard = enmStandard;
|
|
||||||
m_objMsgConfig.enmModulation = enmModulation;
|
|
||||||
m_objMsgConfig.enmFEC = enmFEC;
|
|
||||||
m_objMsgConfig.intSymbolRate = intSymbolRate;
|
|
||||||
m_objMsgConfig.intNotchFilters = intNotchFilters;
|
|
||||||
m_objMsgConfig.blnAllowDrift = blnAllowDrift;
|
|
||||||
m_objMsgConfig.blnFastLock = blnFastLock;
|
|
||||||
m_objMsgConfig.enmFilter= enmFilter;
|
|
||||||
m_objMsgConfig.blnHardMetric = blnHardMetric;
|
|
||||||
m_objMsgConfig.fltRollOff = fltRollOff;
|
|
||||||
m_objMsgConfig.blnViterbi = blnViterbi;
|
|
||||||
m_objMsgConfig.intExcursion = intExcursion;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
unsigned long m_lngExpectedReadIQ;
|
unsigned long m_lngExpectedReadIQ;
|
||||||
long m_lngReadIQ;
|
long m_lngReadIQ;
|
||||||
|
|
||||||
@ -455,14 +345,17 @@ private:
|
|||||||
bool m_blnRenderingVideo;
|
bool m_blnRenderingVideo;
|
||||||
bool m_blnStartStopVideo;
|
bool m_blnStartStopVideo;
|
||||||
|
|
||||||
DATVModulation m_enmModulation;
|
DATVDemodSettings::DATVModulation m_enmModulation;
|
||||||
|
|
||||||
DATVConfig m_objRunning;
|
//DATVConfig m_objRunning;
|
||||||
|
DATVDemodSettings m_settings;
|
||||||
MovingAverageUtil<double, double, 32> m_objMagSqAverage;
|
MovingAverageUtil<double, double, 32> m_objMagSqAverage;
|
||||||
|
|
||||||
QMutex m_objSettingsMutex;
|
QMutex m_objSettingsMutex;
|
||||||
|
|
||||||
void ApplySettings();
|
//void ApplySettings();
|
||||||
|
void applySettings(const DATVDemodSettings& settings, bool force = false);
|
||||||
|
void applyChannelSettings(int inputSampleRate, int inputFrequencyOffset, bool force = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_DATVDEMOD_H
|
#endif // INCLUDE_DATVDEMOD_H
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include <QMediaMetaData>
|
#include <QMediaMetaData>
|
||||||
|
|
||||||
#include "datvdemodgui.h"
|
#include "datvdemodgui.h"
|
||||||
//#include "datvideostream.h"
|
|
||||||
|
|
||||||
#include "device/devicesourceapi.h"
|
#include "device/devicesourceapi.h"
|
||||||
#include "device/deviceuiset.h"
|
#include "device/deviceuiset.h"
|
||||||
@ -74,142 +73,22 @@ void DATVDemodGUI::setCenterFrequency(qint64 intCenterFrequency)
|
|||||||
|
|
||||||
void DATVDemodGUI::resetToDefaults()
|
void DATVDemodGUI::resetToDefaults()
|
||||||
{
|
{
|
||||||
blockApplySettings(true);
|
m_settings.resetToDefaults();
|
||||||
|
displaySettings();
|
||||||
ui->chkAllowDrift->setChecked(false);
|
applySettings(true);
|
||||||
ui->chkFastlock->setChecked(true);
|
|
||||||
ui->chkHardMetric->setChecked(false);
|
|
||||||
ui->chkViterbi->setChecked(false);
|
|
||||||
|
|
||||||
ui->cmbFEC->setCurrentIndex(0);
|
|
||||||
ui->cmbModulation->setCurrentIndex(0);
|
|
||||||
ui->cmbStandard->setCurrentIndex(0);
|
|
||||||
ui->cmbFilter->setCurrentIndex(0);
|
|
||||||
displayRRCParameters(false);
|
|
||||||
|
|
||||||
ui->spiNotchFilters->setValue(0);
|
|
||||||
ui->prgSynchro->setValue(0);
|
|
||||||
|
|
||||||
ui->lblStatus->setText("");
|
|
||||||
|
|
||||||
ui->rfBandwidth->setValue(512000);
|
|
||||||
ui->spiSymbolRate->setValue(250000);
|
|
||||||
ui->spiRollOff->setValue(35);
|
|
||||||
ui->spiExcursion->setValue(10);
|
|
||||||
|
|
||||||
|
|
||||||
blockApplySettings(false);
|
|
||||||
|
|
||||||
applySettings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray DATVDemodGUI::serialize() const
|
QByteArray DATVDemodGUI::serialize() const
|
||||||
{
|
{
|
||||||
SimpleSerializer s(1);
|
return m_settings.serialize();
|
||||||
|
|
||||||
s.writeS32(1, m_objChannelMarker.getCenterFrequency());
|
|
||||||
s.writeU32(2, m_objChannelMarker.getColor().rgb());
|
|
||||||
|
|
||||||
s.writeBool(3, ui->chkAllowDrift->isChecked());
|
|
||||||
s.writeBool(4, ui->chkFastlock->isChecked());
|
|
||||||
s.writeS32(5, ui->cmbFilter->currentIndex());
|
|
||||||
s.writeBool(6, ui->chkHardMetric->isChecked());
|
|
||||||
s.writeS32(7, ui->spiRollOff->value());
|
|
||||||
s.writeBool(8, ui->chkViterbi->isChecked());
|
|
||||||
|
|
||||||
s.writeS32(9, ui->cmbFEC->currentIndex());
|
|
||||||
s.writeS32(10, ui->cmbModulation->currentIndex());
|
|
||||||
s.writeS32(11, ui->cmbStandard->currentIndex());
|
|
||||||
|
|
||||||
s.writeS32(12, ui->spiNotchFilters->value());
|
|
||||||
s.writeS64(13, ui->rfBandwidth->getValue());
|
|
||||||
s.writeS32(14, ui->spiSymbolRate->value());
|
|
||||||
s.writeS32(15, ui->spiExcursion->value());
|
|
||||||
|
|
||||||
return s.final();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DATVDemodGUI::deserialize(const QByteArray& arrData)
|
bool DATVDemodGUI::deserialize(const QByteArray& arrData)
|
||||||
{
|
{
|
||||||
SimpleDeserializer d(arrData);
|
if (m_settings.deserialize(arrData))
|
||||||
|
|
||||||
if (!d.isValid())
|
|
||||||
{
|
{
|
||||||
resetToDefaults();
|
displaySettings();
|
||||||
return false;
|
applySettings(true);
|
||||||
}
|
|
||||||
|
|
||||||
if (d.getVersion() == 1)
|
|
||||||
{
|
|
||||||
QByteArray bytetmp;
|
|
||||||
uint32_t u32tmp;
|
|
||||||
qint64 i64tmp;
|
|
||||||
int tmp;
|
|
||||||
bool booltmp;
|
|
||||||
|
|
||||||
blockApplySettings(true);
|
|
||||||
m_objChannelMarker.blockSignals(true);
|
|
||||||
|
|
||||||
d.readS32(1, &tmp, 0);
|
|
||||||
m_objChannelMarker.setCenterFrequency(tmp);
|
|
||||||
ui->deltaFrequency->setValue(tmp);
|
|
||||||
|
|
||||||
if (d.readU32(2, &u32tmp))
|
|
||||||
{
|
|
||||||
m_objChannelMarker.setColor(u32tmp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_objChannelMarker.setColor(Qt::magenta);
|
|
||||||
}
|
|
||||||
|
|
||||||
d.readBool(3, &booltmp, false);
|
|
||||||
ui->chkAllowDrift->setChecked(booltmp);
|
|
||||||
|
|
||||||
d.readBool(4, &booltmp, false);
|
|
||||||
ui->chkFastlock->setChecked(booltmp);
|
|
||||||
|
|
||||||
d.readS32(5, &tmp, false);
|
|
||||||
ui->cmbFilter->setCurrentIndex(tmp);
|
|
||||||
|
|
||||||
displayRRCParameters((tmp==2));
|
|
||||||
|
|
||||||
d.readBool(6, &booltmp, false);
|
|
||||||
ui->chkHardMetric->setChecked(booltmp);
|
|
||||||
|
|
||||||
d.readS32(7, &tmp, false);
|
|
||||||
ui->spiRollOff->setValue(tmp);
|
|
||||||
|
|
||||||
d.readBool(8, &booltmp, false);
|
|
||||||
ui->chkViterbi->setChecked(booltmp);
|
|
||||||
|
|
||||||
|
|
||||||
d.readS32(9, &tmp, 0);
|
|
||||||
ui->cmbFEC->setCurrentIndex(tmp);
|
|
||||||
|
|
||||||
d.readS32(10, &tmp, 0);
|
|
||||||
ui->cmbModulation->setCurrentIndex(tmp);
|
|
||||||
|
|
||||||
d.readS32(11, &tmp, 0);
|
|
||||||
ui->cmbStandard->setCurrentIndex(tmp);
|
|
||||||
|
|
||||||
d.readS32(12, &tmp, 0);
|
|
||||||
ui->spiNotchFilters->setValue(tmp);
|
|
||||||
|
|
||||||
d.readS64(13, &i64tmp, 5120000);
|
|
||||||
ui->rfBandwidth->setValue(i64tmp);
|
|
||||||
|
|
||||||
d.readS32(14, &tmp, 250000);
|
|
||||||
ui->spiSymbolRate->setValue(tmp);
|
|
||||||
|
|
||||||
d.readS32(15, &tmp, false);
|
|
||||||
ui->spiExcursion->setValue(tmp);
|
|
||||||
|
|
||||||
|
|
||||||
blockApplySettings(false);
|
|
||||||
m_objChannelMarker.blockSignals(false);
|
|
||||||
|
|
||||||
applySettings();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -323,17 +202,41 @@ void DATVDemodGUI::blockApplySettings(bool blnBlock)
|
|||||||
m_blnDoApplySettings = !blnBlock;
|
m_blnDoApplySettings = !blnBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DATVDemodGUI::applySettings()
|
void DATVDemodGUI::displaySettings()
|
||||||
|
{
|
||||||
|
m_objChannelMarker.blockSignals(true);
|
||||||
|
blockApplySettings(true);
|
||||||
|
|
||||||
|
m_objChannelMarker.setCenterFrequency(m_settings.m_centerFrequency);
|
||||||
|
ui->deltaFrequency->setValue(m_settings.m_centerFrequency);
|
||||||
|
m_objChannelMarker.setColor(m_settings.m_rgbColor);
|
||||||
|
ui->chkAllowDrift->setChecked(m_settings.m_allowDrift);
|
||||||
|
ui->chkFastlock->setChecked(m_settings.m_fastLock);
|
||||||
|
ui->cmbFilter->setCurrentIndex((int) m_settings.m_filter);
|
||||||
|
|
||||||
|
displayRRCParameters(((int) m_settings.m_filter == 2));
|
||||||
|
|
||||||
|
ui->chkHardMetric->setChecked(m_settings.m_hardMetric);
|
||||||
|
ui->spiRollOff->setValue((int) (m_settings.m_rollOff * 100.0f));
|
||||||
|
ui->chkViterbi->setChecked(m_settings.m_viterbi);
|
||||||
|
ui->cmbFEC->setCurrentIndex((int) m_settings.m_fec);
|
||||||
|
ui->cmbModulation->setCurrentIndex((int) m_settings.m_modulation);
|
||||||
|
ui->cmbStandard->setCurrentIndex((int) m_settings.m_standard);
|
||||||
|
ui->spiNotchFilters->setValue(m_settings.m_notchFilters);
|
||||||
|
ui->rfBandwidth->setValue(m_settings.m_rfBandwidth);
|
||||||
|
ui->spiSymbolRate->setValue(m_settings.m_symbolRate);
|
||||||
|
ui->spiExcursion->setValue(m_settings.m_excursion);
|
||||||
|
|
||||||
|
blockApplySettings(false);
|
||||||
|
m_objChannelMarker.blockSignals(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DATVDemodGUI::applySettings(bool force)
|
||||||
{
|
{
|
||||||
QString strStandard;
|
QString strStandard;
|
||||||
QString strModulation;
|
QString strModulation;
|
||||||
QString strFEC;
|
QString strFEC;
|
||||||
|
|
||||||
DATVModulation enmSelectedModulation;
|
|
||||||
dvb_version enmVersion;
|
|
||||||
leansdr::code_rate enmFEC;
|
|
||||||
dvb_sampler enmSampler;
|
|
||||||
|
|
||||||
if (m_blnDoApplySettings)
|
if (m_blnDoApplySettings)
|
||||||
{
|
{
|
||||||
//Bandwidth and center frequency
|
//Bandwidth and center frequency
|
||||||
@ -348,11 +251,11 @@ void DATVDemodGUI::applySettings()
|
|||||||
strStandard = ui->cmbStandard->currentText();
|
strStandard = ui->cmbStandard->currentText();
|
||||||
|
|
||||||
if(strStandard=="DVB-S") {
|
if(strStandard=="DVB-S") {
|
||||||
enmVersion=DVB_S;
|
m_settings.m_standard = DATVDemodSettings::DVB_S;
|
||||||
} else if (strStandard=="DVB-S2") {
|
} else if (strStandard=="DVB-S2") {
|
||||||
enmVersion=DVB_S2;
|
m_settings.m_standard = DATVDemodSettings::DVB_S2;
|
||||||
} else {
|
} else {
|
||||||
enmVersion=DVB_S;
|
m_settings.m_standard = DATVDemodSettings::DVB_S;
|
||||||
}
|
}
|
||||||
|
|
||||||
//BPSK, QPSK, PSK8, APSK16, APSK32, APSK64E, QAM16, QAM64, QAM256
|
//BPSK, QPSK, PSK8, APSK16, APSK32, APSK64E, QAM16, QAM64, QAM256
|
||||||
@ -360,90 +263,88 @@ void DATVDemodGUI::applySettings()
|
|||||||
strModulation = ui->cmbModulation->currentText();
|
strModulation = ui->cmbModulation->currentText();
|
||||||
|
|
||||||
if(strModulation=="BPSK") {
|
if(strModulation=="BPSK") {
|
||||||
enmSelectedModulation=BPSK;
|
m_settings.m_modulation = DATVDemodSettings::BPSK;
|
||||||
}
|
}
|
||||||
else if(strModulation=="QPSK") {
|
else if(strModulation=="QPSK") {
|
||||||
enmSelectedModulation=QPSK;
|
m_settings.m_modulation = DATVDemodSettings::QPSK;
|
||||||
}
|
}
|
||||||
else if(strModulation=="8PSK") {
|
else if(strModulation=="8PSK") {
|
||||||
enmSelectedModulation=PSK8;
|
m_settings.m_modulation = DATVDemodSettings::PSK8;
|
||||||
}
|
}
|
||||||
else if(strModulation=="16APSK") {
|
else if(strModulation=="16APSK") {
|
||||||
enmSelectedModulation=APSK16;
|
m_settings.m_modulation = DATVDemodSettings::APSK16;
|
||||||
}
|
}
|
||||||
else if(strModulation=="32APSK") {
|
else if(strModulation=="32APSK") {
|
||||||
enmSelectedModulation=APSK32;
|
m_settings.m_modulation = DATVDemodSettings::APSK32;
|
||||||
}
|
}
|
||||||
else if(strModulation=="64APSKE") {
|
else if(strModulation=="64APSKE") {
|
||||||
enmSelectedModulation=APSK64E;
|
m_settings.m_modulation = DATVDemodSettings::APSK64E;
|
||||||
}
|
}
|
||||||
else if(strModulation=="16QAM") {
|
else if(strModulation=="16QAM") {
|
||||||
enmSelectedModulation=QAM16;
|
m_settings.m_modulation = DATVDemodSettings::QAM16;
|
||||||
}
|
}
|
||||||
else if(strModulation=="64QAM") {
|
else if(strModulation=="64QAM") {
|
||||||
enmSelectedModulation=QAM64;
|
m_settings.m_modulation = DATVDemodSettings::QAM64;
|
||||||
}
|
}
|
||||||
else if(strModulation=="256QAM") {
|
else if(strModulation=="256QAM") {
|
||||||
enmSelectedModulation=QAM256;
|
m_settings.m_modulation = DATVDemodSettings::QAM256;
|
||||||
} else {
|
} else {
|
||||||
enmSelectedModulation=BPSK;
|
m_settings.m_modulation = DATVDemodSettings::BPSK;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Viterbi only for BPSK et QPSK
|
//Viterbi only for BPSK et QPSK
|
||||||
if ((enmSelectedModulation!=BPSK) && (enmSelectedModulation!=QPSK)) {
|
if ((m_settings.m_modulation != DATVDemodSettings::BPSK)
|
||||||
|
&& (m_settings.m_modulation != DATVDemodSettings::QPSK))
|
||||||
|
{
|
||||||
ui->chkViterbi->setChecked(false);
|
ui->chkViterbi->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
strFEC = ui->cmbFEC->currentText();
|
strFEC = ui->cmbFEC->currentText();
|
||||||
|
|
||||||
if (strFEC == "1/2") {
|
if (strFEC == "1/2") {
|
||||||
enmFEC = leansdr::FEC12;
|
m_settings.m_fec = leansdr::FEC12;
|
||||||
} else if (strFEC == "2/3") {
|
} else if (strFEC == "2/3") {
|
||||||
enmFEC = leansdr::FEC23;
|
m_settings.m_fec = leansdr::FEC23;
|
||||||
} else if (strFEC == "3/4") {
|
} else if (strFEC == "3/4") {
|
||||||
enmFEC = leansdr::FEC34;
|
m_settings.m_fec = leansdr::FEC34;
|
||||||
} else if (strFEC == "5/6") {
|
} else if (strFEC == "5/6") {
|
||||||
enmFEC = leansdr::FEC56;
|
m_settings.m_fec = leansdr::FEC56;
|
||||||
} else if (strFEC == "7/8") {
|
} else if (strFEC == "7/8") {
|
||||||
enmFEC = leansdr::FEC78;
|
m_settings.m_fec = leansdr::FEC78;
|
||||||
} else if (strFEC == "4/5") {
|
} else if (strFEC == "4/5") {
|
||||||
enmFEC = leansdr::FEC45;
|
m_settings.m_fec = leansdr::FEC45;
|
||||||
} else if (strFEC == "8/9") {
|
} else if (strFEC == "8/9") {
|
||||||
enmFEC = leansdr::FEC89;
|
m_settings.m_fec = leansdr::FEC89;
|
||||||
} else if (strFEC == "9/10") {
|
} else if (strFEC == "9/10") {
|
||||||
enmFEC = leansdr::FEC910;
|
m_settings.m_fec = leansdr::FEC910;
|
||||||
} else {
|
} else {
|
||||||
enmFEC = leansdr::FEC12;
|
m_settings.m_fec = leansdr::FEC12;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ui->cmbFilter->currentIndex() == 0) {
|
if (ui->cmbFilter->currentIndex() == 0) {
|
||||||
enmSampler = SAMP_LINEAR;
|
m_settings.m_filter = DATVDemodSettings::SAMP_LINEAR;
|
||||||
} else if (ui->cmbFilter->currentIndex() == 1) {
|
} else if (ui->cmbFilter->currentIndex() == 1) {
|
||||||
enmSampler = SAMP_NEAREST;
|
m_settings.m_filter = DATVDemodSettings::SAMP_NEAREST;
|
||||||
} else {
|
} else {
|
||||||
enmSampler = SAMP_RRC;
|
m_settings.m_filter = DATVDemodSettings::SAMP_RRC;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_objDATVDemod->configure(
|
m_settings.m_rfBandwidth = m_objChannelMarker.getBandwidth();
|
||||||
m_objDATVDemod->getInputMessageQueue(),
|
m_settings.m_centerFrequency = m_objChannelMarker.getCenterFrequency();
|
||||||
m_objChannelMarker.getBandwidth(),
|
m_settings.m_symbolRate = ui->spiSymbolRate->value();
|
||||||
m_objChannelMarker.getCenterFrequency(),
|
m_settings.m_notchFilters = ui->spiNotchFilters->value();
|
||||||
enmVersion,
|
m_settings.m_allowDrift = ui->chkAllowDrift->isChecked();
|
||||||
enmSelectedModulation,
|
m_settings.m_fastLock = ui->chkFastlock->isChecked();
|
||||||
enmFEC,
|
m_settings.m_hardMetric = ui->chkHardMetric->isChecked();
|
||||||
ui->spiSymbolRate->value(),
|
m_settings.m_rollOff = ((float)ui->spiRollOff->value()) / 100.0f;
|
||||||
ui->spiNotchFilters->value(),
|
m_settings.m_viterbi = ui->chkViterbi->isChecked();
|
||||||
ui->chkAllowDrift->isChecked(),
|
m_settings.m_excursion = ui->spiExcursion->value();
|
||||||
ui->chkFastlock->isChecked(),
|
|
||||||
enmSampler,
|
|
||||||
ui->chkHardMetric->isChecked(),
|
|
||||||
((float)ui->spiRollOff->value())/100.0f,
|
|
||||||
ui->chkViterbi->isChecked(),
|
|
||||||
ui->spiExcursion->value());
|
|
||||||
|
|
||||||
qDebug() << "DATVDemodGUI::applySettings:"
|
QString msg = tr("DATVDemodGUI::applySettings: force: %1").arg(force);
|
||||||
<< " m_objDATVDemod->getCenterFrequency: " << m_objDATVDemod->getCenterFrequency()
|
m_settings.debug(msg);
|
||||||
<< " m_objDATVDemod->GetSampleRate: " << m_objDATVDemod->GetSampleRate();
|
|
||||||
|
DATVDemod::MsgConfigureDATVDemod* message = DATVDemod::MsgConfigureDATVDemod::create(m_settings, force);
|
||||||
|
m_objDATVDemod->getInputMessageQueue()->push(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,10 +32,7 @@
|
|||||||
class PluginAPI;
|
class PluginAPI;
|
||||||
class DeviceUISet;
|
class DeviceUISet;
|
||||||
class BasebandSampleSink;
|
class BasebandSampleSink;
|
||||||
//class DeviceSourceAPI;
|
|
||||||
//class ThreadedBasebandSampleSink;
|
|
||||||
class DownChannelizer;
|
class DownChannelizer;
|
||||||
//class DATVDemod;
|
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
@ -106,6 +103,7 @@ private:
|
|||||||
DATVDemod* m_objDATVDemod;
|
DATVDemod* m_objDATVDemod;
|
||||||
MessageQueue m_inputMessageQueue;
|
MessageQueue m_inputMessageQueue;
|
||||||
int m_intCenterFrequency;
|
int m_intCenterFrequency;
|
||||||
|
DATVDemodSettings m_settings;
|
||||||
|
|
||||||
QTimer m_objTimer;
|
QTimer m_objTimer;
|
||||||
qint64 m_intPreviousDecodedData;
|
qint64 m_intPreviousDecodedData;
|
||||||
@ -123,7 +121,8 @@ private:
|
|||||||
virtual ~DATVDemodGUI();
|
virtual ~DATVDemodGUI();
|
||||||
|
|
||||||
void blockApplySettings(bool blnBlock);
|
void blockApplySettings(bool blnBlock);
|
||||||
void applySettings();
|
void applySettings(bool force = false);
|
||||||
|
void displaySettings();
|
||||||
QString formatBytes(qint64 intBytes);
|
QString formatBytes(qint64 intBytes);
|
||||||
|
|
||||||
void displayRRCParameters(bool blnVisible);
|
void displayRRCParameters(bool blnVisible);
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "settings/serializable.h"
|
#include "settings/serializable.h"
|
||||||
@ -32,7 +33,7 @@ void DATVDemodSettings::resetToDefaults()
|
|||||||
m_rgbColor = QColor(Qt::magenta).rgb();
|
m_rgbColor = QColor(Qt::magenta).rgb();
|
||||||
m_title = "DATV Demodulator";
|
m_title = "DATV Demodulator";
|
||||||
m_msps = 1024000;
|
m_msps = 1024000;
|
||||||
m_rfBandwidth = 1024000;
|
m_rfBandwidth = 512000;
|
||||||
m_centerFrequency = 0;
|
m_centerFrequency = 0;
|
||||||
m_standard = DVB_S;
|
m_standard = DVB_S;
|
||||||
m_modulation = BPSK;
|
m_modulation = BPSK;
|
||||||
@ -96,7 +97,7 @@ bool DATVDemodSettings::deserialize(const QByteArray& data)
|
|||||||
QString strtmp;
|
QString strtmp;
|
||||||
|
|
||||||
d.readS32(1, &m_msps, 1024000);
|
d.readS32(1, &m_msps, 1024000);
|
||||||
d.readS32(2, &m_rfBandwidth, 1024000);
|
d.readS32(2, &m_rfBandwidth, 512000);
|
||||||
d.readS32(3, &m_centerFrequency, 0);
|
d.readS32(3, &m_centerFrequency, 0);
|
||||||
|
|
||||||
d.readS32(4, &tmp, (int) DVB_S);
|
d.readS32(4, &tmp, (int) DVB_S);
|
||||||
@ -113,7 +114,7 @@ bool DATVDemodSettings::deserialize(const QByteArray& data)
|
|||||||
m_channelMarker->deserialize(bytetmp);
|
m_channelMarker->deserialize(bytetmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
d.readU32(7, &m_rgbColor);
|
d.readU32(7, &m_rgbColor, QColor(Qt::magenta).rgb());
|
||||||
d.readString(8, &m_title, "DATV Demodulator");
|
d.readString(8, &m_title, "DATV Demodulator");
|
||||||
|
|
||||||
d.readS32(9, &tmp, (int) leansdr::code_rate::FEC12);
|
d.readS32(9, &tmp, (int) leansdr::code_rate::FEC12);
|
||||||
@ -143,3 +144,42 @@ bool DATVDemodSettings::deserialize(const QByteArray& data)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DATVDemodSettings::debug(const QString& msg) const
|
||||||
|
{
|
||||||
|
qDebug() << msg
|
||||||
|
<< " m_msps: " << m_msps
|
||||||
|
<< " m_sampleRate: " << m_sampleRate
|
||||||
|
<< " m_allowDrift: " << m_allowDrift
|
||||||
|
<< " m_rfBandwidth: " << m_rfBandwidth
|
||||||
|
<< " m_centerFrequency: " << m_centerFrequency
|
||||||
|
<< " m_fastLock: " << m_fastLock
|
||||||
|
<< " m_hardMetric: " << m_hardMetric
|
||||||
|
<< " m_filter: " << m_filter
|
||||||
|
<< " m_rollOff: " << m_rollOff
|
||||||
|
<< " m_viterbi: " << m_viterbi
|
||||||
|
<< " m_fec: " << m_fec
|
||||||
|
<< " m_modulation: " << m_modulation
|
||||||
|
<< " m_standard: " << m_standard
|
||||||
|
<< " m_notchFilters: " << m_notchFilters
|
||||||
|
<< " m_symbolRate: " << m_symbolRate
|
||||||
|
<< " m_excursion: " << m_excursion;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DATVDemodSettings::isDifferent(const DATVDemodSettings& other)
|
||||||
|
{
|
||||||
|
return ((m_allowDrift != other.m_allowDrift)
|
||||||
|
|| (m_rfBandwidth != other.m_rfBandwidth)
|
||||||
|
|| (m_centerFrequency != other.m_centerFrequency)
|
||||||
|
|| (m_fastLock != other.m_fastLock)
|
||||||
|
|| (m_hardMetric != other.m_hardMetric)
|
||||||
|
|| (m_filter != other.m_filter)
|
||||||
|
|| (m_rollOff != other.m_rollOff)
|
||||||
|
|| (m_viterbi != other.m_viterbi)
|
||||||
|
|| (m_fec != other.m_fec)
|
||||||
|
|| (m_modulation != other.m_modulation)
|
||||||
|
|| (m_standard != other.m_standard)
|
||||||
|
|| (m_notchFilters != other.m_notchFilters)
|
||||||
|
|| (m_symbolRate != other.m_symbolRate)
|
||||||
|
|| (m_excursion != other.m_excursion));
|
||||||
|
}
|
@ -56,13 +56,13 @@ struct DATVDemodSettings
|
|||||||
quint32 m_rgbColor;
|
quint32 m_rgbColor;
|
||||||
QString m_title;
|
QString m_title;
|
||||||
Serializable *m_channelMarker;
|
Serializable *m_channelMarker;
|
||||||
int m_msps;
|
int m_msps; //!< FIXME: ineffective
|
||||||
int m_rfBandwidth;
|
int m_rfBandwidth;
|
||||||
int m_centerFrequency;
|
int m_centerFrequency;
|
||||||
dvb_version m_standard;
|
dvb_version m_standard;
|
||||||
DATVModulation m_modulation;
|
DATVModulation m_modulation;
|
||||||
leansdr::code_rate m_fec;
|
leansdr::code_rate m_fec;
|
||||||
int m_sampleRate;
|
int m_sampleRate; //!< FIXME: innefective
|
||||||
int m_symbolRate;
|
int m_symbolRate;
|
||||||
int m_notchFilters;
|
int m_notchFilters;
|
||||||
bool m_allowDrift;
|
bool m_allowDrift;
|
||||||
@ -78,6 +78,8 @@ struct DATVDemodSettings
|
|||||||
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
|
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
|
||||||
QByteArray serialize() const;
|
QByteArray serialize() const;
|
||||||
bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data);
|
||||||
|
void debug(const QString& msg) const;
|
||||||
|
bool isDifferent(const DATVDemodSettings& other);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PLUGINS_CHANNELRX_DEMODATV_DATVDEMODSETTINGS_H_
|
#endif // PLUGINS_CHANNELRX_DEMODATV_DATVDEMODSETTINGS_H_
|
Loading…
Reference in New Issue
Block a user