mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-27 22:14:26 -04:00
Save/Load manually specified devices
This commit is contained in:
@@ -303,6 +303,14 @@ float AppConfig::getSpectrumAvgSpeed() {
|
||||
return spectrumAvgSpeed.load();
|
||||
}
|
||||
|
||||
void AppConfig::setManualDevices(std::vector<SDRManualDef> manuals) {
|
||||
manualDevices = manuals;
|
||||
}
|
||||
|
||||
std::vector<SDRManualDef> AppConfig::getManualDevices() {
|
||||
return manualDevices;
|
||||
}
|
||||
|
||||
void AppConfig::setConfigName(std::string configName) {
|
||||
this->configName = configName;
|
||||
}
|
||||
@@ -354,6 +362,15 @@ bool AppConfig::save() {
|
||||
device_config_i->second->save(device_node);
|
||||
}
|
||||
|
||||
if (manualDevices.size()) {
|
||||
DataNode *manual_node = cfg.rootNode()->newChild("manual_devices");
|
||||
for (std::vector<SDRManualDef>::const_iterator i = manualDevices.begin(); i != manualDevices.end(); i++) {
|
||||
DataNode *rig_node = manual_node->newChild("device");
|
||||
*rig_node->newChild("factory") = i->factory;
|
||||
*rig_node->newChild("params") = i->params;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_HAMLIB
|
||||
DataNode *rig_node = cfg.rootNode()->newChild("rig");
|
||||
*rig_node->newChild("model") = rigModel.load();
|
||||
@@ -474,6 +491,22 @@ bool AppConfig::load() {
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.rootNode()->hasAnother("manual_devices")) {
|
||||
DataNode *manuals_node = cfg.rootNode()->getNext("manual_devices");
|
||||
|
||||
while (manuals_node->hasAnother("device")) {
|
||||
DataNode *manual_node = manuals_node->getNext("device");
|
||||
if (manual_node->hasAnother("factory") && manual_node->hasAnother("params")) {
|
||||
SDRManualDef mdef;
|
||||
|
||||
mdef.factory = manual_node->getNext("factory")->element()->toString();
|
||||
mdef.params = manual_node->getNext("params")->element()->toString();
|
||||
|
||||
manualDevices.push_back(mdef);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_HAMLIB
|
||||
if (cfg.rootNode()->hasAnother("rig")) {
|
||||
DataNode *rig_node = cfg.rootNode()->getNext("rig");
|
||||
|
||||
Reference in New Issue
Block a user