| 347 | } |
| 348 | |
| 349 | void SDRDevicesDialog::OnUseSelected( wxMouseEvent& event) { |
| 350 | if (dev != nullptr) { |
| 351 | |
| 352 | SoapySDR::ArgInfoList args = dev->getSoapyDevice()->getSettingInfo(); |
| 353 | |
| 354 | SoapySDR::Kwargs settingArgs; |
| 355 | SoapySDR::Kwargs streamArgs; |
| 356 | |
| 357 | for (const SoapySDR::ArgInfo& arg : args) { |
| 358 | |
| 359 | wxPGProperty *prop = runtimeProps[arg.key]; |
| 360 | |
| 361 | if (arg.type == SoapySDR::ArgInfo::STRING && !arg.options.empty()) { |
| 362 | settingArgs[arg.key] = getSelectedChoiceOption(prop, arg); |
| 363 | } else if (arg.type == SoapySDR::ArgInfo::BOOL) { |
| 364 | settingArgs[arg.key] = (prop->GetValueAsString()=="True")?"true":"false"; |
| 365 | } else { |
| 366 | settingArgs[arg.key] = prop->GetValueAsString(); |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | if (dev) { |
| 371 | args = dev->getSoapyDevice()->getStreamArgsInfo(SOAPY_SDR_RX, 0); |
| 372 | |
| 373 | if (!args.empty()) { |
| 374 | for (const auto & args_i : args) { |
| 375 | SoapySDR::ArgInfo arg = args_i; |
| 376 | wxPGProperty *prop = streamProps[arg.key]; |
| 377 | |
| 378 | if (arg.type == SoapySDR::ArgInfo::STRING && !arg.options.empty()) { |
| 379 | streamArgs[arg.key] = getSelectedChoiceOption(prop, arg); |
| 380 | } else if (arg.type == SoapySDR::ArgInfo::BOOL) { |
| 381 | streamArgs[arg.key] = (prop->GetValueAsString()=="True")?"true":"false"; |
| 382 | } else { |
| 383 | streamArgs[arg.key] = prop->GetValueAsString(); |
| 384 | } |
| 385 | } |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | AppConfig *cfg = wxGetApp().getConfig(); |
| 390 | DeviceConfig *devConfig = cfg->getDevice(dev->getDeviceId()); |
| 391 | devConfig->setSettings(settingArgs); |
| 392 | devConfig->setStreamOpts(streamArgs); |
| 393 | wxGetApp().setDeviceArgs(settingArgs); |
| 394 | wxGetApp().setStreamArgs(streamArgs); |
| 395 | wxGetApp().setDevice(dev,0); |
| 396 | |
| 397 | //update main application title with Device name: |
| 398 | wxString titleBar = CUBICSDR_TITLE; |
| 399 | titleBar += " - " + wxGetApp().getDevice()->getName(); |
| 400 | wxGetApp().getAppFrame()->SetTitle(titleBar); |
| 401 | |
| 402 | Close(); |
| 403 | } |
| 404 | event.Skip(); |
| 405 | } |
| 406 |
nothing calls this directly
no test coverage detected