Convert constellation code to ModemArgInfo settings
- Note: can’t set constellation yet until property grid is added
This commit is contained in:
parent
de1264fe17
commit
4a62eae096
|
@ -93,19 +93,6 @@ AppFrame::AppFrame() :
|
||||||
demodModeSelectorAdv->addChoice(10, "QPSK");
|
demodModeSelectorAdv->addChoice(10, "QPSK");
|
||||||
demodModeSelectorAdv->setHelpTip("Choose advanced modulation types.");
|
demodModeSelectorAdv->setHelpTip("Choose advanced modulation types.");
|
||||||
demodTray->Add(demodModeSelectorAdv, 3, wxEXPAND | wxALL, 0);
|
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
|
#endif
|
||||||
|
|
||||||
wxGetApp().getDemodSpectrumProcessor()->setup(1024);
|
wxGetApp().getDemodSpectrumProcessor()->setup(1024);
|
||||||
|
@ -862,9 +849,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||||
std::string dType = demod->getDemodulatorType();
|
std::string dType = demod->getDemodulatorType();
|
||||||
demodModeSelector->setSelection(dType);
|
demodModeSelector->setSelection(dType);
|
||||||
#ifdef ENABLE_DIGITAL_LAB
|
#ifdef ENABLE_DIGITAL_LAB
|
||||||
int dCons = demod->getDemodulatorCons();
|
|
||||||
demodModeSelectorAdv->setSelection(dType);
|
demodModeSelectorAdv->setSelection(dType);
|
||||||
demodModeSelectorCons->setSelection(dCons);
|
|
||||||
#endif
|
#endif
|
||||||
demodMuteButton->setSelection(demod->isMuted()?1:-1);
|
demodMuteButton->setSelection(demod->isMuted()?1:-1);
|
||||||
}
|
}
|
||||||
|
@ -896,7 +881,6 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||||
std::string dSelection = demodModeSelector->getSelectionLabel();
|
std::string dSelection = demodModeSelector->getSelectionLabel();
|
||||||
#ifdef ENABLE_DIGITAL_LAB
|
#ifdef ENABLE_DIGITAL_LAB
|
||||||
std::string dSelectionadv = demodModeSelectorAdv->getSelectionLabel();
|
std::string dSelectionadv = demodModeSelectorAdv->getSelectionLabel();
|
||||||
int dSelectionCons = demodModeSelectorCons->getSelection();
|
|
||||||
|
|
||||||
// basic demodulators
|
// basic demodulators
|
||||||
if (dSelection != "" && dSelection != demod->getDemodulatorType()) {
|
if (dSelection != "" && dSelection != demod->getDemodulatorType()) {
|
||||||
|
@ -908,11 +892,6 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||||
demod->setDemodulatorType(dSelectionadv);
|
demod->setDemodulatorType(dSelectionadv);
|
||||||
demodModeSelector->setSelection(-1);
|
demodModeSelector->setSelection(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set constellations
|
|
||||||
if (dSelectionCons != demod->getDemodulatorCons()) {
|
|
||||||
demod->setDemodulatorCons(dSelectionCons);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
// basic demodulators
|
// basic demodulators
|
||||||
if (dSelection != "" && dSelection != demod->getDemodulatorType()) {
|
if (dSelection != "" && dSelection != demod->getDemodulatorType()) {
|
||||||
|
@ -958,7 +937,6 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||||
std::string dSelection = demodModeSelector->getSelectionLabel();
|
std::string dSelection = demodModeSelector->getSelectionLabel();
|
||||||
#ifdef ENABLE_DIGITAL_LAB
|
#ifdef ENABLE_DIGITAL_LAB
|
||||||
std::string dSelectionadv = demodModeSelectorAdv->getSelectionLabel();
|
std::string dSelectionadv = demodModeSelectorAdv->getSelectionLabel();
|
||||||
int dSelectionCons = demodModeSelectorCons->getSelection();
|
|
||||||
|
|
||||||
// basic demodulators
|
// basic demodulators
|
||||||
if (dSelection != "" && dSelection != mgr->getLastDemodulatorType()) {
|
if (dSelection != "" && dSelection != mgr->getLastDemodulatorType()) {
|
||||||
|
@ -970,11 +948,6 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||||
mgr->setLastDemodulatorType(dSelectionadv);
|
mgr->setLastDemodulatorType(dSelectionadv);
|
||||||
demodModeSelector->setSelection(-1);
|
demodModeSelector->setSelection(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set constellations
|
|
||||||
if (dSelectionCons != mgr->getLastDemodulatorCons()) {
|
|
||||||
mgr->setLastDemodulatorCons(dSelectionCons);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
// basic demodulators
|
// basic demodulators
|
||||||
if (dSelection != "" && dSelection != mgr->getLastDemodulatorType()) {
|
if (dSelection != "" && dSelection != mgr->getLastDemodulatorType()) {
|
||||||
|
|
|
@ -81,7 +81,6 @@ private:
|
||||||
ModeSelectorCanvas *demodModeSelector;
|
ModeSelectorCanvas *demodModeSelector;
|
||||||
#ifdef ENABLE_DIGITAL_LAB
|
#ifdef ENABLE_DIGITAL_LAB
|
||||||
ModeSelectorCanvas *demodModeSelectorAdv;
|
ModeSelectorCanvas *demodModeSelectorAdv;
|
||||||
ModeSelectorCanvas *demodModeSelectorCons;
|
|
||||||
#endif
|
#endif
|
||||||
SpectrumCanvas *demodSpectrumCanvas;
|
SpectrumCanvas *demodSpectrumCanvas;
|
||||||
WaterfallCanvas *demodWaterfallCanvas;
|
WaterfallCanvas *demodWaterfallCanvas;
|
||||||
|
|
|
@ -261,21 +261,6 @@ int DemodulatorInstance::getDemodulatorLock() {
|
||||||
return 0;
|
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) {
|
void DemodulatorInstance::setBandwidth(int bw) {
|
||||||
demodulatorPreThread->setBandwidth(bw);
|
demodulatorPreThread->setBandwidth(bw);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,9 +58,6 @@ public:
|
||||||
|
|
||||||
void setDemodulatorLock(bool demod_lock_in);
|
void setDemodulatorLock(bool demod_lock_in);
|
||||||
int getDemodulatorLock();
|
int getDemodulatorLock();
|
||||||
|
|
||||||
void setDemodulatorCons(int demod_cons_in);
|
|
||||||
int getDemodulatorCons();
|
|
||||||
|
|
||||||
void setBandwidth(int bw);
|
void setBandwidth(int bw);
|
||||||
int getBandwidth();
|
int getBandwidth();
|
||||||
|
|
|
@ -162,7 +162,6 @@ void DemodulatorMgr::updateLastState() {
|
||||||
lastBandwidth = lastActiveDemodulator->getBandwidth();
|
lastBandwidth = lastActiveDemodulator->getBandwidth();
|
||||||
lastDemodType = lastActiveDemodulator->getDemodulatorType();
|
lastDemodType = lastActiveDemodulator->getDemodulatorType();
|
||||||
lastDemodLock = lastActiveDemodulator->getDemodulatorLock();
|
lastDemodLock = lastActiveDemodulator->getDemodulatorLock();
|
||||||
lastDemodCons = lastActiveDemodulator->getDemodulatorCons();
|
|
||||||
lastSquelchEnabled = lastActiveDemodulator->isSquelchEnabled();
|
lastSquelchEnabled = lastActiveDemodulator->isSquelchEnabled();
|
||||||
lastSquelch = lastActiveDemodulator->getSquelchLevel();
|
lastSquelch = lastActiveDemodulator->getSquelchLevel();
|
||||||
lastGain = lastActiveDemodulator->getGain();
|
lastGain = lastActiveDemodulator->getGain();
|
||||||
|
@ -191,14 +190,6 @@ void DemodulatorMgr::setLastDemodulatorType(std::string lastDemodType) {
|
||||||
this->lastDemodType = lastDemodType;
|
this->lastDemodType = lastDemodType;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DemodulatorMgr::getLastDemodulatorCons() const {
|
|
||||||
return lastDemodCons;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DemodulatorMgr::setLastDemodulatorCons(int lastDemodCons) {
|
|
||||||
this->lastDemodCons = lastDemodCons;
|
|
||||||
}
|
|
||||||
|
|
||||||
float DemodulatorMgr::getLastGain() const {
|
float DemodulatorMgr::getLastGain() const {
|
||||||
return lastGain;
|
return lastGain;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,9 +27,6 @@ public:
|
||||||
|
|
||||||
std::string getLastDemodulatorType() const;
|
std::string getLastDemodulatorType() const;
|
||||||
void setLastDemodulatorType(std::string lastDemodType);
|
void setLastDemodulatorType(std::string lastDemodType);
|
||||||
|
|
||||||
int getLastDemodulatorCons() const;
|
|
||||||
void setLastDemodulatorCons(int lastDemodCons);
|
|
||||||
|
|
||||||
float getLastGain() const;
|
float getLastGain() const;
|
||||||
void setLastGain(float lastGain);
|
void setLastGain(float lastGain);
|
||||||
|
@ -56,7 +53,6 @@ private:
|
||||||
int lastBandwidth;
|
int lastBandwidth;
|
||||||
std::string lastDemodType;
|
std::string lastDemodType;
|
||||||
bool lastDemodLock;
|
bool lastDemodLock;
|
||||||
int lastDemodCons;
|
|
||||||
bool lastSquelchEnabled;
|
bool lastSquelchEnabled;
|
||||||
float lastSquelch;
|
float lastSquelch;
|
||||||
float lastGain;
|
float lastGain;
|
||||||
|
|
|
@ -2,6 +2,22 @@
|
||||||
|
|
||||||
ModemFactoryList Modem::modemFactories;
|
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) {
|
void Modem::addModemFactory(Modem *factorySingle) {
|
||||||
modemFactories[factorySingle->getName()] = factorySingle;
|
modemFactories[factorySingle->getName()] = factorySingle;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Copy of SoapySDR::Range, original comments
|
// Copy of SoapySDR::Range, original comments
|
||||||
class ModemRange
|
class ModemRange
|
||||||
{
|
{
|
||||||
|
@ -51,7 +50,6 @@ private:
|
||||||
double _min, _max;
|
double _min, _max;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Modified version of SoapySDR::ArgInfo, original comments
|
// Modified version of SoapySDR::ArgInfo, original comments
|
||||||
class ModemArgInfo
|
class ModemArgInfo
|
||||||
{
|
{
|
||||||
|
@ -121,9 +119,12 @@ public:
|
||||||
virtual ModemArgInfoList getSettings();
|
virtual ModemArgInfoList getSettings();
|
||||||
virtual void writeSetting(std::string setting, std::string value);
|
virtual void writeSetting(std::string setting, std::string value);
|
||||||
virtual std::string readSetting(std::string setting);
|
virtual std::string readSetting(std::string setting);
|
||||||
|
|
||||||
virtual int checkSampleRate(long long sampleRate, int audioSampleRate) = 0;
|
virtual int checkSampleRate(long long sampleRate, int audioSampleRate) = 0;
|
||||||
|
|
||||||
virtual ModemKit *buildKit(long long sampleRate, int audioSampleRate) = 0;
|
virtual ModemKit *buildKit(long long sampleRate, int audioSampleRate) = 0;
|
||||||
virtual void disposeKit(ModemKit *kit) = 0;
|
virtual void disposeKit(ModemKit *kit) = 0;
|
||||||
|
|
||||||
virtual void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) = 0;
|
virtual void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) = 0;
|
||||||
private:
|
private:
|
||||||
static ModemFactoryList modemFactories;
|
static ModemFactoryList modemFactories;
|
||||||
|
|
|
@ -38,24 +38,10 @@ int ModemDigital::getDemodulatorLock() {
|
||||||
return currentDemodLock.load();
|
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) {
|
void ModemDigital::updateDemodulatorLock(modem mod, float sensitivity) {
|
||||||
setDemodulatorLock(modem_get_demodulator_evm(mod) <= 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) {
|
void ModemDigital::digitalStart(ModemKitDigital *kit, modem mod, ModemIQData *input) {
|
||||||
int bufSize = input->data.size();
|
int bufSize = input->data.size();
|
||||||
|
|
||||||
|
@ -65,14 +51,9 @@ void ModemDigital::digitalStart(ModemKitDigital *kit, modem mod, ModemIQData *in
|
||||||
}
|
}
|
||||||
demodOutputDataDigital.resize(bufSize);
|
demodOutputDataDigital.resize(bufSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (demodulatorCons.load() != currentDemodCons.load()) {
|
|
||||||
updateDemodulatorCons(demodulatorCons.load());
|
|
||||||
currentDemodLock.store(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModemDigital::digitalFinish(ModemKitDigital *kit, modem mod) {
|
void ModemDigital::digitalFinish(ModemKitDigital *kit, modem mod) {
|
||||||
demodOutputDataDigital.empty();
|
demodOutputDataDigital.empty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,28 +12,26 @@ public:
|
||||||
class ModemDigital : public Modem {
|
class ModemDigital : public Modem {
|
||||||
public:
|
public:
|
||||||
ModemDigital();
|
ModemDigital();
|
||||||
|
|
||||||
std::string getType();
|
std::string getType();
|
||||||
|
|
||||||
virtual int checkSampleRate(long long sampleRate, int audioSampleRate);
|
virtual int checkSampleRate(long long sampleRate, int audioSampleRate);
|
||||||
|
|
||||||
virtual ModemKit *buildKit(long long sampleRate, int audioSampleRate);
|
virtual ModemKit *buildKit(long long sampleRate, int audioSampleRate);
|
||||||
virtual void disposeKit(ModemKit *kit);
|
virtual void disposeKit(ModemKit *kit);
|
||||||
|
|
||||||
virtual void digitalStart(ModemKitDigital *kit, modem mod, ModemIQData *input);
|
virtual void digitalStart(ModemKitDigital *kit, modem mod, ModemIQData *input);
|
||||||
virtual void digitalFinish(ModemKitDigital *kit, modem mod);
|
virtual void digitalFinish(ModemKitDigital *kit, modem mod);
|
||||||
|
|
||||||
virtual void setDemodulatorLock(bool demod_lock_in);
|
virtual void setDemodulatorLock(bool demod_lock_in);
|
||||||
virtual int getDemodulatorLock();
|
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);
|
virtual void updateDemodulatorLock(modem mod, float sensitivity);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<unsigned int> demodOutputDataDigital;
|
std::vector<unsigned int> demodOutputDataDigital;
|
||||||
std::atomic_int demodulatorCons;
|
|
||||||
std::atomic_bool currentDemodLock;
|
std::atomic_bool currentDemodLock;
|
||||||
std::atomic_int currentDemodCons;
|
|
||||||
|
|
||||||
// std::vector<unsigned int> demodOutputDataDigitalTest;
|
// std::vector<unsigned int> demodOutputDataDigitalTest;
|
||||||
// std::vector<unsigned char> demodOutputSoftbits;
|
// std::vector<unsigned char> demodOutputSoftbits;
|
||||||
// std::vector<unsigned char> demodOutputSoftbitsTest;
|
// std::vector<unsigned char> demodOutputSoftbitsTest;
|
||||||
|
|
|
@ -8,9 +8,8 @@ ModemAPSK::ModemAPSK() {
|
||||||
demodAPSK64 = modem_create(LIQUID_MODEM_APSK64);
|
demodAPSK64 = modem_create(LIQUID_MODEM_APSK64);
|
||||||
demodAPSK128 = modem_create(LIQUID_MODEM_APSK128);
|
demodAPSK128 = modem_create(LIQUID_MODEM_APSK128);
|
||||||
demodAPSK256 = modem_create(LIQUID_MODEM_APSK256);
|
demodAPSK256 = modem_create(LIQUID_MODEM_APSK256);
|
||||||
demodulatorCons.store(4);
|
demodAPSK = demodAPSK4;
|
||||||
currentDemodCons.store(0);
|
cons = 4;
|
||||||
updateDemodulatorCons(4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Modem *ModemAPSK::factory() {
|
Modem *ModemAPSK::factory() {
|
||||||
|
@ -31,46 +30,76 @@ std::string ModemAPSK::getName() {
|
||||||
return "APSK";
|
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) {
|
void ModemAPSK::updateDemodulatorCons(int cons) {
|
||||||
if (currentDemodCons.load() != cons) {
|
switch (cons) {
|
||||||
currentDemodCons = cons;
|
case 4:
|
||||||
switch (demodulatorCons.load()) {
|
demodAPSK = demodAPSK4;
|
||||||
case 2:
|
updateDemodulatorCons(4);
|
||||||
demodAPSK = demodAPSK4;
|
break;
|
||||||
updateDemodulatorCons(4);
|
case 8:
|
||||||
break;
|
demodAPSK = demodAPSK8;
|
||||||
case 4:
|
updateDemodulatorCons(8);
|
||||||
demodAPSK = demodAPSK4;
|
break;
|
||||||
updateDemodulatorCons(4);
|
case 16:
|
||||||
break;
|
demodAPSK = demodAPSK16;
|
||||||
case 8:
|
updateDemodulatorCons(16);
|
||||||
demodAPSK = demodAPSK8;
|
break;
|
||||||
updateDemodulatorCons(8);
|
case 32:
|
||||||
break;
|
demodAPSK = demodAPSK32;
|
||||||
case 16:
|
updateDemodulatorCons(32);
|
||||||
demodAPSK = demodAPSK16;
|
break;
|
||||||
updateDemodulatorCons(16);
|
case 64:
|
||||||
break;
|
demodAPSK = demodAPSK64;
|
||||||
case 32:
|
updateDemodulatorCons(64);
|
||||||
demodAPSK = demodAPSK32;
|
break;
|
||||||
updateDemodulatorCons(32);
|
case 128:
|
||||||
break;
|
demodAPSK = demodAPSK128;
|
||||||
case 64:
|
updateDemodulatorCons(128);
|
||||||
demodAPSK = demodAPSK64;
|
break;
|
||||||
updateDemodulatorCons(64);
|
case 256:
|
||||||
break;
|
demodAPSK = demodAPSK256;
|
||||||
case 128:
|
updateDemodulatorCons(256);
|
||||||
demodAPSK = demodAPSK128;
|
break;
|
||||||
updateDemodulatorCons(128);
|
default:
|
||||||
break;
|
demodAPSK = demodAPSK4;
|
||||||
case 256:
|
break;
|
||||||
demodAPSK = demodAPSK256;
|
|
||||||
updateDemodulatorCons(256);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
demodAPSK = demodAPSK4;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,20 @@ class ModemAPSK : public ModemDigital {
|
||||||
public:
|
public:
|
||||||
ModemAPSK();
|
ModemAPSK();
|
||||||
~ModemAPSK();
|
~ModemAPSK();
|
||||||
|
|
||||||
std::string getName();
|
std::string getName();
|
||||||
|
|
||||||
Modem *factory();
|
Modem *factory();
|
||||||
|
|
||||||
|
ModemArgInfoList getSettings();
|
||||||
|
void writeSetting(std::string setting, std::string value);
|
||||||
|
std::string readSetting(std::string setting);
|
||||||
|
|
||||||
void updateDemodulatorCons(int cons);
|
void updateDemodulatorCons(int cons);
|
||||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int cons;
|
||||||
modem demodAPSK;
|
modem demodAPSK;
|
||||||
modem demodAPSK4;
|
modem demodAPSK4;
|
||||||
modem demodAPSK8;
|
modem demodAPSK8;
|
||||||
|
|
|
@ -10,9 +10,7 @@ ModemASK::ModemASK() {
|
||||||
demodASK128 = modem_create(LIQUID_MODEM_ASK128);
|
demodASK128 = modem_create(LIQUID_MODEM_ASK128);
|
||||||
demodASK256 = modem_create(LIQUID_MODEM_ASK256);
|
demodASK256 = modem_create(LIQUID_MODEM_ASK256);
|
||||||
demodASK = demodASK2;
|
demodASK = demodASK2;
|
||||||
demodulatorCons.store(2);
|
cons = 2;
|
||||||
currentDemodCons.store(0);
|
|
||||||
updateDemodulatorCons(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Modem *ModemASK::factory() {
|
Modem *ModemASK::factory() {
|
||||||
|
@ -33,47 +31,71 @@ std::string ModemASK::getName() {
|
||||||
return "ASK";
|
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) {
|
void ModemASK::updateDemodulatorCons(int cons) {
|
||||||
if (currentDemodCons.load() != cons) {
|
this->cons = cons;
|
||||||
currentDemodCons = cons;
|
switch (cons) {
|
||||||
|
case 2:
|
||||||
switch (demodulatorCons.load()) {
|
demodASK = demodASK2;
|
||||||
case 2:
|
break;
|
||||||
demodASK = demodASK2;
|
case 4:
|
||||||
updateDemodulatorCons(2);
|
demodASK = demodASK4;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 8:
|
||||||
demodASK = demodASK4;
|
demodASK = demodASK8;
|
||||||
updateDemodulatorCons(4);
|
break;
|
||||||
break;
|
case 16:
|
||||||
case 8:
|
demodASK = demodASK16;
|
||||||
demodASK = demodASK8;
|
break;
|
||||||
updateDemodulatorCons(8);
|
case 32:
|
||||||
break;
|
demodASK = demodASK32;
|
||||||
case 16:
|
break;
|
||||||
demodASK = demodASK16;
|
case 64:
|
||||||
updateDemodulatorCons(16);
|
demodASK = demodASK64;
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 128:
|
||||||
demodASK = demodASK32;
|
demodASK = demodASK128;
|
||||||
updateDemodulatorCons(32);
|
break;
|
||||||
break;
|
case 256:
|
||||||
case 64:
|
demodASK = demodASK256;
|
||||||
demodASK = demodASK64;
|
break;
|
||||||
updateDemodulatorCons(64);
|
|
||||||
break;
|
|
||||||
case 128:
|
|
||||||
demodASK = demodASK128;
|
|
||||||
updateDemodulatorCons(128);
|
|
||||||
break;
|
|
||||||
case 256:
|
|
||||||
demodASK = demodASK256;
|
|
||||||
updateDemodulatorCons(256);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
demodASK = demodASK2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,20 @@ class ModemASK : public ModemDigital {
|
||||||
public:
|
public:
|
||||||
ModemASK();
|
ModemASK();
|
||||||
~ModemASK();
|
~ModemASK();
|
||||||
|
|
||||||
std::string getName();
|
std::string getName();
|
||||||
|
|
||||||
Modem *factory();
|
Modem *factory();
|
||||||
|
|
||||||
|
ModemArgInfoList getSettings();
|
||||||
|
void writeSetting(std::string setting, std::string value);
|
||||||
|
std::string readSetting(std::string setting);
|
||||||
|
|
||||||
void updateDemodulatorCons(int cons);
|
void updateDemodulatorCons(int cons);
|
||||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int cons;
|
||||||
modem demodASK;
|
modem demodASK;
|
||||||
modem demodASK2;
|
modem demodASK2;
|
||||||
modem demodASK4;
|
modem demodASK4;
|
||||||
|
|
|
@ -16,12 +16,6 @@ std::string ModemBPSK::getName() {
|
||||||
return "BPSK";
|
return "BPSK";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModemBPSK::updateDemodulatorCons(int cons) {
|
|
||||||
if (currentDemodCons.load() != cons) {
|
|
||||||
currentDemodCons = cons;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModemBPSK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
void ModemBPSK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||||
ModemKitDigital *dkit = (ModemKitDigital *)kit;
|
ModemKitDigital *dkit = (ModemKitDigital *)kit;
|
||||||
digitalStart(dkit, demodBPSK, input);
|
digitalStart(dkit, demodBPSK, input);
|
||||||
|
|
|
@ -5,12 +5,13 @@ class ModemBPSK : public ModemDigital {
|
||||||
public:
|
public:
|
||||||
ModemBPSK();
|
ModemBPSK();
|
||||||
~ModemBPSK();
|
~ModemBPSK();
|
||||||
|
|
||||||
std::string getName();
|
std::string getName();
|
||||||
|
|
||||||
Modem *factory();
|
Modem *factory();
|
||||||
void updateDemodulatorCons(int cons);
|
|
||||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
modem demodBPSK;
|
modem demodBPSK;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,9 +9,8 @@ ModemDPSK::ModemDPSK() {
|
||||||
demodDPSK64 = modem_create(LIQUID_MODEM_DPSK64);
|
demodDPSK64 = modem_create(LIQUID_MODEM_DPSK64);
|
||||||
demodDPSK128 = modem_create(LIQUID_MODEM_DPSK128);
|
demodDPSK128 = modem_create(LIQUID_MODEM_DPSK128);
|
||||||
demodDPSK256 = modem_create(LIQUID_MODEM_DPSK256);
|
demodDPSK256 = modem_create(LIQUID_MODEM_DPSK256);
|
||||||
demodulatorCons.store(2);
|
demodDPSK = demodDPSK2;
|
||||||
currentDemodCons.store(0);
|
cons = 2;
|
||||||
updateDemodulatorCons(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Modem *ModemDPSK::factory() {
|
Modem *ModemDPSK::factory() {
|
||||||
|
@ -33,47 +32,71 @@ ModemDPSK::~ModemDPSK() {
|
||||||
modem_destroy(demodDPSK256);
|
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) {
|
void ModemDPSK::updateDemodulatorCons(int cons) {
|
||||||
if (currentDemodCons.load() != cons) {
|
this->cons = cons;
|
||||||
currentDemodCons = cons;
|
switch (cons) {
|
||||||
|
case 2:
|
||||||
switch (demodulatorCons.load()) {
|
demodDPSK = demodDPSK2;
|
||||||
case 2:
|
break;
|
||||||
demodDPSK = demodDPSK2;
|
case 4:
|
||||||
updateDemodulatorCons(2);
|
demodDPSK = demodDPSK4;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 8:
|
||||||
demodDPSK = demodDPSK4;
|
demodDPSK = demodDPSK8;
|
||||||
updateDemodulatorCons(4);
|
break;
|
||||||
break;
|
case 16:
|
||||||
case 8:
|
demodDPSK = demodDPSK16;
|
||||||
demodDPSK = demodDPSK8;
|
break;
|
||||||
updateDemodulatorCons(8);
|
case 32:
|
||||||
break;
|
demodDPSK = demodDPSK32;
|
||||||
case 16:
|
break;
|
||||||
demodDPSK = demodDPSK16;
|
case 64:
|
||||||
updateDemodulatorCons(16);
|
demodDPSK = demodDPSK64;
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 128:
|
||||||
demodDPSK = demodDPSK32;
|
demodDPSK = demodDPSK128;
|
||||||
updateDemodulatorCons(32);
|
break;
|
||||||
break;
|
case 256:
|
||||||
case 64:
|
demodDPSK = demodDPSK256;
|
||||||
demodDPSK = demodDPSK64;
|
break;
|
||||||
updateDemodulatorCons(64);
|
|
||||||
break;
|
|
||||||
case 128:
|
|
||||||
demodDPSK = demodDPSK128;
|
|
||||||
updateDemodulatorCons(128);
|
|
||||||
break;
|
|
||||||
case 256:
|
|
||||||
demodDPSK = demodDPSK256;
|
|
||||||
updateDemodulatorCons(256);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
demodDPSK = demodDPSK2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,20 @@ class ModemDPSK : public ModemDigital {
|
||||||
public:
|
public:
|
||||||
ModemDPSK();
|
ModemDPSK();
|
||||||
~ModemDPSK();
|
~ModemDPSK();
|
||||||
|
|
||||||
std::string getName();
|
std::string getName();
|
||||||
|
|
||||||
Modem *factory();
|
Modem *factory();
|
||||||
|
|
||||||
|
ModemArgInfoList getSettings();
|
||||||
|
void writeSetting(std::string setting, std::string value);
|
||||||
|
std::string readSetting(std::string setting);
|
||||||
|
|
||||||
void updateDemodulatorCons(int cons);
|
void updateDemodulatorCons(int cons);
|
||||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int cons;
|
||||||
modem demodDPSK;
|
modem demodDPSK;
|
||||||
modem demodDPSK2;
|
modem demodDPSK2;
|
||||||
modem demodDPSK4;
|
modem demodDPSK4;
|
||||||
|
|
|
@ -1,15 +1,37 @@
|
||||||
#include "ModemFSK.h"
|
#include "ModemFSK.h"
|
||||||
|
|
||||||
ModemFSK::ModemFSK() {
|
ModemFSK::ModemFSK() {
|
||||||
demodulatorCons.store(2);
|
bps = 9600;
|
||||||
currentDemodCons.store(0);
|
spacing = 7000;
|
||||||
updateDemodulatorCons(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Modem *ModemFSK::factory() {
|
Modem *ModemFSK::factory() {
|
||||||
return new ModemFSK;
|
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) {
|
ModemKit *ModemFSK::buildKit(long long sampleRate, int audioSampleRate) {
|
||||||
ModemKitFSK *dkit = new ModemKitFSK;
|
ModemKitFSK *dkit = new ModemKitFSK;
|
||||||
dkit->m = 1;
|
dkit->m = 1;
|
||||||
|
@ -38,10 +60,6 @@ ModemFSK::~ModemFSK() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModemFSK::updateDemodulatorCons(int cons) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModemFSK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
void ModemFSK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||||
ModemKitFSK *dkit = (ModemKitFSK *)kit;
|
ModemKitFSK *dkit = (ModemKitFSK *)kit;
|
||||||
|
|
||||||
|
|
|
@ -15,15 +15,21 @@ class ModemFSK : public ModemDigital {
|
||||||
public:
|
public:
|
||||||
ModemFSK();
|
ModemFSK();
|
||||||
~ModemFSK();
|
~ModemFSK();
|
||||||
|
|
||||||
std::string getName();
|
std::string getName();
|
||||||
|
|
||||||
Modem *factory();
|
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);
|
ModemKit *buildKit(long long sampleRate, int audioSampleRate);
|
||||||
void disposeKit(ModemKit *kit);
|
void disposeKit(ModemKit *kit);
|
||||||
void updateDemodulatorCons(int cons);
|
|
||||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
fskdem dem;
|
int bps, spacing;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,6 @@ std::string ModemOOK::getName() {
|
||||||
return "OOK";
|
return "OOK";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModemOOK::updateDemodulatorCons(int cons) {
|
|
||||||
if (currentDemodCons.load() != cons) {
|
|
||||||
currentDemodCons = cons;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModemOOK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
void ModemOOK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||||
ModemKitDigital *dkit = (ModemKitDigital *)kit;
|
ModemKitDigital *dkit = (ModemKitDigital *)kit;
|
||||||
digitalStart(dkit, demodOOK, input);
|
digitalStart(dkit, demodOOK, input);
|
||||||
|
|
|
@ -5,12 +5,13 @@ class ModemOOK : public ModemDigital {
|
||||||
public:
|
public:
|
||||||
ModemOOK();
|
ModemOOK();
|
||||||
~ModemOOK();
|
~ModemOOK();
|
||||||
|
|
||||||
std::string getName();
|
std::string getName();
|
||||||
|
|
||||||
Modem *factory();
|
Modem *factory();
|
||||||
void updateDemodulatorCons(int cons);
|
|
||||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
modem demodOOK;
|
modem demodOOK;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,9 +9,8 @@ ModemPSK::ModemPSK() {
|
||||||
demodPSK64 = modem_create(LIQUID_MODEM_PSK64);
|
demodPSK64 = modem_create(LIQUID_MODEM_PSK64);
|
||||||
demodPSK128 = modem_create(LIQUID_MODEM_PSK128);
|
demodPSK128 = modem_create(LIQUID_MODEM_PSK128);
|
||||||
demodPSK256 = modem_create(LIQUID_MODEM_PSK256);
|
demodPSK256 = modem_create(LIQUID_MODEM_PSK256);
|
||||||
demodulatorCons.store(2);
|
demodPSK = demodPSK2;
|
||||||
currentDemodCons.store(0);
|
cons = 2;
|
||||||
updateDemodulatorCons(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Modem *ModemPSK::factory() {
|
Modem *ModemPSK::factory() {
|
||||||
|
@ -33,47 +32,72 @@ ModemPSK::~ModemPSK() {
|
||||||
modem_destroy(demodPSK256);
|
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) {
|
void ModemPSK::updateDemodulatorCons(int cons) {
|
||||||
if (currentDemodCons.load() != cons) {
|
this->cons = cons;
|
||||||
currentDemodCons = cons;
|
switch (cons) {
|
||||||
|
case 2:
|
||||||
switch (demodulatorCons.load()) {
|
demodPSK = demodPSK2;
|
||||||
case 2:
|
break;
|
||||||
demodPSK = demodPSK2;
|
case 4:
|
||||||
updateDemodulatorCons(2);
|
demodPSK = demodPSK4;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 8:
|
||||||
demodPSK = demodPSK4;
|
demodPSK = demodPSK8;
|
||||||
updateDemodulatorCons(4);
|
break;
|
||||||
break;
|
case 16:
|
||||||
case 8:
|
demodPSK = demodPSK16;
|
||||||
demodPSK = demodPSK8;
|
break;
|
||||||
updateDemodulatorCons(8);
|
case 32:
|
||||||
break;
|
demodPSK = demodPSK32;
|
||||||
case 16:
|
break;
|
||||||
demodPSK = demodPSK16;
|
case 64:
|
||||||
updateDemodulatorCons(16);
|
demodPSK = demodPSK64;
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 128:
|
||||||
demodPSK = demodPSK32;
|
demodPSK = demodPSK128;
|
||||||
updateDemodulatorCons(32);
|
break;
|
||||||
break;
|
case 256:
|
||||||
case 64:
|
demodPSK = demodPSK256;
|
||||||
demodPSK = demodPSK64;
|
break;
|
||||||
updateDemodulatorCons(64);
|
|
||||||
break;
|
|
||||||
case 128:
|
|
||||||
demodPSK = demodPSK128;
|
|
||||||
updateDemodulatorCons(128);
|
|
||||||
break;
|
|
||||||
case 256:
|
|
||||||
demodPSK = demodPSK256;
|
|
||||||
updateDemodulatorCons(256);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
demodPSK = demodPSK2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,20 @@ class ModemPSK : public ModemDigital {
|
||||||
public:
|
public:
|
||||||
ModemPSK();
|
ModemPSK();
|
||||||
~ModemPSK();
|
~ModemPSK();
|
||||||
|
|
||||||
std::string getName();
|
std::string getName();
|
||||||
|
|
||||||
Modem *factory();
|
Modem *factory();
|
||||||
|
|
||||||
|
ModemArgInfoList getSettings();
|
||||||
|
void writeSetting(std::string setting, std::string value);
|
||||||
|
std::string readSetting(std::string setting);
|
||||||
|
|
||||||
void updateDemodulatorCons(int cons);
|
void updateDemodulatorCons(int cons);
|
||||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int cons;
|
||||||
modem demodPSK;
|
modem demodPSK;
|
||||||
modem demodPSK2;
|
modem demodPSK2;
|
||||||
modem demodPSK4;
|
modem demodPSK4;
|
||||||
|
|
|
@ -8,9 +8,8 @@ ModemQAM::ModemQAM() {
|
||||||
demodQAM64 = modem_create(LIQUID_MODEM_QAM64);
|
demodQAM64 = modem_create(LIQUID_MODEM_QAM64);
|
||||||
demodQAM128 = modem_create(LIQUID_MODEM_QAM128);
|
demodQAM128 = modem_create(LIQUID_MODEM_QAM128);
|
||||||
demodQAM256 = modem_create(LIQUID_MODEM_QAM256);
|
demodQAM256 = modem_create(LIQUID_MODEM_QAM256);
|
||||||
demodulatorCons.store(4);
|
demodQAM = demodQAM4;
|
||||||
currentDemodCons.store(0);
|
cons = 4;
|
||||||
updateDemodulatorCons(4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Modem *ModemQAM::factory() {
|
Modem *ModemQAM::factory() {
|
||||||
|
@ -31,47 +30,67 @@ ModemQAM::~ModemQAM() {
|
||||||
modem_destroy(demodQAM256);
|
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) {
|
void ModemQAM::updateDemodulatorCons(int cons) {
|
||||||
if (currentDemodCons.load() != cons) {
|
this->cons = cons;
|
||||||
currentDemodCons = cons;
|
switch (cons) {
|
||||||
|
case 4:
|
||||||
switch (demodulatorCons.load()) {
|
demodQAM = demodQAM4;
|
||||||
case 2:
|
break;
|
||||||
demodQAM = demodQAM4;
|
case 8:
|
||||||
updateDemodulatorCons(4);
|
demodQAM = demodQAM8;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 16:
|
||||||
demodQAM = demodQAM4;
|
demodQAM = demodQAM16;
|
||||||
updateDemodulatorCons(4);
|
break;
|
||||||
break;
|
case 32:
|
||||||
case 8:
|
demodQAM = demodQAM32;
|
||||||
demodQAM = demodQAM8;
|
break;
|
||||||
updateDemodulatorCons(8);
|
case 64:
|
||||||
break;
|
demodQAM = demodQAM64;
|
||||||
case 16:
|
break;
|
||||||
demodQAM = demodQAM16;
|
case 128:
|
||||||
updateDemodulatorCons(16);
|
demodQAM = demodQAM128;
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 256:
|
||||||
demodQAM = demodQAM32;
|
demodQAM = demodQAM256;
|
||||||
updateDemodulatorCons(32);
|
break;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,20 @@ class ModemQAM : public ModemDigital {
|
||||||
public:
|
public:
|
||||||
ModemQAM();
|
ModemQAM();
|
||||||
~ModemQAM();
|
~ModemQAM();
|
||||||
|
|
||||||
std::string getName();
|
std::string getName();
|
||||||
|
|
||||||
Modem *factory();
|
Modem *factory();
|
||||||
|
|
||||||
|
ModemArgInfoList getSettings();
|
||||||
|
void writeSetting(std::string setting, std::string value);
|
||||||
|
std::string readSetting(std::string setting);
|
||||||
|
|
||||||
void updateDemodulatorCons(int cons);
|
void updateDemodulatorCons(int cons);
|
||||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int cons;
|
||||||
modem demodQAM;
|
modem demodQAM;
|
||||||
modem demodQAM4;
|
modem demodQAM4;
|
||||||
modem demodQAM8;
|
modem demodQAM8;
|
||||||
|
|
|
@ -16,12 +16,6 @@ std::string ModemQPSK::getName() {
|
||||||
return "QPSK";
|
return "QPSK";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModemQPSK::updateDemodulatorCons(int cons) {
|
|
||||||
if (currentDemodCons.load() != cons) {
|
|
||||||
currentDemodCons = cons;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModemQPSK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
void ModemQPSK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||||
ModemKitDigital *dkit = (ModemKitDigital *)kit;
|
ModemKitDigital *dkit = (ModemKitDigital *)kit;
|
||||||
digitalStart(dkit, demodQPSK, input);
|
digitalStart(dkit, demodQPSK, input);
|
||||||
|
|
|
@ -5,9 +5,11 @@ class ModemQPSK : public ModemDigital {
|
||||||
public:
|
public:
|
||||||
ModemQPSK();
|
ModemQPSK();
|
||||||
~ModemQPSK();
|
~ModemQPSK();
|
||||||
|
|
||||||
std::string getName();
|
std::string getName();
|
||||||
|
|
||||||
Modem *factory();
|
Modem *factory();
|
||||||
void updateDemodulatorCons(int cons);
|
|
||||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
ModemSQAM::ModemSQAM() {
|
ModemSQAM::ModemSQAM() {
|
||||||
demodSQAM32 = modem_create(LIQUID_MODEM_SQAM32);
|
demodSQAM32 = modem_create(LIQUID_MODEM_SQAM32);
|
||||||
demodSQAM128 = modem_create(LIQUID_MODEM_SQAM128);
|
demodSQAM128 = modem_create(LIQUID_MODEM_SQAM128);
|
||||||
demodulatorCons.store(32);
|
demodSQAM = demodSQAM32;
|
||||||
currentDemodCons.store(0);
|
cons = 32;
|
||||||
updateDemodulatorCons(32);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Modem *ModemSQAM::factory() {
|
Modem *ModemSQAM::factory() {
|
||||||
|
@ -21,47 +20,47 @@ std::string ModemSQAM::getName() {
|
||||||
return "SQAM";
|
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) {
|
void ModemSQAM::updateDemodulatorCons(int cons) {
|
||||||
if (currentDemodCons.load() != cons) {
|
this->cons = cons;
|
||||||
currentDemodCons = cons;
|
switch (cons) {
|
||||||
|
case 32:
|
||||||
switch (demodulatorCons.load()) {
|
demodSQAM = demodSQAM32;
|
||||||
case 2:
|
break;
|
||||||
demodSQAM = demodSQAM32;
|
case 128:
|
||||||
updateDemodulatorCons(32);
|
demodSQAM = demodSQAM128;
|
||||||
break;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,20 @@ class ModemSQAM : public ModemDigital {
|
||||||
public:
|
public:
|
||||||
ModemSQAM();
|
ModemSQAM();
|
||||||
~ModemSQAM();
|
~ModemSQAM();
|
||||||
|
|
||||||
std::string getName();
|
std::string getName();
|
||||||
|
|
||||||
Modem *factory();
|
Modem *factory();
|
||||||
|
|
||||||
|
ModemArgInfoList getSettings();
|
||||||
|
void writeSetting(std::string setting, std::string value);
|
||||||
|
std::string readSetting(std::string setting);
|
||||||
|
|
||||||
void updateDemodulatorCons(int cons);
|
void updateDemodulatorCons(int cons);
|
||||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int cons;
|
||||||
modem demodSQAM;
|
modem demodSQAM;
|
||||||
modem demodSQAM32;
|
modem demodSQAM32;
|
||||||
modem demodSQAM128;
|
modem demodSQAM128;
|
||||||
|
|
|
@ -16,12 +16,6 @@ ModemST::~ModemST() {
|
||||||
modem_destroy(demodST);
|
modem_destroy(demodST);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModemST::updateDemodulatorCons(int cons) {
|
|
||||||
if (currentDemodCons.load() != cons) {
|
|
||||||
currentDemodCons = cons;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModemST::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
void ModemST::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||||
ModemKitDigital *dkit = (ModemKitDigital *)kit;
|
ModemKitDigital *dkit = (ModemKitDigital *)kit;
|
||||||
digitalStart(dkit, demodST, input);
|
digitalStart(dkit, demodST, input);
|
||||||
|
|
|
@ -5,9 +5,11 @@ class ModemST : public ModemDigital {
|
||||||
public:
|
public:
|
||||||
ModemST();
|
ModemST();
|
||||||
~ModemST();
|
~ModemST();
|
||||||
|
|
||||||
std::string getName();
|
std::string getName();
|
||||||
|
|
||||||
Modem *factory();
|
Modem *factory();
|
||||||
void updateDemodulatorCons(int cons);
|
|
||||||
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -230,9 +230,9 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGBA4f color, long
|
||||||
}
|
}
|
||||||
// advanced demodulators start here
|
// advanced demodulators start here
|
||||||
|
|
||||||
if (demod->getDemodulatorCons() > 0) {
|
// if (demod->getDemodulatorCons() > 0) {
|
||||||
demodStr = demodStr + std::to_string(demod->getDemodulatorCons());
|
// demodStr = demodStr + std::to_string(demod->getDemodulatorCons());
|
||||||
}
|
// }
|
||||||
|
|
||||||
// add lock to string if we have an lock
|
// add lock to string if we have an lock
|
||||||
if(demod->getDemodulatorLock()) {
|
if(demod->getDemodulatorLock()) {
|
||||||
|
|
Loading…
Reference in New Issue