potential fix for #1361

pull/1385/head
AlexandreRouma 2024-04-08 16:37:03 +02:00
rodzic db1682a2ac
commit d12021fc2f
1 zmienionych plików z 23 dodań i 3 usunięć

Wyświetl plik

@ -81,8 +81,15 @@ public:
private:
void refresh() {
devList = SoapySDR::Device::enumerate();
txtDevList = "";
try {
devList = SoapySDR::Device::enumerate();
}
catch (const std::exception& e) {
flog::error("Could not list devices: {}", e.what());
return;
}
int i = 0;
for (auto& dev : devList) {
txtDevList += dev["label"] != "" ? dev["label"] : dev["driver"];
@ -153,7 +160,14 @@ private:
return;
}
SoapySDR::Device* dev = SoapySDR::Device::make(devArgs);
SoapySDR::Device* dev = NULL;
try {
dev = SoapySDR::Device::make(devArgs);
}
catch (const std::exception& e) {
flog::error("Could not open device: {}", e.what());
return;
}
antennaList = dev->listAntennas(SOAPY_SDR_RX, channelId);
txtAntennaList = "";
@ -307,7 +321,13 @@ private:
return;
}
_this->dev = SoapySDR::Device::make(_this->devArgs);
try {
_this->dev = SoapySDR::Device::make(_this->devArgs);
}
catch (const std::exception& e) {
flog::error("Failed to open device: {}", e.what());
return;
}
_this->dev->setSampleRate(SOAPY_SDR_RX, _this->channelId, _this->sampleRate);