diff --git a/CMakeLists.txt b/CMakeLists.txt index c8a3399..282b890 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -425,6 +425,10 @@ IF (APPLE AND BUNDLE_APP) PROJECT(CubicSDR) SET(MACOSX_BUNDLE_BUNDLE_NAME CubicSDR) + set(BUNDLE_SOAPY_MODS OFF CACHE BOOL "Bundle local SoapySDR modules") + + + ADD_DEFINITIONS( -std=c++0x -pthread @@ -491,6 +495,18 @@ IF (APPLE AND BUNDLE_APP) VERIFY_APP(\"${APPS}\") " COMPONENT Runtime) + # IF (BUNDLE_SOAPY_MODS) + # install( DIRECTORY "${SOAPY_SDR_ROOT}/lib/modules" + # DESTINATION ${APPS}/modules + # COMPONENT Runtime + # FILES_MATCHING + # PATTERN "*.dylib" + # PATTERN "*_debug.dylib" EXCLUDE + # ) + # ENDIF(BUNDLE_SOAPY_MODS) + + + INSTALL(TARGETS CubicSDR BUNDLE DESTINATION . COMPONENT Runtime ) diff --git a/src/AppConfig.cpp b/src/AppConfig.cpp index f1a716d..4d2a360 100644 --- a/src/AppConfig.cpp +++ b/src/AppConfig.cpp @@ -2,9 +2,7 @@ #include "CubicSDR.h" DeviceConfig::DeviceConfig() : deviceId("") { - iqSwap.store(0); ppm.store(0); - directSampling.store(false); offset.store(0); } @@ -20,14 +18,6 @@ int DeviceConfig::getPPM() { return ppm.load(); } -void DeviceConfig::setDirectSampling(int mode) { - directSampling.store(mode); -} - -int DeviceConfig::getDirectSampling() { - return directSampling.load(); -} - void DeviceConfig::setOffset(long long offset) { this->offset.store(offset); } @@ -36,14 +26,6 @@ long long DeviceConfig::getOffset() { return offset.load(); } -void DeviceConfig::setIQSwap(bool iqSwap) { - this->iqSwap.store(iqSwap); -} - -bool DeviceConfig::getIQSwap() { - return iqSwap.load(); -} - void DeviceConfig::setDeviceId(std::string deviceId) { busy_lock.lock(); this->deviceId = deviceId; @@ -64,8 +46,6 @@ void DeviceConfig::save(DataNode *node) { busy_lock.lock(); *node->newChild("id") = deviceId; *node->newChild("ppm") = (int)ppm; - *node->newChild("iq_swap") = iqSwap; - *node->newChild("direct_sampling") = directSampling; *node->newChild("offset") = offset; busy_lock.unlock(); } @@ -79,32 +59,6 @@ void DeviceConfig::load(DataNode *node) { setPPM(ppmValue); std::cout << "Loaded PPM for device '" << deviceId << "' at " << ppmValue << "ppm" << std::endl; } - if (node->hasAnother("iq_swap")) { - DataNode *iq_swap_node = node->getNext("iq_swap"); - int iqSwapValue = 0; - iq_swap_node->element()->get(iqSwapValue); - setIQSwap(iqSwapValue?true:false); - std::cout << "Loaded I/Q Swap for device '" << deviceId << "' as " << (iqSwapValue?"swapped":"not swapped") << std::endl; - } - if (node->hasAnother("direct_sampling")) { - DataNode *direct_sampling_node = node->getNext("direct_sampling"); - int directSamplingValue = 0; - direct_sampling_node->element()->get(directSamplingValue); - setDirectSampling(directSamplingValue); - std::cout << "Loaded Direct Sampling Mode for device '" << deviceId << "': "; - switch (directSamplingValue) { - case 0: - std::cout << "off" << std::endl; - break; - case 1: - std::cout << "I-ADC" << std::endl; - break; - case 2: - std::cout << "Q-ADC" << std::endl; - break; - - } - } if (node->hasAnother("offset")) { DataNode *offset_node = node->getNext("offset"); long long offsetValue = 0; diff --git a/src/AppConfig.h b/src/AppConfig.h index 60de0c7..a7daebb 100644 --- a/src/AppConfig.h +++ b/src/AppConfig.h @@ -17,15 +17,9 @@ public: void setPPM(int ppm); int getPPM(); - void setDirectSampling(int mode); - int getDirectSampling(); - void setOffset(long long offset); long long getOffset(); - void setIQSwap(bool iqSwap); - bool getIQSwap(); - void setDeviceId(std::string deviceId); std::string getDeviceId(); @@ -36,8 +30,7 @@ private: std::string deviceId; std::mutex busy_lock; - std::atomic_int ppm, directSampling; - std::atomic_bool iqSwap; + std::atomic_int ppm; std::atomic_llong offset; }; diff --git a/src/AppFrame.cpp b/src/AppFrame.cpp index ad5f82a..80aebb0 100644 --- a/src/AppFrame.cpp +++ b/src/AppFrame.cpp @@ -258,16 +258,7 @@ AppFrame::AppFrame() : menu->Append(wxID_SET_FREQ_OFFSET, "Frequency Offset"); menu->Append(wxID_SET_PPM, "Device PPM"); - iqSwapMenuItem = menu->AppendCheckItem(wxID_SET_SWAP_IQ, "Swap I/Q"); - wxMenu *dsMenu = new wxMenu; - - directSamplingMenuItems[0] = dsMenu->AppendRadioItem(wxID_SET_DS_OFF, "Off"); - directSamplingMenuItems[1] = dsMenu->AppendRadioItem(wxID_SET_DS_I, "I-ADC"); - directSamplingMenuItems[2] = dsMenu->AppendRadioItem(wxID_SET_DS_Q, "Q-ADC"); - - menu->AppendSubMenu(dsMenu, "Direct Sampling"); - agcMenuItem = menu->AppendCheckItem(wxID_AGC_CONTROL, "Automatic Gain"); agcMenuItem->Check(wxGetApp().getAGCMode()); @@ -434,16 +425,6 @@ void AppFrame::initDeviceParams(SDRDeviceInfo *devInfo) { DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice(deviceId); - int dsMode = devConfig->getDirectSampling(); - - if (dsMode > 0 && dsMode <= 2) { - directSamplingMenuItems[devConfig->getDirectSampling()]->Check(); - } - - if (devConfig->getIQSwap()) { - iqSwapMenuItem->Check(); - } - // Build sample rate menu from device info sampleRates = devInfo->getRxChannel()->getSampleRates(); @@ -503,19 +484,19 @@ void AppFrame::OnMenu(wxCommandEvent& event) { wxGetApp().saveConfig(); } } else if (event.GetId() == wxID_SET_DS_OFF) { - wxGetApp().setDirectSampling(0); - wxGetApp().saveConfig(); +// wxGetApp().setDirectSampling(0); +// wxGetApp().saveConfig(); } else if (event.GetId() == wxID_SET_DS_I) { - wxGetApp().setDirectSampling(1); - wxGetApp().saveConfig(); +// wxGetApp().setDirectSampling(1); +// wxGetApp().saveConfig(); } else if (event.GetId() == wxID_SET_DS_Q) { - wxGetApp().setDirectSampling(2); - wxGetApp().saveConfig(); +// wxGetApp().setDirectSampling(2); +// wxGetApp().saveConfig(); } else if (event.GetId() == wxID_SET_SWAP_IQ) { - bool swap_state = !wxGetApp().getSwapIQ(); - wxGetApp().setSwapIQ(swap_state); - wxGetApp().saveConfig(); - iqSwapMenuItem->Check(swap_state); +// bool swap_state = !wxGetApp().getSwapIQ(); +// wxGetApp().setSwapIQ(swap_state); +// wxGetApp().saveConfig(); +// iqSwapMenuItem->Check(swap_state); } else if (event.GetId() == wxID_AGC_CONTROL) { if (wxGetApp().getDevice() == NULL) { agcMenuItem->Check(); diff --git a/src/AppFrame.h b/src/AppFrame.h index 28e5589..164cde9 100644 --- a/src/AppFrame.h +++ b/src/AppFrame.h @@ -100,7 +100,7 @@ private: std::map sampleRateMenuItems; std::map audioSampleRateMenuItems; std::map directSamplingMenuItems; - wxMenuItem *iqSwapMenuItem; +// wxMenuItem *iqSwapMenuItem; wxMenu *sampleRateMenu; wxMenuItem *agcMenuItem; std::vector sampleRates; diff --git a/src/CubicSDR.cpp b/src/CubicSDR.cpp index b7d471e..c93f45e 100644 --- a/src/CubicSDR.cpp +++ b/src/CubicSDR.cpp @@ -112,7 +112,7 @@ long long strToFrequency(std::string freqStr) { } -CubicSDR::CubicSDR() : appframe(NULL), m_glContext(NULL), frequency(0), offset(0), ppm(0), snap(1), sampleRate(DEFAULT_SAMPLE_RATE), directSamplingMode(0), +CubicSDR::CubicSDR() : appframe(NULL), m_glContext(NULL), frequency(0), offset(0), ppm(0), snap(1), sampleRate(DEFAULT_SAMPLE_RATE), sdrThread(NULL), sdrPostThread(NULL), spectrumVisualThread(NULL), demodVisualThread(NULL), pipeSDRIQData(NULL), pipeIQVisualData(NULL), pipeAudioVisualData(NULL), t_SDR(NULL), t_PostSDR(NULL) { sampleRateInitialized.store(false); agcMode.store(true); @@ -141,7 +141,6 @@ bool CubicSDR::OnInit() { frequency = wxGetApp().getConfig()->getCenterFreq(); offset = 0; ppm = 0; - directSamplingMode = 0; devicesReady.store(false); deviceSelectorOpen.store(false); @@ -351,28 +350,6 @@ void CubicSDR::setOffset(long long ofs) { config.getDevice(dev->getDeviceId())->setOffset(ofs); } -void CubicSDR::setDirectSampling(int mode) { - directSamplingMode = mode; - sdrThread->setDirectSampling(mode); - - SDRDeviceInfo *dev = getDevice(); - config.getDevice(dev->getDeviceId())->setDirectSampling(mode); -} - -int CubicSDR::getDirectSampling() { - return directSamplingMode; -} - -void CubicSDR::setSwapIQ(bool swapIQ) { - sdrThread->setIQSwap(swapIQ); - SDRDeviceInfo *dev = getDevice(); - config.getDevice(dev->getDeviceId())->setIQSwap(swapIQ); -} - -bool CubicSDR::getSwapIQ() { - return sdrThread->getIQSwap(); -} - long long CubicSDR::getFrequency() { return frequency; } @@ -441,8 +418,6 @@ void CubicSDR::setDevice(SDRDeviceInfo *dev) { setSampleRate(sampleRate); setPPM(devConfig->getPPM()); - setDirectSampling(devConfig->getDirectSampling()); - setSwapIQ(devConfig->getIQSwap()); setOffset(devConfig->getOffset()); t_SDR = new std::thread(&SDRThread::threadMain, sdrThread); diff --git a/src/CubicSDR.h b/src/CubicSDR.h index bbacf87..598b767 100644 --- a/src/CubicSDR.h +++ b/src/CubicSDR.h @@ -58,12 +58,6 @@ public: void setOffset(long long ofs); long long getOffset(); - void setDirectSampling(int mode); - int getDirectSampling(); - - void setSwapIQ(bool swapIQ); - bool getSwapIQ(); - void setSampleRate(long long rate_in); long long getSampleRate(); @@ -126,7 +120,6 @@ private: long long offset; int ppm, snap; long long sampleRate; - int directSamplingMode; std::atomic_bool agcMode; SDRThread *sdrThread; diff --git a/src/forms/SDRDevices/SDRDevices.cpp b/src/forms/SDRDevices/SDRDevices.cpp index 7eed3fe..25501c6 100644 --- a/src/forms/SDRDevices/SDRDevices.cpp +++ b/src/forms/SDRDevices/SDRDevices.cpp @@ -10,6 +10,30 @@ SDRDevicesDialog::SDRDevicesDialog( wxWindow* parent ): devFrame( parent ) { m_addRemoteButton->Disable(); m_useSelectedButton->Disable(); m_deviceTimer.Start(250); + + + // Add int property + m_propertyGrid->Append( new wxIntProperty("IntProperty", wxPG_LABEL, 12345678) ); + // Add float property (value type is actually double) + m_propertyGrid->Append( new wxFloatProperty("FloatProperty", wxPG_LABEL, 12345.678) ); + // Add a bool property + m_propertyGrid->Append( new wxBoolProperty("BoolProperty", wxPG_LABEL, false) ); + // A string property that can be edited in a separate editor dialog. + m_propertyGrid->Append( new wxLongStringProperty("LongStringProperty", + wxPG_LABEL, + "This is much longer string than the " + "first one. Edit it by clicking the button.")); + // String editor with dir selector button. + m_propertyGrid->Append( new wxDirProperty("DirProperty", wxPG_LABEL, ::wxGetUserHome()) ); + // wxArrayStringProperty embeds a wxArrayString. + m_propertyGrid->Append( new wxArrayStringProperty("Label of ArrayStringProperty", + "NameOfArrayStringProp")); + // A file selector property. + m_propertyGrid->Append( new wxFileProperty("FileProperty", wxPG_LABEL, wxEmptyString) ); + // Extra: set wild card for file property (format same as in wxFileDialog). + m_propertyGrid->SetPropertyAttribute( "FileProperty", + wxPG_FILE_WILDCARD, + "All files (*.*)|*.*" ); } void SDRDevicesDialog::OnClose( wxCloseEvent& event ) { diff --git a/src/forms/SDRDevices/SDRDevices.fbp b/src/forms/SDRDevices/SDRDevices.fbp index 362fade..1bd7999 100644 --- a/src/forms/SDRDevices/SDRDevices.fbp +++ b/src/forms/SDRDevices/SDRDevices.fbp @@ -44,7 +44,7 @@ devFrame - 392,467 + 700,467 wxDEFAULT_FRAME_STYLE CubicSDR :: SDR Devices @@ -490,11 +490,11 @@ bSizer5 wxHORIZONTAL none - + 5 wxALL 1 - + 1 1 1 @@ -578,11 +578,11 @@ - + 5 wxALL|wxALIGN_CENTER_VERTICAL 1 - + 1 1 1 @@ -674,9 +674,9 @@ 5 - wxEXPAND + wxEXPAND | wxALL 1 - + 1 1 1 @@ -687,7 +687,6 @@ - 1 0 @@ -700,10 +699,10 @@ Left 1 - 0 + 1 0 - 1 + 0 wxID_ANY 0 @@ -712,7 +711,7 @@ 0 1 - devTabs + m_panel61 1 @@ -722,13 +721,12 @@ Resizable 1 - 0 - + wxTAB_TRAVERSAL @@ -745,8 +743,6 @@ - - @@ -754,385 +750,178 @@ - - - Device - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 0 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - devInfoPanel - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - + + + bSizer7 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Stream Options + + 0 + + + 0 - devInfoSizer - wxVERTICAL - none - - 5 - wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_DevInfoList - 1 - - - protected - 1 - - Resizable - 1 - - wxLC_ICON - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 1 + m_staticText1 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + - - - - Parameters - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - devParamsPanel - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + + 1 + + 0 + 0 + wxID_ANY + 1 + + 0 + + + 0 - devParamsSizer - wxVERTICAL - none - - 5 - wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_ParamInfoList - 1 - - - protected - 1 - - Resizable - 1 - - wxLC_ICON - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 1 + m_propertyGrid + 1 + + + protected + 1 + + Resizable + 1 + + wxPG_DEFAULT_STYLE + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/forms/SDRDevices/SDRDevicesForm.cpp b/src/forms/SDRDevices/SDRDevicesForm.cpp index 3e1a813..ba012c9 100644 --- a/src/forms/SDRDevices/SDRDevicesForm.cpp +++ b/src/forms/SDRDevices/SDRDevicesForm.cpp @@ -52,35 +52,22 @@ devFrame::devFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons bSizer6->Fit( m_panel6 ); bSizer4->Add( m_panel6, 1, wxEXPAND | wxALL, 5 ); - devTabs = new wxNotebook( m_panel3, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - devTabs->Hide(); + m_panel61 = new wxPanel( m_panel3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer7; + bSizer7 = new wxBoxSizer( wxVERTICAL ); - devInfoPanel = new wxPanel( devTabs, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* devInfoSizer; - devInfoSizer = new wxBoxSizer( wxVERTICAL ); + m_staticText1 = new wxStaticText( m_panel61, wxID_ANY, wxT("Stream Options"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText1->Wrap( -1 ); + bSizer7->Add( m_staticText1, 0, wxALL, 5 ); - m_DevInfoList = new wxListCtrl( devInfoPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ICON ); - devInfoSizer->Add( m_DevInfoList, 1, wxEXPAND, 5 ); + m_propertyGrid = new wxPropertyGrid(m_panel61, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxPG_DEFAULT_STYLE); + bSizer7->Add( m_propertyGrid, 1, wxALL|wxEXPAND, 5 ); - devInfoPanel->SetSizer( devInfoSizer ); - devInfoPanel->Layout(); - devInfoSizer->Fit( devInfoPanel ); - devTabs->AddPage( devInfoPanel, wxT("Device"), false ); - devParamsPanel = new wxPanel( devTabs, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* devParamsSizer; - devParamsSizer = new wxBoxSizer( wxVERTICAL ); - - m_ParamInfoList = new wxListCtrl( devParamsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ICON ); - devParamsSizer->Add( m_ParamInfoList, 1, wxEXPAND, 5 ); - - - devParamsPanel->SetSizer( devParamsSizer ); - devParamsPanel->Layout(); - devParamsSizer->Fit( devParamsPanel ); - devTabs->AddPage( devParamsPanel, wxT("Parameters"), false ); - - bSizer4->Add( devTabs, 1, wxEXPAND, 5 ); + m_panel61->SetSizer( bSizer7 ); + m_panel61->Layout(); + bSizer7->Fit( m_panel61 ); + bSizer4->Add( m_panel61, 1, wxEXPAND | wxALL, 5 ); m_panel3->SetSizer( bSizer4 ); diff --git a/src/forms/SDRDevices/SDRDevicesForm.h b/src/forms/SDRDevices/SDRDevicesForm.h index 2857d5c..efaa3e1 100644 --- a/src/forms/SDRDevices/SDRDevicesForm.h +++ b/src/forms/SDRDevices/SDRDevicesForm.h @@ -20,11 +20,12 @@ #include #include #include -#include +#include #include #include #include -#include +#include +#include #include #include @@ -46,11 +47,9 @@ class devFrame : public wxFrame wxPanel* m_panel4; wxButton* m_addRemoteButton; wxButton* m_useSelectedButton; - wxNotebook* devTabs; - wxPanel* devInfoPanel; - wxListCtrl* m_DevInfoList; - wxPanel* devParamsPanel; - wxListCtrl* m_ParamInfoList; + wxPanel* m_panel61; + wxStaticText* m_staticText1; + wxPropertyGrid* m_propertyGrid; wxTimer m_deviceTimer; // Virtual event handlers, overide them in your derived class @@ -65,7 +64,7 @@ class devFrame : public wxFrame public: - devFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("CubicSDR :: SDR Devices"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 392,467 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + devFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("CubicSDR :: SDR Devices"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 700,467 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); ~devFrame(); diff --git a/src/sdr/SDREnumerator.cpp b/src/sdr/SDREnumerator.cpp index 1ea7852..30746d2 100644 --- a/src/sdr/SDREnumerator.cpp +++ b/src/sdr/SDREnumerator.cpp @@ -108,19 +108,6 @@ std::vector *SDREnumerator::enumerate_devices(std::string remot SDRDeviceInfo *dev = new SDRDeviceInfo(); SoapySDR::Kwargs deviceArgs = results[i]; - SoapySDR::Kwargs streamArgs; - - if (isRemote) { - wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, "Querying remote " + remoteAddr + " device #" + std::to_string(i)); -// deviceArgs["remote"] = remoteAddr; - if (deviceArgs.count("rtl") != 0) { - streamArgs["remote:mtu"] = "8192"; - streamArgs["remote:format"] = "CS8"; - streamArgs["remote:window"] = "16384000"; - } - } else { - wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, std::string("Found local device #") + std::to_string(i)); - } for (SoapySDR::Kwargs::const_iterator it = deviceArgs.begin(); it != deviceArgs.end(); ++it) { std::cout << " " << it->first << " = " << it->second << std::endl; @@ -132,7 +119,6 @@ std::vector *SDREnumerator::enumerate_devices(std::string remot } dev->setDeviceArgs(deviceArgs); - dev->setStreamArgs(streamArgs); std::cout << "Make device " << i << std::endl; try { @@ -188,6 +174,29 @@ std::vector *SDREnumerator::enumerate_devices(std::string remot dev->addChannel(chan); } + + SoapySDR::Kwargs streamArgs; + + if (isRemote) { + wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, "Querying remote " + remoteAddr + " device #" + std::to_string(i)); + +// if (deviceArgs.count("rtl") != 0) { +// streamArgs["remote:mtu"] = "8192"; +// streamArgs["remote:window"] = "16384000"; +// } + double fullScale = 0; + std::string nativeFormat = device->getNativeStreamFormat(SOAPY_SDR_RX, dev->getRxChannel()->getChannel(), fullScale); + + if (nativeFormat.length()) { + streamArgs["remote:format"] = nativeFormat; + } + } else { + wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, std::string("Found local device #") + std::to_string(i)); + } + + dev->setStreamArgs(streamArgs); + + dev->setSettingsInfo(device->getSettingInfo()); SoapySDR::Device::unmake(device); diff --git a/src/sdr/SoapySDRThread.cpp b/src/sdr/SoapySDRThread.cpp index a8b5084..729df43 100644 --- a/src/sdr/SoapySDRThread.cpp +++ b/src/sdr/SoapySDRThread.cpp @@ -15,7 +15,6 @@ SDRThread::SDRThread() : IOThread() { frequency.store(0); offset.store(0); ppm.store(0); - direct_sampling_mode.store(0); numElems.store(0); @@ -23,16 +22,11 @@ SDRThread::SDRThread() : IOThread() { freq_changed.store(false); offset_changed.store(false); ppm_changed .store(false); - direct_sampling_changed.store(false); device_changed.store(false); - iq_swap.store(false); - iq_swap_changed.store(false); hasPPM.store(false); hasHardwareDC.store(false); numChannels.store(8); - hasDirectSampling.store(false); - hasIQSwap.store(false); agc_mode.store(true); agc_mode_changed.store(false); @@ -51,12 +45,6 @@ void SDRThread::init() { ppm.store(devConfig->getPPM()); ppm_changed.store(true); - direct_sampling_mode.store(devConfig->getDirectSampling()); - direct_sampling_changed.store(true); - - iq_swap.store(devConfig->getIQSwap()); - iq_swap_changed.store(true); - std::string driverName = devInfo->getDriver(); offset = devConfig->getOffset(); @@ -85,14 +73,6 @@ void SDRThread::init() { } else { hasHardwareDC.store(false); } - - std::vector settingNames = devInfo->getSettingNames(); - if (std::find(settingNames.begin(), settingNames.end(), "direct_samp") != settingNames.end()) { - hasDirectSampling.store(true); - } - if (std::find(settingNames.begin(), settingNames.end(), "iq_swap") != settingNames.end()) { - hasIQSwap.store(true); - } device->setGainMode(SOAPY_SDR_RX,0,agc_mode.load()); @@ -184,14 +164,6 @@ void SDRThread::readLoop() { device->setFrequency(SOAPY_SDR_RX,0,"RF",frequency.load() - offset.load()); freq_changed.store(false); } - if (hasDirectSampling.load() && direct_sampling_changed.load()) { - device->writeSetting("direct_samp", std::to_string(direct_sampling_mode)); - direct_sampling_changed.store(false); - } - if (hasIQSwap.load() && iq_swap_changed.load()) { - device->writeSetting("iq_swap", iq_swap.load()?"true":"false"); - iq_swap_changed.store(false); - } if (agc_mode_changed.load()) { SDRDeviceInfo *devInfo = deviceInfo.load(); @@ -346,25 +318,6 @@ int SDRThread::getPPM() { return ppm.load(); } -void SDRThread::setDirectSampling(int dsMode) { - direct_sampling_mode.store(dsMode); - direct_sampling_changed.store(true); - std::cout << "Set direct sampling mode: " << this->direct_sampling_mode.load() << std::endl; -} - -int SDRThread::getDirectSampling() { - return direct_sampling_mode.load(); -} - -void SDRThread::setIQSwap(bool iqSwap) { - iq_swap.store(iqSwap); - iq_swap_changed.store(true); -} - -bool SDRThread::getIQSwap() { - return iq_swap.load(); -} - void SDRThread::setAGCMode(bool mode) { agc_mode.store(mode); agc_mode_changed.store(true); diff --git a/src/sdr/SoapySDRThread.h b/src/sdr/SoapySDRThread.h index 1a199de..8cee44a 100644 --- a/src/sdr/SoapySDRThread.h +++ b/src/sdr/SoapySDRThread.h @@ -69,12 +69,6 @@ public: void setPPM(int ppm); int getPPM(); - void setDirectSampling(int dsMode); - int getDirectSampling(); - - void setIQSwap(bool iqSwap); - bool getIQSwap(); - void setAGCMode(bool mode); bool getAGCMode(); @@ -94,10 +88,10 @@ protected: std::atomic sampleRate; std::atomic_llong frequency, offset; - std::atomic_int ppm, direct_sampling_mode, numElems, numChannels; - std::atomic_bool hasPPM, hasHardwareDC, hasDirectSampling, hasIQSwap; - std::atomic_bool iq_swap, agc_mode, rate_changed, freq_changed, offset_changed, - ppm_changed, direct_sampling_changed, device_changed, iq_swap_changed, agc_mode_changed, gain_value_changed; + std::atomic_int ppm, numElems, numChannels; + std::atomic_bool hasPPM, hasHardwareDC; + std::atomic_bool agc_mode, rate_changed, freq_changed, offset_changed, + ppm_changed, device_changed, agc_mode_changed, gain_value_changed; std::mutex gain_busy; std::map gainValues;