Convert constellation code to ModemArgInfo settings

- Note: can’t set constellation yet until property grid is added
This commit is contained in:
Charles J. Cliffe 2015-11-23 20:03:47 -05:00
parent de1264fe17
commit 4a62eae096
33 changed files with 495 additions and 388 deletions

View File

@ -93,19 +93,6 @@ AppFrame::AppFrame() :
demodModeSelectorAdv->addChoice(10, "QPSK");
demodModeSelectorAdv->setHelpTip("Choose advanced modulation types.");
demodTray->Add(demodModeSelectorAdv, 3, wxEXPAND | wxALL, 0);
demodModeSelectorCons = new ModeSelectorCanvas(this, attribList);
demodModeSelectorCons->addChoice(1, "auto");
demodModeSelectorCons->addChoice(2, "2");
demodModeSelectorCons->addChoice(4, "4");
demodModeSelectorCons->addChoice(8, "8");
demodModeSelectorCons->addChoice(16, "16");
demodModeSelectorCons->addChoice(32, "32");
demodModeSelectorCons->addChoice(64, "64");
demodModeSelectorCons->addChoice(128, "128");
demodModeSelectorCons->addChoice(256, "256");
demodModeSelectorCons->setHelpTip("Choose number of constallations types.");
demodTray->Add(demodModeSelectorCons, 2, wxEXPAND | wxALL, 0);
#endif
wxGetApp().getDemodSpectrumProcessor()->setup(1024);
@ -862,9 +849,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
std::string dType = demod->getDemodulatorType();
demodModeSelector->setSelection(dType);
#ifdef ENABLE_DIGITAL_LAB
int dCons = demod->getDemodulatorCons();
demodModeSelectorAdv->setSelection(dType);
demodModeSelectorCons->setSelection(dCons);
#endif
demodMuteButton->setSelection(demod->isMuted()?1:-1);
}
@ -896,7 +881,6 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
std::string dSelection = demodModeSelector->getSelectionLabel();
#ifdef ENABLE_DIGITAL_LAB
std::string dSelectionadv = demodModeSelectorAdv->getSelectionLabel();
int dSelectionCons = demodModeSelectorCons->getSelection();
// basic demodulators
if (dSelection != "" && dSelection != demod->getDemodulatorType()) {
@ -908,11 +892,6 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
demod->setDemodulatorType(dSelectionadv);
demodModeSelector->setSelection(-1);
}
// set constellations
if (dSelectionCons != demod->getDemodulatorCons()) {
demod->setDemodulatorCons(dSelectionCons);
}
#else
// basic demodulators
if (dSelection != "" && dSelection != demod->getDemodulatorType()) {
@ -958,7 +937,6 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
std::string dSelection = demodModeSelector->getSelectionLabel();
#ifdef ENABLE_DIGITAL_LAB
std::string dSelectionadv = demodModeSelectorAdv->getSelectionLabel();
int dSelectionCons = demodModeSelectorCons->getSelection();
// basic demodulators
if (dSelection != "" && dSelection != mgr->getLastDemodulatorType()) {
@ -970,11 +948,6 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
mgr->setLastDemodulatorType(dSelectionadv);
demodModeSelector->setSelection(-1);
}
// set constellations
if (dSelectionCons != mgr->getLastDemodulatorCons()) {
mgr->setLastDemodulatorCons(dSelectionCons);
}
#else
// basic demodulators
if (dSelection != "" && dSelection != mgr->getLastDemodulatorType()) {

View File

@ -81,7 +81,6 @@ private:
ModeSelectorCanvas *demodModeSelector;
#ifdef ENABLE_DIGITAL_LAB
ModeSelectorCanvas *demodModeSelectorAdv;
ModeSelectorCanvas *demodModeSelectorCons;
#endif
SpectrumCanvas *demodSpectrumCanvas;
WaterfallCanvas *demodWaterfallCanvas;

View File

@ -261,21 +261,6 @@ int DemodulatorInstance::getDemodulatorLock() {
return 0;
}
void DemodulatorInstance::setDemodulatorCons(int demod_cons_in) {
Modem *cModem = demodulatorPreThread->getModem();
if (cModem && cModem->getType() == "digital") {
((ModemDigital *)cModem)->setDemodulatorCons(demod_cons_in);
}
}
int DemodulatorInstance::getDemodulatorCons() {
Modem *cModem = demodulatorPreThread->getModem();
if (cModem && cModem->getType() == "digital") {
return ((ModemDigital *)cModem)->getDemodulatorCons();
}
return 0;
}
void DemodulatorInstance::setBandwidth(int bw) {
demodulatorPreThread->setBandwidth(bw);
}

View File

@ -58,9 +58,6 @@ public:
void setDemodulatorLock(bool demod_lock_in);
int getDemodulatorLock();
void setDemodulatorCons(int demod_cons_in);
int getDemodulatorCons();
void setBandwidth(int bw);
int getBandwidth();

View File

@ -162,7 +162,6 @@ void DemodulatorMgr::updateLastState() {
lastBandwidth = lastActiveDemodulator->getBandwidth();
lastDemodType = lastActiveDemodulator->getDemodulatorType();
lastDemodLock = lastActiveDemodulator->getDemodulatorLock();
lastDemodCons = lastActiveDemodulator->getDemodulatorCons();
lastSquelchEnabled = lastActiveDemodulator->isSquelchEnabled();
lastSquelch = lastActiveDemodulator->getSquelchLevel();
lastGain = lastActiveDemodulator->getGain();
@ -191,14 +190,6 @@ void DemodulatorMgr::setLastDemodulatorType(std::string lastDemodType) {
this->lastDemodType = lastDemodType;
}
int DemodulatorMgr::getLastDemodulatorCons() const {
return lastDemodCons;
}
void DemodulatorMgr::setLastDemodulatorCons(int lastDemodCons) {
this->lastDemodCons = lastDemodCons;
}
float DemodulatorMgr::getLastGain() const {
return lastGain;
}

View File

@ -27,9 +27,6 @@ public:
std::string getLastDemodulatorType() const;
void setLastDemodulatorType(std::string lastDemodType);
int getLastDemodulatorCons() const;
void setLastDemodulatorCons(int lastDemodCons);
float getLastGain() const;
void setLastGain(float lastGain);
@ -56,7 +53,6 @@ private:
int lastBandwidth;
std::string lastDemodType;
bool lastDemodLock;
int lastDemodCons;
bool lastSquelchEnabled;
float lastSquelch;
float lastGain;

View File

@ -2,6 +2,22 @@
ModemFactoryList Modem::modemFactories;
//! Create an empty range (0.0, 0.0)
ModemRange::ModemRange(void) {
_min = 0;
_max = 0;
}
//! Create a min/max range
ModemRange::ModemRange(const double minimum, const double maximum) {
_min = minimum;
_max = maximum;
}
ModemArgInfo::ModemArgInfo(void) {
}
void Modem::addModemFactory(Modem *factorySingle) {
modemFactories[factorySingle->getName()] = factorySingle;
}

View File

@ -29,7 +29,6 @@ public:
}
};
// Copy of SoapySDR::Range, original comments
class ModemRange
{
@ -51,7 +50,6 @@ private:
double _min, _max;
};
// Modified version of SoapySDR::ArgInfo, original comments
class ModemArgInfo
{
@ -121,9 +119,12 @@ public:
virtual ModemArgInfoList getSettings();
virtual void writeSetting(std::string setting, std::string value);
virtual std::string readSetting(std::string setting);
virtual int checkSampleRate(long long sampleRate, int audioSampleRate) = 0;
virtual ModemKit *buildKit(long long sampleRate, int audioSampleRate) = 0;
virtual void disposeKit(ModemKit *kit) = 0;
virtual void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) = 0;
private:
static ModemFactoryList modemFactories;

View File

@ -38,24 +38,10 @@ int ModemDigital::getDemodulatorLock() {
return currentDemodLock.load();
}
void ModemDigital::setDemodulatorCons(int demod_cons_in) {
demodulatorCons.store(demod_cons_in);
}
int ModemDigital::getDemodulatorCons() {
return currentDemodCons.load();
}
void ModemDigital::updateDemodulatorLock(modem mod, float sensitivity) {
setDemodulatorLock(modem_get_demodulator_evm(mod) <= sensitivity);
}
void ModemDigital::updateDemodulatorCons(int cons) {
if (currentDemodCons.load() != cons) {
currentDemodCons = cons;
}
}
void ModemDigital::digitalStart(ModemKitDigital *kit, modem mod, ModemIQData *input) {
int bufSize = input->data.size();
@ -65,14 +51,9 @@ void ModemDigital::digitalStart(ModemKitDigital *kit, modem mod, ModemIQData *in
}
demodOutputDataDigital.resize(bufSize);
}
if (demodulatorCons.load() != currentDemodCons.load()) {
updateDemodulatorCons(demodulatorCons.load());
currentDemodLock.store(false);
}
}
void ModemDigital::digitalFinish(ModemKitDigital *kit, modem mod) {
demodOutputDataDigital.empty();
}

