mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-03 14:35:03 -04:00
Convert constellation code to ModemArgInfo settings
- Note: can’t set constellation yet until property grid is added
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user