mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-10-08 00:00:23 -04:00
RTL Device Selection
This commit is contained in:
@@ -39,6 +39,32 @@ bool CubicSDR::OnInit() {
|
||||
sdrPostThread->setIQDataInQueue(iqPostDataQueue);
|
||||
sdrPostThread->setIQVisualQueue(iqVisualQueue);
|
||||
|
||||
std::vector<SDRDeviceInfo *>::iterator devs_i;
|
||||
|
||||
SDRThread::enumerate_rtl(&devs);
|
||||
|
||||
if (devs.size() > 1) {
|
||||
wxArrayString choices;
|
||||
for (devs_i = devs.begin(); devs_i != devs.end(); devs_i++) {
|
||||
std::string devName = (*devs_i)->getName();
|
||||
if ((*devs_i)->isAvailable()) {
|
||||
devName.append(": ");
|
||||
devName.append((*devs_i)->getProduct());
|
||||
devName.append(" [");
|
||||
devName.append((*devs_i)->getSerial());
|
||||
devName.append("]");
|
||||
} else {
|
||||
devName.append(" (In Use?)");
|
||||
}
|
||||
choices.Add(devName);
|
||||
}
|
||||
|
||||
int devId = wxGetSingleChoiceIndex(wxT("Devices"),wxT("Choose Input Device"),choices);
|
||||
|
||||
std::cout << "Chosen: " << devId << std::endl;
|
||||
sdrThread->setDeviceId(devId);
|
||||
}
|
||||
|
||||
t_PostSDR = new std::thread(&SDRPostThread::threadMain, sdrPostThread);
|
||||
t_SDR = new std::thread(&SDRThread::threadMain, sdrThread);
|
||||
|
||||
@@ -163,3 +189,14 @@ void CubicSDR::removeDemodulator(DemodulatorInstance *demod) {
|
||||
}
|
||||
sdrPostThread->removeDemodulator(demod);
|
||||
}
|
||||
|
||||
std::vector<SDRDeviceInfo*>* CubicSDR::getDevices() {
|
||||
return &devs;
|
||||
}
|
||||
|
||||
void CubicSDR::setDevice(int deviceId) {
|
||||
sdrThread->setDeviceId(deviceId);
|
||||
SDRThreadCommand command(SDRThreadCommand::SDR_THREAD_CMD_SET_DEVICE);
|
||||
command.llong_value = deviceId;
|
||||
threadCmdQueueSDR->push(command);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user