View File

@ -12,28 +12,26 @@ public:
class ModemDigital : public Modem {
public:
ModemDigital();
std::string getType();
virtual int checkSampleRate(long long sampleRate, int audioSampleRate);
virtual ModemKit *buildKit(long long sampleRate, int audioSampleRate);
virtual void disposeKit(ModemKit *kit);
virtual void digitalStart(ModemKitDigital *kit, modem mod, ModemIQData *input);
virtual void digitalFinish(ModemKitDigital *kit, modem mod);
virtual void setDemodulatorLock(bool demod_lock_in);
virtual int getDemodulatorLock();
virtual void setDemodulatorCons(int demod_cons_in);
virtual int getDemodulatorCons();
virtual void updateDemodulatorCons(int cons);
virtual void updateDemodulatorLock(modem mod, float sensitivity);
protected:
std::vector<unsigned int> demodOutputDataDigital;
std::atomic_int demodulatorCons;
std::atomic_bool currentDemodLock;
std::atomic_int currentDemodCons;
// std::vector<unsigned int> demodOutputDataDigitalTest;
// std::vector<unsigned char> demodOutputSoftbits;
// std::vector<unsigned char> demodOutputSoftbitsTest;

View File

@ -8,9 +8,8 @@ ModemAPSK::ModemAPSK() {
demodAPSK64 = modem_create(LIQUID_MODEM_APSK64);
demodAPSK128 = modem_create(LIQUID_MODEM_APSK128);
demodAPSK256 = modem_create(LIQUID_MODEM_APSK256);
demodulatorCons.store(4);
currentDemodCons.store(0);
updateDemodulatorCons(4);
demodAPSK = demodAPSK4;
cons = 4;
}
Modem *ModemAPSK::factory() {
@ -31,46 +30,76 @@ std::string ModemAPSK::getName() {
return "APSK";
}
ModemArgInfoList ModemAPSK::getSettings() {
ModemArgInfoList args;
ModemArgInfo consArg;
consArg.key = "cons";
consArg.name = "Constellation";
consArg.description = "Modem Constellation Pattern";
consArg.value = std::to_string(cons);
consArg.type = ModemArgInfo::STRING;
std::vector<std::string> consOpts;
consOpts.push_back("4");
consOpts.push_back("8");
consOpts.push_back("16");
consOpts.push_back("32");
consOpts.push_back("64");
consOpts.push_back("128");
consOpts.push_back("256");
consArg.options = consOpts;
args.push_back(consArg);
return args;
}
void ModemAPSK::writeSetting(std::string setting, std::string value) {
if (setting == "cons") {
int newCons = std::stoi(value);
updateDemodulatorCons(newCons);
}
}
std::string ModemAPSK::readSetting(std::string setting) {
if (setting == "cons") {
return std::to_string(cons);
}
return "";
}
void ModemAPSK::updateDemodulatorCons(int cons) {
if (currentDemodCons.load() != cons) {
currentDemodCons = cons;
switch (demodulatorCons.load()) {
case 2:
demodAPSK = demodAPSK4;
updateDemodulatorCons(4);
break;
case 4:
demodAPSK = demodAPSK4;
updateDemodulatorCons(4);
break;
case 8:
demodAPSK = demodAPSK8;
updateDemodulatorCons(8);
break;
case 16:
demodAPSK = demodAPSK16;
updateDemodulatorCons(16);
break;
case 32:
demodAPSK = demodAPSK32;
updateDemodulatorCons(32);
break;
case 64:
demodAPSK = demodAPSK64;
updateDemodulatorCons(64);
break;
case 128:
demodAPSK = demodAPSK128;
updateDemodulatorCons(128);
break;
case 256:
demodAPSK = demodAPSK256;
updateDemodulatorCons(256);
break;
default:
demodAPSK = demodAPSK4;
break;
}
switch (cons) {
case 4:
demodAPSK = demodAPSK4;
updateDemodulatorCons(4);
break;
case 8:
demodAPSK = demodAPSK8;
updateDemodulatorCons(8);
break;
case 16:
demodAPSK = demodAPSK16;
updateDemodulatorCons(16);
break;
case 32:
demodAPSK = demodAPSK32;
updateDemodulatorCons(32);
break;
case 64:
demodAPSK = demodAPSK64;
updateDemodulatorCons(64);
break;
case 128:
demodAPSK = demodAPSK128;
updateDemodulatorCons(128);
break;
case 256:
demodAPSK = demodAPSK256;
updateDemodulatorCons(256);
break;
default:
demodAPSK = demodAPSK4;
break;
}
}

View File

@ -5,12 +5,20 @@ class ModemAPSK : public ModemDigital {
public:
ModemAPSK();
~ModemAPSK();
std::string getName();
Modem *factory();
ModemArgInfoList getSettings();
void writeSetting(std::string setting, std::string value);
std::string readSetting(std::string setting);
void updateDemodulatorCons(int cons);
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
int cons;
modem demodAPSK;
modem demodAPSK4;
modem demodAPSK8;

View File

@ -10,9 +10,7 @@ ModemASK::ModemASK() {
demodASK128 = modem_create(LIQUID_MODEM_ASK128);
demodASK256 = modem_create(LIQUID_MODEM_ASK256);
demodASK = demodASK2;
demodulatorCons.store(2);
currentDemodCons.store(0);
updateDemodulatorCons(2);
cons = 2;
}
Modem *ModemASK::factory() {
@ -33,47 +31,71 @@ std::string ModemASK::getName() {
return "ASK";
}
ModemArgInfoList ModemASK::getSettings() {
ModemArgInfoList args;
ModemArgInfo consArg;
consArg.key = "cons";
consArg.name = "Constellation";
consArg.description = "Modem Constellation Pattern";
consArg.value = std::to_string(cons);
consArg.type = ModemArgInfo::STRING;
std::vector<std::string> consOpts;
consOpts.push_back("2");
consOpts.push_back("4");
consOpts.push_back("8");
consOpts.push_back("16");
consOpts.push_back("32");
consOpts.push_back("64");
consOpts.push_back("128");
consOpts.push_back("256");
consArg.options = consOpts;
args.push_back(consArg);
return args;
}
void ModemASK::writeSetting(std::string setting, std::string value) {
if (setting == "cons") {
int newCons = std::stoi(value);
updateDemodulatorCons(newCons);
}
}
std::string ModemASK::readSetting(std::string setting) {
if (setting == "cons") {
return std::to_string(cons);
}
return "";
}
void ModemASK::updateDemodulatorCons(int cons) {
if (currentDemodCons.load() != cons) {
currentDemodCons = cons;
switch (demodulatorCons.load()) {
case 2:
demodASK = demodASK2;
updateDemodulatorCons(2);
break;
case 4:
demodASK = demodASK4;
updateDemodulatorCons(4);
break;
case 8:
demodASK = demodASK8;
updateDemodulatorCons(8);
break;
case 16:
demodASK = demodASK16;
updateDemodulatorCons(16);
break;
case 32:
demodASK = demodASK32;
updateDemodulatorCons(32);
break;
case 64:
demodASK = demodASK64;
updateDemodulatorCons(64);
break;
case 128:
demodASK = demodASK128;
updateDemodulatorCons(128);
break;
case 256:
demodASK = demodASK256;
updateDemodulatorCons(256);
break;
default:
demodASK = demodASK2;
break;
}
this->cons = cons;
switch (cons) {
case 2:
demodASK = demodASK2;
break;
case 4:
demodASK = demodASK4;
break;
case 8:
demodASK = demodASK8;
break;
case 16:
demodASK = demodASK16;
break;
case 32:
demodASK = demodASK32;
break;
case 64:
demodASK = demodASK64;
break;
case 128:
demodASK = demodASK128;
break;
case 256:
demodASK = demodASK256;
break;
}
}

View File

@ -5,12 +5,20 @@ class ModemASK : public ModemDigital {
public:
ModemASK();
~ModemASK();
std::string getName();
Modem *factory();
ModemArgInfoList getSettings();
void writeSetting(std::string setting, std::string value);
std::string readSetting(std::string setting);
void updateDemodulatorCons(int cons);
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
int cons;
modem demodASK;
modem demodASK2;
modem demodASK4;

View File

@ -16,12 +16,6 @@ std::string ModemBPSK::getName() {
return "BPSK";
}
void ModemBPSK::updateDemodulatorCons(int cons) {
if (currentDemodCons.load() != cons) {
currentDemodCons = cons;
}
}
void ModemBPSK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
ModemKitDigital *dkit = (ModemKitDigital *)kit;
digitalStart(dkit, demodBPSK, input);

View File

@ -5,12 +5,13 @@ class ModemBPSK : public ModemDigital {
public:
ModemBPSK();
~ModemBPSK();
std::string getName();
Modem *factory();
void updateDemodulatorCons(int cons);
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
modem demodBPSK;
};

View File

@ -9,9 +9,8 @@ ModemDPSK::ModemDPSK() {
demodDPSK64 = modem_create(LIQUID_MODEM_DPSK64);
demodDPSK128 = modem_create(LIQUID_MODEM_DPSK128);
demodDPSK256 = modem_create(LIQUID_MODEM_DPSK256);
demodulatorCons.store(2);
currentDemodCons.store(0);
updateDemodulatorCons(2);
demodDPSK = demodDPSK2;
cons = 2;
}
Modem *ModemDPSK::factory() {
@ -33,47 +32,71 @@ ModemDPSK::~ModemDPSK() {
modem_destroy(demodDPSK256);
}
ModemArgInfoList ModemDPSK::getSettings() {
ModemArgInfoList args;
ModemArgInfo consArg;
consArg.key = "cons";
consArg.name = "Constellation";
consArg.description = "Modem Constellation Pattern";
consArg.value = std::to_string(cons);
consArg.type = ModemArgInfo::STRING;
std::vector<std::string> consOpts;
consOpts.push_back("2");
consOpts.push_back("4");
consOpts.push_back("8");
consOpts.push_back("16");
consOpts.push_back("32");
consOpts.push_back("64");
consOpts.push_back("128");
consOpts.push_back("256");
consArg.options = consOpts;
args.push_back(consArg);
return args;
}
void ModemDPSK::writeSetting(std::string setting, std::string value) {
if (setting == "cons") {
int newCons = std::stoi(value);
updateDemodulatorCons(newCons);
}
}
std::string ModemDPSK::readSetting(std::string setting) {
if (setting == "cons") {
return std::to_string(cons);
}
return "";
}
void ModemDPSK::updateDemodulatorCons(int cons) {
if (currentDemodCons.load() != cons) {
currentDemodCons = cons;
switch (demodulatorCons.load()) {
case 2:
demodDPSK = demodDPSK2;
updateDemodulatorCons(2);
break;
case 4:
demodDPSK = demodDPSK4;
updateDemodulatorCons(4);
break;
case 8:
demodDPSK = demodDPSK8;
updateDemodulatorCons(8);
break;
case 16:
demodDPSK = demodDPSK16;
updateDemodulatorCons(16);
break;
case 32:
demodDPSK = demodDPSK32;
updateDemodulatorCons(32);
break;
case 64:
demodDPSK = demodDPSK64;
updateDemodulatorCons(64);
break;
case 128:
demodDPSK = demodDPSK128;
updateDemodulatorCons(128);
break;
case 256:
demodDPSK = demodDPSK256;
updateDemodulatorCons(256);
break;
default:
demodDPSK = demodDPSK2;
break;
}
this->cons = cons;
switch (cons) {
case 2:
demodDPSK = demodDPSK2;
break;
case 4:
demodDPSK = demodDPSK4;
break;
case 8:
demodDPSK = demodDPSK8;
break;
case 16:
demodDPSK = demodDPSK16;
break;
case 32:
demodDPSK = demodDPSK32;
break;
case 64:
demodDPSK = demodDPSK64;
break;
case 128:
demodDPSK = demodDPSK128;
break;
case 256:
demodDPSK = demodDPSK256;
break;
}
}

View File

@ -5,12 +5,20 @@ class ModemDPSK : public ModemDigital {
public:
ModemDPSK();
~ModemDPSK();
std::string getName();
Modem *factory();
ModemArgInfoList getSettings();
void writeSetting(std::string setting, std::string value);
std::string readSetting(std::string setting);
void updateDemodulatorCons(int cons);
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
int cons;
modem demodDPSK;
modem demodDPSK2;
modem demodDPSK4;

View File

@ -1,15 +1,37 @@
#include "ModemFSK.h"
ModemFSK::ModemFSK() {
demodulatorCons.store(2);
currentDemodCons.store(0);
updateDemodulatorCons(2);
bps = 9600;
spacing = 7000;
}
Modem *ModemFSK::factory() {
return new ModemFSK;
}
ModemArgInfoList ModemFSK::getSettings() {
ModemArgInfoList args;
return args;
}
void ModemFSK::writeSetting(std::string setting, std::string value) {
if (setting == "bps") {
} else if (setting == "spacing") {
}
}
std::string ModemFSK::readSetting(std::string setting) {
if (setting == "bps") {
return std::to_string(bps);
} else if (setting == "spacing") {
return std::to_string(spacing);
}
return "";
}
ModemKit *ModemFSK::buildKit(long long sampleRate, int audioSampleRate) {
ModemKitFSK *dkit = new ModemKitFSK;
dkit->m = 1;
@ -38,10 +60,6 @@ ModemFSK::~ModemFSK() {
}
void ModemFSK::updateDemodulatorCons(int cons) {
}
void ModemFSK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
ModemKitFSK *dkit = (ModemKitFSK *)kit;

View File

@ -15,15 +15,21 @@ class ModemFSK : public ModemDigital {
public:
ModemFSK();
~ModemFSK();
std::string getName();
Modem *factory();
ModemArgInfoList getSettings();
void writeSetting(std::string setting, std::string value);
std::string readSetting(std::string setting);
ModemKit *buildKit(long long sampleRate, int audioSampleRate);
void disposeKit(ModemKit *kit);
void updateDemodulatorCons(int cons);
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
fskdem dem;
int bps, spacing;
};

View File

@ -16,12 +16,6 @@ std::string ModemOOK::getName() {
return "OOK";
}
void ModemOOK::updateDemodulatorCons(int cons) {
if (currentDemodCons.load() != cons) {
currentDemodCons = cons;
}
}
void ModemOOK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
ModemKitDigital *dkit = (ModemKitDigital *)kit;
digitalStart(dkit, demodOOK, input);

View File

@ -5,12 +5,13 @@ class ModemOOK : public ModemDigital {
public:
ModemOOK();
~ModemOOK();
std::string getName();
Modem *factory();
void updateDemodulatorCons(int cons);
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
modem demodOOK;
};

View File

@ -9,9 +9,8 @@ ModemPSK::ModemPSK() {
demodPSK64 = modem_create(LIQUID_MODEM_PSK64);
demodPSK128 = modem_create(LIQUID_MODEM_PSK128);
demodPSK256 = modem_create(LIQUID_MODEM_PSK256);
demodulatorCons.store(2);
currentDemodCons.store(0);
updateDemodulatorCons(2);
demodPSK = demodPSK2;
cons = 2;
}
Modem *ModemPSK::factory() {
@ -33,47 +32,72 @@ ModemPSK::~ModemPSK() {
modem_destroy(demodPSK256);
}
ModemArgInfoList ModemPSK::getSettings() {
ModemArgInfoList args;
ModemArgInfo consArg;
consArg.key = "cons";
consArg.name = "Constellation";
consArg.description = "Modem Constellation Pattern";
consArg.value = std::to_string(cons);
consArg.type = ModemArgInfo::STRING;
std::vector<std::string> consOpts;
consOpts.push_back("2");
consOpts.push_back("4");
consOpts.push_back("8");
consOpts.push_back("16");
consOpts.push_back("32");
consOpts.push_back("64");
consOpts.push_back("128");
consOpts.push_back("256");
consArg.options = consOpts;
args.push_back(consArg);
return args;
}
void ModemPSK::writeSetting(std::string setting, std::string value) {
if (setting == "cons") {
int newCons = std::stoi(value);
updateDemodulatorCons(newCons);
}
}
std::string ModemPSK::readSetting(std::string setting) {
if (setting == "cons") {
return std::to_string(cons);
}
return "";
}
void ModemPSK::updateDemodulatorCons(int cons) {
if (currentDemodCons.load() != cons) {
currentDemodCons = cons;
switch (demodulatorCons.load()) {
case 2:
demodPSK = demodPSK2;
updateDemodulatorCons(2);
break;
case 4:
demodPSK = demodPSK4;
updateDemodulatorCons(4);
break;
case 8:
demodPSK = demodPSK8;
updateDemodulatorCons(8);
break;
case 16:
demodPSK = demodPSK16;
updateDemodulatorCons(16);
break;
case 32:
demodPSK = demodPSK32;
updateDemodulatorCons(32);
break;
case 64:
demodPSK = demodPSK64;
updateDemodulatorCons(64);
break;
case 128:
demodPSK = demodPSK128;
updateDemodulatorCons(128);
break;
case 256:
demodPSK = demodPSK256;
updateDemodulatorCons(256);
break;
default:
demodPSK = demodPSK2;
break;
}
this->cons = cons;
switch (cons) {
case 2:
demodPSK = demodPSK2;
break;
case 4:
demodPSK = demodPSK4;
break;
case 8:
demodPSK = demodPSK8;
break;
case 16:
demodPSK = demodPSK16;
break;
case 32:
demodPSK = demodPSK32;
break;
case 64:
demodPSK = demodPSK64;
break;
case 128:
demodPSK = demodPSK128;
break;
case 256:
demodPSK = demodPSK256;
break;
}
}

View File

@ -5,12 +5,20 @@ class ModemPSK : public ModemDigital {
public:
ModemPSK();
~ModemPSK();
std::string getName();
Modem *factory();
ModemArgInfoList getSettings();
void writeSetting(std::string setting, std::string value);
std::string readSetting(std::string setting);
void updateDemodulatorCons(int cons);
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
int cons;
modem demodPSK;
modem demodPSK2;
modem demodPSK4;

View File

@ -8,9 +8,8 @@ ModemQAM::ModemQAM() {
demodQAM64 = modem_create(LIQUID_MODEM_QAM64);
demodQAM128 = modem_create(LIQUID_MODEM_QAM128);
demodQAM256 = modem_create(LIQUID_MODEM_QAM256);
demodulatorCons.store(4);
currentDemodCons.store(0);
updateDemodulatorCons(4);
demodQAM = demodQAM4;
cons = 4;
}
Modem *ModemQAM::factory() {
@ -31,47 +30,67 @@ ModemQAM::~ModemQAM() {
modem_destroy(demodQAM256);
}
ModemArgInfoList ModemQAM::getSettings() {
ModemArgInfoList args;
ModemArgInfo consArg;
consArg.key = "cons";
consArg.name = "Constellation";
consArg.description = "Modem Constellation Pattern";
consArg.value = std::to_string(cons);
consArg.type = ModemArgInfo::STRING;
std::vector<std::string> consOpts;
consOpts.push_back("4");
consOpts.push_back("8");
consOpts.push_back("16");
consOpts.push_back("32");
consOpts.push_back("64");
consOpts.push_back("128");
consOpts.push_back("256");
consArg.options = consOpts;
args.push_back(consArg);
return args;
}
void ModemQAM::writeSetting(std::string setting, std::string value) {
if (setting == "cons") {
int newCons = std::stoi(value);
updateDemodulatorCons(newCons);
}
}
std::string ModemQAM::readSetting(std::string setting) {
if (setting == "cons") {
return std::to_string(cons);
}
return "";
}
void ModemQAM::updateDemodulatorCons(int cons) {
if (currentDemodCons.load() != cons) {
currentDemodCons = cons;
switch (demodulatorCons.load()) {
case 2:
demodQAM = demodQAM4;
updateDemodulatorCons(4);
break;
case 4:
demodQAM = demodQAM4;
updateDemodulatorCons(4);
break;
case 8:
demodQAM = demodQAM8;
updateDemodulatorCons(8);
break;
case 16:
demodQAM = demodQAM16;
updateDemodulatorCons(16);
break;
case 32:
demodQAM = demodQAM32;
updateDemodulatorCons(32);
break;
case 64:
demodQAM = demodQAM64;
updateDemodulatorCons(64);
break;
case 128:
demodQAM = demodQAM128;
updateDemodulatorCons(128);
break;
case 256:
demodQAM = demodQAM256;
updateDemodulatorCons(256);
break;
default:
demodQAM = demodQAM4;
break;
}
this->cons = cons;
switch (cons) {
case 4:
demodQAM = demodQAM4;
break;
case 8:
demodQAM = demodQAM8;
break;
case 16:
demodQAM = demodQAM16;
break;
case 32:
demodQAM = demodQAM32;
break;
case 64:
demodQAM = demodQAM64;
break;
case 128:
demodQAM = demodQAM128;
break;
case 256:
demodQAM = demodQAM256;
break;
}
}

View File

@ -5,12 +5,20 @@ class ModemQAM : public ModemDigital {
public:
ModemQAM();
~ModemQAM();
std::string getName();
Modem *factory();
ModemArgInfoList getSettings();
void writeSetting(std::string setting, std::string value);
std::string readSetting(std::string setting);
void updateDemodulatorCons(int cons);
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
int cons;
modem demodQAM;
modem demodQAM4;
modem demodQAM8;

View File

@ -16,12 +16,6 @@ std::string ModemQPSK::getName() {
return "QPSK";
}
void ModemQPSK::updateDemodulatorCons(int cons) {
if (currentDemodCons.load() != cons) {
currentDemodCons = cons;
}
}
void ModemQPSK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
ModemKitDigital *dkit = (ModemKitDigital *)kit;
digitalStart(dkit, demodQPSK, input);

View File

@ -5,9 +5,11 @@ class ModemQPSK : public ModemDigital {
public:
ModemQPSK();
~ModemQPSK();
std::string getName();
Modem *factory();
void updateDemodulatorCons(int cons);
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:

View File

@ -3,9 +3,8 @@
ModemSQAM::ModemSQAM() {
demodSQAM32 = modem_create(LIQUID_MODEM_SQAM32);
demodSQAM128 = modem_create(LIQUID_MODEM_SQAM128);
demodulatorCons.store(32);
currentDemodCons.store(0);
updateDemodulatorCons(32);
demodSQAM = demodSQAM32;
cons = 32;
}
Modem *ModemSQAM::factory() {
@ -21,47 +20,47 @@ std::string ModemSQAM::getName() {
return "SQAM";
}
ModemArgInfoList ModemSQAM::getSettings() {
ModemArgInfoList args;
ModemArgInfo consArg;
consArg.key = "cons";
consArg.name = "Constellation";
consArg.description = "Modem Constellation Pattern";
consArg.value = std::to_string(cons);
consArg.type = ModemArgInfo::STRING;
std::vector<std::string> consOpts;
consOpts.push_back("32");
consOpts.push_back("128");
consArg.options = consOpts;
args.push_back(consArg);
return args;
}
void ModemSQAM::writeSetting(std::string setting, std::string value) {
if (setting == "cons") {
int newCons = std::stoi(value);
updateDemodulatorCons(newCons);
}
}
std::string ModemSQAM::readSetting(std::string setting) {
if (setting == "cons") {
return std::to_string(cons);
}
return "";
}
void ModemSQAM::updateDemodulatorCons(int cons) {
if (currentDemodCons.load() != cons) {
currentDemodCons = cons;
switch (demodulatorCons.load()) {
case 2:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 4:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 8:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 16:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 32:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 64:
demodSQAM = demodSQAM32;
updateDemodulatorCons(32);
break;
case 128:
demodSQAM = demodSQAM128;
updateDemodulatorCons(128);
break;
case 256:
demodSQAM = demodSQAM128;
updateDemodulatorCons(128);
break;
default:
demodSQAM = demodSQAM32;
break;
}
this->cons = cons;
switch (cons) {
case 32:
demodSQAM = demodSQAM32;
break;
case 128:
demodSQAM = demodSQAM128;
break;
}
}

View File

@ -5,12 +5,20 @@ class ModemSQAM : public ModemDigital {
public:
ModemSQAM();
~ModemSQAM();
std::string getName();
Modem *factory();
ModemArgInfoList getSettings();
void writeSetting(std::string setting, std::string value);
std::string readSetting(std::string setting);
void updateDemodulatorCons(int cons);
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:
int cons;
modem demodSQAM;
modem demodSQAM32;
modem demodSQAM128;

View File

@ -16,12 +16,6 @@ ModemST::~ModemST() {
modem_destroy(demodST);
}
void ModemST::updateDemodulatorCons(int cons) {
if (currentDemodCons.load() != cons) {
currentDemodCons = cons;
}
}
void ModemST::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
ModemKitDigital *dkit = (ModemKitDigital *)kit;
digitalStart(dkit, demodST, input);

View File

@ -5,9 +5,11 @@ class ModemST : public ModemDigital {
public:
ModemST();
~ModemST();
std::string getName();
Modem *factory();
void updateDemodulatorCons(int cons);
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
private:

View File

@ -230,9 +230,9 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGBA4f color, long
}
// advanced demodulators start here
if (demod->getDemodulatorCons() > 0) {
demodStr = demodStr + std::to_string(demod->getDemodulatorCons());
}
// if (demod->getDemodulatorCons() > 0) {
// demodStr = demodStr + std::to_string(demod->getDemodulatorCons());
// }
// add lock to string if we have an lock
if(demod->getDemodulatorLock()) {