Don't touch not-found device configs

This commit is contained in:
Charles J. Cliffe 2016-01-20 01:15:12 -05:00
parent b1ac17729e
commit 419705419c
3 changed files with 17 additions and 7 deletions

View File

@ -467,8 +467,7 @@ bool AppConfig::load() {
while (devices_node->hasAnother("device")) {
DataNode *device_node = devices_node->getNext("device");
if (device_node->hasAnother("id")) {
std::string deviceId;
device_node->getNext("id")->element()->get(deviceId);
std::string deviceId = device_node->getNext("id")->element()->toString();
getDevice(deviceId)->load(device_node);
}

View File

@ -296,12 +296,21 @@ void SDRDevicesDialog::OnDeviceTimer( wxTimerEvent& event ) {
devs[""] = SDREnumerator::enumerate_devices("",true);
if (devs[""] != NULL) {
for (devs_i = devs[""]->begin(); devs_i != devs[""]->end(); devs_i++) {
DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice((*devs_i)->getDeviceId());
DeviceConfig *devConfig = nullptr;
if ((*devs_i)->isManual()) {
devItems[devTree->AppendItem(manualBranch, devConfig->getDeviceName())] = (*devs_i);
std::string devName = "Unknown";
if ((*devs_i)->isAvailable()) {
devConfig = wxGetApp().getConfig()->getDevice((*devs_i)->getDeviceId());
devName = devConfig->getDeviceName();
} else {
devName = (*devs_i)->getDeviceId();
}
devItems[devTree->AppendItem(manualBranch, devName)] = (*devs_i);
} else if ((*devs_i)->isRemote()) {
devConfig = wxGetApp().getConfig()->getDevice((*devs_i)->getDeviceId());
devItems[devTree->AppendItem(dsBranch, devConfig->getDeviceName())] = (*devs_i);
} else {
devConfig = wxGetApp().getConfig()->getDevice((*devs_i)->getDeviceId());
devItems[devTree->AppendItem(localBranch, devConfig->getDeviceName())] = (*devs_i);
}
}

View File

@ -189,7 +189,8 @@ std::vector<SDRDeviceInfo *> *SDREnumerator::enumerate_devices(std::string remot
}
} else {
SoapySDR::Kwargs failedEnum;
failedEnum = argsStrToKwargs(strDevArgs+",label=Not Found ("+m_i->factory+")");
failedEnum = argsStrToKwargs(strDevArgs);
failedEnum["label"] = "Not Found ("+m_i->factory+")";
results.push_back(failedEnum);
manualResult.push_back(false);
}
@ -228,7 +229,6 @@ std::vector<SDRDeviceInfo *> *SDREnumerator::enumerate_devices(std::string remot
std::cout << "Make device " << i << std::endl;
if (i<manualsIdx || manualResult[i-manualsIdx]) try {
DeviceConfig *cfg = wxGetApp().getConfig()->getDevice(dev->getDeviceId());
SoapySDR::Device *device = SoapySDR::Device::make(deviceArgs);
SoapySDR::Kwargs info = device->getHardwareInfo();
for (SoapySDR::Kwargs::const_iterator it = info.begin(); it != info.end(); ++it) {
@ -246,6 +246,8 @@ std::vector<SDRDeviceInfo *> *SDREnumerator::enumerate_devices(std::string remot
SoapySDR::ArgInfoList settingsInfo = device->getSettingInfo();
DeviceConfig *cfg = wxGetApp().getConfig()->getDevice(dev->getDeviceId());
ConfigSettings devSettings = cfg->getSettings();
if (devSettings.size()) {
for (ConfigSettings::const_iterator set_i = devSettings.begin(); set_i != devSettings.end(); set_i++) {