mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-08 00:44:56 -04:00
Save/Load manually specified devices
This commit is contained in:
+4
-26
@@ -5,32 +5,10 @@
|
||||
|
||||
#include <SoapySDR/Types.hpp>
|
||||
|
||||
/*
|
||||
----------------------------------------------------
|
||||
-- Device identification
|
||||
----------------------------------------------------
|
||||
driver=rtl
|
||||
hardware=rtl
|
||||
|
||||
----------------------------------------------------
|
||||
-- Peripheral summary
|
||||
----------------------------------------------------
|
||||
Channels: 1 Rx, 0 Tx
|
||||
Timestamps: NO
|
||||
|
||||
----------------------------------------------------
|
||||
-- RX Channel 0
|
||||
----------------------------------------------------
|
||||
Full-duplex: YES
|
||||
Antennas: RX
|
||||
Full gain range: [0, 49.6] dB
|
||||
LNA gain range: [0, 49.6] dB
|
||||
Full freq range: [24, 1766] MHz
|
||||
RF freq range: [24, 1766] MHz
|
||||
CORR freq range: MHz
|
||||
Sample rates: [0.25, 2.56] MHz
|
||||
Filter bandwidths: [] MHz
|
||||
*/
|
||||
typedef struct _SDRManualDef {
|
||||
std::string factory;
|
||||
std::string params;
|
||||
} SDRManualDef;
|
||||
|
||||
class SDRDeviceRange {
|
||||
public:
|
||||
|
||||
@@ -176,7 +176,7 @@ std::vector<SDRDeviceInfo *> *SDREnumerator::enumerate_devices(std::string remot
|
||||
|
||||
std::string strDevArgs = "driver="+m_i->factory+","+m_i->params;
|
||||
|
||||
manualParams.push_back(strDevArgs);
|
||||
manualParams.push_back(m_i->params);
|
||||
|
||||
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, std::string("Enumerating manual device '") + strDevArgs + "'..");
|
||||
|
||||
@@ -406,6 +406,29 @@ void SDREnumerator::addManual(std::string factory, std::string params) {
|
||||
manuals.push_back(def);
|
||||
}
|
||||
|
||||
void SDREnumerator::removeManual(std::string factory, std::string params) {
|
||||
for (std::vector<SDRManualDef>::const_iterator i = manuals.begin(); i != manuals.end(); i++) {
|
||||
if (i->factory == factory && i->params == params) {
|
||||
manuals.erase(i);
|
||||
for (std::vector<SDRDeviceInfo *>::const_iterator subdevs_i = devs[""].begin(); subdevs_i != devs[""].end(); subdevs_i++) {
|
||||
if ((*subdevs_i)->isManual() && (*subdevs_i)->getDriver() == factory && (*subdevs_i)->getManualParams() == params) {
|
||||
devs[""].erase(subdevs_i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<SDRManualDef> &SDREnumerator::getManuals() {
|
||||
return SDREnumerator::manuals;
|
||||
}
|
||||
|
||||
void SDREnumerator::setManuals(std::vector<SDRManualDef> manuals) {
|
||||
SDREnumerator::manuals = manuals;
|
||||
}
|
||||
|
||||
bool SDREnumerator::hasRemoteModule() {
|
||||
return SDREnumerator::has_remote;
|
||||
}
|
||||
|
||||
@@ -12,11 +12,6 @@
|
||||
#include <SoapySDR/Registry.hpp>
|
||||
#include <SoapySDR/Device.hpp>
|
||||
|
||||
typedef struct _SDRManualDef {
|
||||
std::string factory;
|
||||
std::string params;
|
||||
} SDRManualDef;
|
||||
|
||||
|
||||
class SDREnumerator: public IOThread {
|
||||
private:
|
||||
@@ -36,7 +31,9 @@ public:
|
||||
static std::vector<std::string> &getRemotes();
|
||||
static bool hasRemoteModule();
|
||||
static void addManual(std::string factory, std::string params);
|
||||
// static void removeManual(std::string factory, std::string params);
|
||||
static void removeManual(std::string factory, std::string params);
|
||||
static std::vector<SDRManualDef> &getManuals();
|
||||
static void setManuals(std::vector<SDRManualDef> manuals);
|
||||
static void reset();
|
||||
static std::vector<std::string> &getFactories();
|
||||
|
||||
@@ -47,4 +44,5 @@ protected:
|
||||
static std::vector<std::string> remotes;
|
||||
static std::map< std::string, std::vector<SDRDeviceInfo *> > devs;
|
||||
static std::vector<SDRManualDef> manuals;
|
||||
static std::mutex devs_busy;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user