mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-02-03 09:44:26 -05:00
Allow user-specified SoapySDR module path
This commit is contained in:
parent
8f18c316de
commit
df4270a760
@ -768,6 +768,8 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
|
||||
}
|
||||
|
||||
void AppFrame::OnClose(wxCloseEvent& event) {
|
||||
wxGetApp().closeDeviceSelector();
|
||||
|
||||
wxGetApp().getDemodSpectrumProcessor()->removeOutput(demodSpectrumCanvas->getVisualDataQueue());
|
||||
wxGetApp().getDemodSpectrumProcessor()->removeOutput(demodWaterfallCanvas->getVisualDataQueue());
|
||||
wxGetApp().getSpectrumProcessor()->removeOutput(spectrumCanvas->getVisualDataQueue());
|
||||
|
@ -279,10 +279,26 @@ bool CubicSDR::OnCmdLineParsed(wxCmdLineParser& parser) {
|
||||
#else
|
||||
useLocalMod.store(true);
|
||||
#endif
|
||||
|
||||
wxString *modPath = new wxString;
|
||||
|
||||
if (parser.Found("m",modPath)) {
|
||||
if (modPath) {
|
||||
modulePath = modPath->ToStdString();
|
||||
} else {
|
||||
modulePath = "";
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CubicSDR::closeDeviceSelector() {
|
||||
if (deviceSelectorOpen) {
|
||||
deviceSelectorDialog->Close();
|
||||
}
|
||||
}
|
||||
|
||||
void CubicSDR::deviceSelector() {
|
||||
if (deviceSelectorOpen) {
|
||||
deviceSelectorDialog->Raise();
|
||||
@ -623,4 +639,8 @@ void CubicSDR::setDeviceArgs(SoapySDR::Kwargs settingArgs_in) {
|
||||
|
||||
bool CubicSDR::getUseLocalMod() {
|
||||
return useLocalMod.load();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CubicSDR::getModulePath() {
|
||||
return modulePath;
|
||||
}
|
||||
|
@ -102,6 +102,8 @@ public:
|
||||
|
||||
void setDeviceSelectorClosed();
|
||||
bool isDeviceSelectorOpen();
|
||||
void closeDeviceSelector();
|
||||
|
||||
|
||||
void setAGCMode(bool mode);
|
||||
bool getAGCMode();
|
||||
@ -113,6 +115,8 @@ public:
|
||||
void setDeviceArgs(SoapySDR::Kwargs settingArgs_in);
|
||||
|
||||
bool getUseLocalMod();
|
||||
std::string getModulePath();
|
||||
|
||||
private:
|
||||
AppFrame *appframe;
|
||||
AppConfig config;
|
||||
@ -153,6 +157,7 @@ private:
|
||||
std::atomic_bool sampleRateInitialized;
|
||||
std::atomic_bool useLocalMod;
|
||||
std::string notifyMessage;
|
||||
std::string modulePath;
|
||||
std::mutex notify_busy;
|
||||
};
|
||||
|
||||
@ -161,6 +166,7 @@ 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_OPTION, "m", "modpath", "Load modules from suppplied path, i.e. '-m ~/SoapyMods/'" },
|
||||
{ wxCMD_LINE_SWITCH, "b", "bundled", "Use bundled SoapySDR modules first instead of local." },
|
||||
{ wxCMD_LINE_NONE }
|
||||
};
|
||||
@ -169,6 +175,7 @@ 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_OPTION, "m", "modpath", "Load modules from suppplied path, i.e. '-m ~/SoapyMods/'" },
|
||||
{ wxCMD_LINE_NONE }
|
||||
};
|
||||
#endif
|
||||
|
@ -38,32 +38,45 @@ std::vector<SDRDeviceInfo *> *SDREnumerator::enumerate_devices(std::string remot
|
||||
std::cout << "\tInstall root: " << SoapySDR::getRootPath() << std::endl;
|
||||
|
||||
std::cout << "\tLoading modules... " << std::endl;
|
||||
#ifdef BUNDLE_SOAPY_MODS
|
||||
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();
|
||||
}
|
||||
|
||||
std::string userModPath = wxGetApp().getModulePath();
|
||||
|
||||
if (userModPath != "") {
|
||||
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, "Loading SoapySDR modules from " + userModPath + "..");
|
||||
std::vector<std::string> localMods = SoapySDR::listModules(userModPath);
|
||||
for (std::vector<std::string>::iterator mods_i = localMods.begin(); mods_i != localMods.end(); mods_i++) {
|
||||
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, "Initializing user specified SoapySDR module " + (*mods_i) + "..");
|
||||
std::cout << "Initializing user specified SoapySDR module " << (*mods_i) << ".." << std::endl;
|
||||
SoapySDR::loadModule(*mods_i);
|
||||
}
|
||||
} else {
|
||||
#ifdef BUNDLE_SOAPY_MODS
|
||||
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();
|
||||
}
|
||||
|
||||
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) {
|
||||
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..");
|
||||
std::cout << "Checking system SoapySDR modules.." << std::flush;
|
||||
SoapySDR::loadModules();
|
||||
}
|
||||
#else
|
||||
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, "Loading SoapySDR modules..");
|
||||
SoapySDR::loadModules();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
// modules = SoapySDR::listModules();
|
||||
// for (size_t i = 0; i < modules.size(); i++) {
|
||||
// std::cout << "\tModule found: " << modules[i] << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user