mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-01 21:54:39 -04:00
Add OSX SoapySDR module bundling support.
This commit is contained in:
@@ -270,6 +270,16 @@ bool CubicSDR::OnCmdLineParsed(wxCmdLineParser& parser) {
|
||||
|
||||
config.load();
|
||||
|
||||
#ifdef BUNDLE_SOAPY_MODS
|
||||
if (parser.Found("l")) {
|
||||
useLocalMod.store(true);
|
||||
} else {
|
||||
useLocalMod.store(false);
|
||||
}
|
||||
#else
|
||||
useLocalMod.store(false);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -611,3 +621,6 @@ void CubicSDR::setDeviceArgs(SoapySDR::Kwargs settingArgs_in) {
|
||||
settingArgs = settingArgs_in;
|
||||
}
|
||||
|
||||
bool CubicSDR::getUseLocalMod() {
|
||||
return useLocalMod.load();
|
||||
}
|
||||
+13
-1
@@ -111,7 +111,8 @@ public:
|
||||
|
||||
void setStreamArgs(SoapySDR::Kwargs streamArgs_in);
|
||||
void setDeviceArgs(SoapySDR::Kwargs settingArgs_in);
|
||||
|
||||
|
||||
bool getUseLocalMod();
|
||||
private:
|
||||
AppFrame *appframe;
|
||||
AppConfig config;
|
||||
@@ -150,15 +151,26 @@ private:
|
||||
std::atomic_bool devicesReady;
|
||||
std::atomic_bool deviceSelectorOpen;
|
||||
std::atomic_bool sampleRateInitialized;
|
||||
std::atomic_bool useLocalMod;
|
||||
std::string notifyMessage;
|
||||
std::mutex notify_busy;
|
||||
};
|
||||
|
||||
#ifdef BUNDLE_SOAPY_MODS
|
||||
static const wxCmdLineEntryDesc commandLineInfo [] =
|
||||
{
|
||||
{ wxCMD_LINE_SWITCH, "h", "help", "Command line parameter help", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
|
||||
{ wxCMD_LINE_OPTION, "c", "config", "Specify a named configuration to use, i.e. '-c ham'" },
|
||||
{ wxCMD_LINE_SWITCH, "l", "localmod", "Check local SoapySDR modules instead of bundled first." },
|
||||
{ wxCMD_LINE_NONE }
|
||||
};
|
||||
#else
|
||||
static const wxCmdLineEntryDesc commandLineInfo [] =
|
||||
{
|
||||
{ wxCMD_LINE_SWITCH, "h", "help", "Command line parameter help", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
|
||||
{ wxCMD_LINE_OPTION, "c", "config", "Specify a named configuration to use, i.e. '-c ham'" },
|
||||
{ wxCMD_LINE_NONE }
|
||||
};
|
||||
#endif
|
||||
|
||||
DECLARE_APP(CubicSDR)
|
||||
|
||||
+32
-19
@@ -36,31 +36,44 @@ std::vector<SDRDeviceInfo *> *SDREnumerator::enumerate_devices(std::string remot
|
||||
std::cout << "\tAPI Version: v" << SoapySDR::getAPIVersion() << std::endl;
|
||||
std::cout << "\tABI Version: v" << SoapySDR::getABIVersion() << std::endl;
|
||||
std::cout << "\tInstall root: " << SoapySDR::getRootPath() << std::endl;
|
||||
|
||||
modules = SoapySDR::listModules();
|
||||
for (size_t i = 0; i < modules.size(); i++) {
|
||||
std::cout << "\tModule found: " << modules[i] << std::endl;
|
||||
}
|
||||
if (modules.empty()) {
|
||||
std::cout << "No modules found!" << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "\tLoading modules... " << std::flush;
|
||||
std::cout << "\tLoading modules... " << std::endl;
|
||||
#ifdef BUNDLE_SOAPY_MODS
|
||||
wxFileName exePath = wxFileName(wxStandardPaths::Get().GetExecutablePath());
|
||||
std::vector<std::string> localMods = SoapySDR::listModules(exePath.GetPath().ToStdString() + "/modules/");
|
||||
for (std::vector<std::string>::iterator mods_i = localMods.begin(); mods_i != localMods.end(); mods_i++) {
|
||||
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, "Initializing bundled SoapySDR module " + (*mods_i) + "..");
|
||||
SoapySDR::loadModule(*mods_i);
|
||||
}
|
||||
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, "Loading SoapySDR modules..");
|
||||
bool localModPref = wxGetApp().getUseLocalMod();
|
||||
if (localModPref) {
|
||||
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, "Loading SoapySDR modules..");
|
||||
std::cout << "Checking local system SoapySDR modules.." << std::flush;
|
||||
SoapySDR::loadModules();
|
||||
}
|
||||
|
||||
SoapySDR::loadModules();
|
||||
wxFileName exePath = wxFileName(wxStandardPaths::Get().GetExecutablePath());
|
||||
std::vector<std::string> localMods = SoapySDR::listModules(exePath.GetPath().ToStdString() + "/modules/");
|
||||
for (std::vector<std::string>::iterator mods_i = localMods.begin(); mods_i != localMods.end(); mods_i++) {
|
||||
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, "Initializing bundled SoapySDR module " + (*mods_i) + "..");
|
||||
std::cout << "Loading bundled SoapySDR module " << (*mods_i) << ".." << std::endl;
|
||||
SoapySDR::loadModule(*mods_i);
|
||||
}
|
||||
|
||||
if (!localModPref) {
|
||||
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, "Loading SoapySDR modules..");
|
||||
std::cout << "Checking system SoapySDR modules.." << std::flush;
|
||||
SoapySDR::loadModules();
|
||||
}
|
||||
#else
|
||||
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, "Loading SoapySDR modules..");
|
||||
SoapySDR::loadModules();
|
||||
#endif
|
||||
std::cout << "done" << std::endl;
|
||||
|
||||
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, "done.");
|
||||
std::cout << "done." << std::endl;
|
||||
|
||||
// modules = SoapySDR::listModules();
|
||||
// for (size_t i = 0; i < modules.size(); i++) {
|
||||
// std::cout << "\tModule found: " << modules[i] << std::endl;
|
||||
// }
|
||||
// if (modules.empty()) {
|
||||
// std::cout << "No modules found!" << std::endl;
|
||||
// }
|
||||
|
||||
if (SDREnumerator::factories.size()) {
|
||||
SDREnumerator::factories.erase(SDREnumerator::factories.begin(), SDREnumerator::factories.end());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user