mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 17:58:43 -05:00
DATV demod: added a settings structure
This commit is contained in:
parent
d4fe404dd6
commit
7961f50791
@ -6,6 +6,7 @@ set(datv_SOURCES
|
|||||||
datvdemod.cpp
|
datvdemod.cpp
|
||||||
datvdemodgui.cpp
|
datvdemodgui.cpp
|
||||||
datvdemodplugin.cpp
|
datvdemodplugin.cpp
|
||||||
|
datvdemodsettings.cpp
|
||||||
datvideostream.cpp
|
datvideostream.cpp
|
||||||
datvideorender.cpp
|
datvideorender.cpp
|
||||||
leansdr/dvb.cpp
|
leansdr/dvb.cpp
|
||||||
@ -19,6 +20,7 @@ set(datv_HEADERS
|
|||||||
datvdemod.h
|
datvdemod.h
|
||||||
datvdemodgui.h
|
datvdemodgui.h
|
||||||
datvdemodplugin.h
|
datvdemodplugin.h
|
||||||
|
datvdemodsettings.h
|
||||||
datvideostream.h
|
datvideostream.h
|
||||||
datvideorender.h
|
datvideorender.h
|
||||||
leansdr/dvb.h
|
leansdr/dvb.h
|
||||||
|
@ -169,7 +169,21 @@ void DATVDemod::configure(MessageQueue* objMessageQueue,
|
|||||||
bool blnViterbi,
|
bool blnViterbi,
|
||||||
int intExcursion)
|
int intExcursion)
|
||||||
{
|
{
|
||||||
Message* msgCmd = MsgConfigureDATVDemod::create(intRFBandwidth,intCenterFrequency,enmStandard, enmModulation, enmFEC, intSymbolRate, intNotchFilters, blnAllowDrift,blnFastLock,enmFilter,blnHardMetric,fltRollOff, blnViterbi,intExcursion);
|
Message* msgCmd = MsgConfigureDATVDemod::create(
|
||||||
|
intRFBandwidth,
|
||||||
|
intCenterFrequency,
|
||||||
|
enmStandard,
|
||||||
|
enmModulation,
|
||||||
|
enmFEC,
|
||||||
|
intSymbolRate,
|
||||||
|
intNotchFilters,
|
||||||
|
blnAllowDrift,
|
||||||
|
blnFastLock,
|
||||||
|
enmFilter,
|
||||||
|
blnHardMetric,
|
||||||
|
fltRollOff,
|
||||||
|
blnViterbi,
|
||||||
|
intExcursion);
|
||||||
objMessageQueue->push(msgCmd);
|
objMessageQueue->push(msgCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,21 @@ private:
|
|||||||
bool blnViterbi,
|
bool blnViterbi,
|
||||||
int intExcursion)
|
int intExcursion)
|
||||||
{
|
{
|
||||||
return new MsgConfigureDATVDemod(intRFBandwidth,intCenterFrequency,enmStandard, enmModulation, enmFEC, intSymbolRate, intNotchFilters, blnAllowDrift,blnFastLock,enmFilter,blnHardMetric,fltRollOff, blnViterbi, intExcursion);
|
return new MsgConfigureDATVDemod(
|
||||||
|
intRFBandwidth,
|
||||||
|
intCenterFrequency,
|
||||||
|
enmStandard,
|
||||||
|
enmModulation,
|
||||||
|
enmFEC,
|
||||||
|
intSymbolRate,
|
||||||
|
intNotchFilters,
|
||||||
|
blnAllowDrift,
|
||||||
|
blnFastLock,
|
||||||
|
enmFilter,
|
||||||
|
blnHardMetric,
|
||||||
|
fltRollOff,
|
||||||
|
blnViterbi,
|
||||||
|
intExcursion);
|
||||||
}
|
}
|
||||||
|
|
||||||
DATVConfig m_objMsgConfig;
|
DATVConfig m_objMsgConfig;
|
||||||
|
145
plugins/channelrx/demoddatv/datvdemodsettings.cpp
Normal file
145
plugins/channelrx/demoddatv/datvdemodsettings.cpp
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2019 F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <QColor>
|
||||||
|
|
||||||
|
#include "util/simpleserializer.h"
|
||||||
|
#include "settings/serializable.h"
|
||||||
|
|
||||||
|
#include "datvdemodsettings.h"
|
||||||
|
|
||||||
|
DATVDemodSettings::DATVDemodSettings() :
|
||||||
|
m_channelMarker(0)
|
||||||
|
{
|
||||||
|
resetToDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DATVDemodSettings::resetToDefaults()
|
||||||
|
{
|
||||||
|
m_rgbColor = QColor(Qt::magenta).rgb();
|
||||||
|
m_title = "DATV Demodulator";
|
||||||
|
m_msps = 1024000;
|
||||||
|
m_rfBandwidth = 1024000;
|
||||||
|
m_centerFrequency = 0;
|
||||||
|
m_standard = DVB_S;
|
||||||
|
m_modulation = BPSK;
|
||||||
|
m_fec = leansdr::FEC12;
|
||||||
|
m_sampleRate = 1024000;
|
||||||
|
m_symbolRate = 250000;
|
||||||
|
m_notchFilters = 1;
|
||||||
|
m_allowDrift = false;
|
||||||
|
m_fastLock = false;
|
||||||
|
m_filter = SAMP_LINEAR;
|
||||||
|
m_hardMetric = false;
|
||||||
|
m_rollOff = 0.35;
|
||||||
|
m_viterbi = false;
|
||||||
|
m_excursion = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray DATVDemodSettings::serialize() const
|
||||||
|
{
|
||||||
|
SimpleSerializer s(1);
|
||||||
|
s.writeS32(1, m_msps);
|
||||||
|
s.writeS32(2, m_rfBandwidth);
|
||||||
|
s.writeS32(3, m_centerFrequency);
|
||||||
|
s.writeS32(4, (int) m_standard);
|
||||||
|
s.writeS32(5, (int) m_modulation);
|
||||||
|
|
||||||
|
if (m_channelMarker) {
|
||||||
|
s.writeBlob(6, m_channelMarker->serialize());
|
||||||
|
}
|
||||||
|
|
||||||
|
s.writeU32(7, m_rgbColor);
|
||||||
|
s.writeString(8, m_title);
|
||||||
|
s.writeS32(9, (int) m_fec);
|
||||||
|
s.writeS32(10, m_sampleRate);
|
||||||
|
s.writeS32(11, m_symbolRate);
|
||||||
|
s.writeS32(12, m_notchFilters);
|
||||||
|
s.writeBool(13, m_allowDrift);
|
||||||
|
s.writeBool(14, m_fastLock);
|
||||||
|
s.writeS32(15, (int) m_filter);
|
||||||
|
s.writeBool(16, m_hardMetric);
|
||||||
|
s.writeFloat(17, m_rollOff);
|
||||||
|
s.writeBool(18, m_viterbi);
|
||||||
|
s.writeS32(19, m_excursion);
|
||||||
|
|
||||||
|
return s.final();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DATVDemodSettings::deserialize(const QByteArray& data)
|
||||||
|
{
|
||||||
|
SimpleDeserializer d(data);
|
||||||
|
|
||||||
|
if(!d.isValid())
|
||||||
|
{
|
||||||
|
resetToDefaults();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(d.getVersion() == 1)
|
||||||
|
{
|
||||||
|
QByteArray bytetmp;
|
||||||
|
qint32 tmp;
|
||||||
|
QString strtmp;
|
||||||
|
|
||||||
|
d.readS32(1, &m_msps, 1024000);
|
||||||
|
d.readS32(2, &m_rfBandwidth, 1024000);
|
||||||
|
d.readS32(3, &m_centerFrequency, 0);
|
||||||
|
|
||||||
|
d.readS32(4, &tmp, (int) DVB_S);
|
||||||
|
tmp = tmp < 0 ? 0 : tmp > (int) DVB_S2 ? (int) DVB_S2 : tmp;
|
||||||
|
m_standard = (dvb_version) tmp;
|
||||||
|
|
||||||
|
d.readS32(5, &tmp, (int) BPSK);
|
||||||
|
tmp = tmp < 0 ? 0 : tmp > (int) QAM256 ? (int) QAM256 : tmp;
|
||||||
|
m_modulation = (DATVModulation) tmp;
|
||||||
|
|
||||||
|
d.readBlob(6, &bytetmp);
|
||||||
|
|
||||||
|
if (m_channelMarker) {
|
||||||
|
m_channelMarker->deserialize(bytetmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
d.readU32(7, &m_rgbColor);
|
||||||
|
d.readString(8, &m_title, "DATV Demodulator");
|
||||||
|
|
||||||
|
d.readS32(9, &tmp, (int) leansdr::code_rate::FEC12);
|
||||||
|
tmp = tmp < 0 ? 0 : tmp >= (int) leansdr::code_rate::FEC_COUNT ? (int) leansdr::code_rate::FEC_COUNT - 1 : tmp;
|
||||||
|
m_fec = (leansdr::code_rate) tmp;
|
||||||
|
|
||||||
|
d.readS32(10, &m_sampleRate, 1024000);
|
||||||
|
d.readS32(11, &m_symbolRate, 250000);
|
||||||
|
d.readS32(12, &m_notchFilters, 1);
|
||||||
|
d.readBool(13, &m_allowDrift, false);
|
||||||
|
d.readBool(14, &m_fastLock, false);
|
||||||
|
|
||||||
|
d.readS32(15, &tmp, (int) SAMP_LINEAR);
|
||||||
|
tmp = tmp < 0 ? 0 : tmp > (int) SAMP_RRC ? (int) SAMP_RRC : tmp;
|
||||||
|
m_filter = (dvb_sampler) tmp;
|
||||||
|
|
||||||
|
d.readBool(16, &m_hardMetric, false);
|
||||||
|
d.readFloat(17, &m_rollOff, 0.35);
|
||||||
|
d.readBool(18, &m_viterbi, false);
|
||||||
|
d.readS32(19, &m_excursion, 10);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resetToDefaults();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
83
plugins/channelrx/demoddatv/datvdemodsettings.h
Normal file
83
plugins/channelrx/demoddatv/datvdemodsettings.h
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2019 F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef PLUGINS_CHANNELRX_DEMODATV_DATVDEMODSETTINGS_H_
|
||||||
|
#define PLUGINS_CHANNELRX_DEMODATV_DATVDEMODSETTINGS_H_
|
||||||
|
|
||||||
|
#include <QByteArray>
|
||||||
|
#include <QString>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "leansdr/dvb.h"
|
||||||
|
|
||||||
|
class Serializable;
|
||||||
|
|
||||||
|
struct DATVDemodSettings
|
||||||
|
{
|
||||||
|
enum dvb_version
|
||||||
|
{
|
||||||
|
DVB_S,
|
||||||
|
DVB_S2
|
||||||
|
};
|
||||||
|
|
||||||
|
enum DATVModulation
|
||||||
|
{
|
||||||
|
BPSK,
|
||||||
|
QPSK,
|
||||||
|
PSK8,
|
||||||
|
APSK16,
|
||||||
|
APSK32,
|
||||||
|
APSK64E,
|
||||||
|
QAM16,
|
||||||
|
QAM64,
|
||||||
|
QAM256
|
||||||
|
};
|
||||||
|
|
||||||
|
enum dvb_sampler
|
||||||
|
{
|
||||||
|
SAMP_NEAREST,
|
||||||
|
SAMP_LINEAR,
|
||||||
|
SAMP_RRC
|
||||||
|
};
|
||||||
|
|
||||||
|
quint32 m_rgbColor;
|
||||||
|
QString m_title;
|
||||||
|
Serializable *m_channelMarker;
|
||||||
|
int m_msps;
|
||||||
|
int m_rfBandwidth;
|
||||||
|
int m_centerFrequency;
|
||||||
|
dvb_version m_standard;
|
||||||
|
DATVModulation m_modulation;
|
||||||
|
leansdr::code_rate m_fec;
|
||||||
|
int m_sampleRate;
|
||||||
|
int m_symbolRate;
|
||||||
|
int m_notchFilters;
|
||||||
|
bool m_allowDrift;
|
||||||
|
bool m_fastLock;
|
||||||
|
dvb_sampler m_filter;
|
||||||
|
bool m_hardMetric;
|
||||||
|
float m_rollOff;
|
||||||
|
bool m_viterbi;
|
||||||
|
int m_excursion;
|
||||||
|
|
||||||
|
DATVDemodSettings();
|
||||||
|
void resetToDefaults();
|
||||||
|
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
|
||||||
|
QByteArray serialize() const;
|
||||||
|
bool deserialize(const QByteArray& data);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PLUGINS_CHANNELRX_DEMODATV_DATVDEMODSETTINGS_H_
|
Loading…
Reference in New Issue
Block a user