void CubicSDR::setDevice(int deviceId) { sdrThread->setDeviceId(deviceId); SDRThreadCommand command(SDRThreadCommand::SDR_THREAD_CMD_SET_DEVICE); command.llong_value = deviceId; pipeSDRCommand->push(command); SDRDeviceInfo *dev = (*getDevices())[deviceId]; DeviceConfig *devConfig = config.getDevice(dev->getDeviceId()); setPPM(devConfig->getPPM()); setDirectSampling(devConfig->getDirectSampling()); setSwapIQ(devConfig->getIQSwap()); setOffset(devConfig->getOffset()); }
void DeviceConfig::load(DataNode *node) { busy_lock.lock(); if (node->hasAnother("ppm")) { DataNode *ppm_node = node->getNext("ppm"); int ppmValue = 0; ppm_node->element()->get(ppmValue); 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; offset_node->element()->get(offsetValue); setOffset(offsetValue); std::cout << "Loaded offset for device '" << deviceId << "' at " << offsetValue << "Hz" << std::endl; } busy_lock.unlock(); }