mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-02 14:04:47 -04:00
Remove built-in RTLSDR settings to prepare for replacements, Device form propgrid test
This commit is contained in:
+23
-14
@@ -108,19 +108,6 @@ std::vector<SDRDeviceInfo *> *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<SDRDeviceInfo *> *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<SDRDeviceInfo *> *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);
|
||||
|
||||
@@ -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<std::string> 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);
|
||||
|
||||
@@ -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<uint32_t> 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<std::string, float> gainValues;
|
||||
|
||||
Reference in New Issue
Block a user