Example #1
0
inline void
DeviceListWidget::ManageCurrent()
{
  const unsigned current = GetList().GetCursorIndex();
  if (current >= NUMDEV)
    return;

  DeviceDescriptor &descriptor = (*devices)[current];
  if (!descriptor.IsManageable())
    return;

  if (descriptor.GetState() != PortState::READY) {
    ShowMessageBox(_("Device is not connected"), _("Manage"),
                   MB_OK | MB_ICONERROR);
    return;
  }

  if (!descriptor.Borrow()) {
    ShowMessageBox(_("Device is occupied"), _("Manage"), MB_OK | MB_ICONERROR);
    return;
  }

  Device *device = descriptor.GetDevice();
  if (device == NULL) {
    descriptor.Return();
    return;
  }

  if (descriptor.IsDriver(_T("CAI 302")))
    ManageCAI302Dialog(UIGlobals::GetMainWindow(), look, *device);
  else if (descriptor.IsDriver(_T("FLARM"))) {
    device_blackboard->mutex.Lock();
    const NMEAInfo &basic = device_blackboard->RealState(current);
    const FlarmVersion version = basic.flarm.version;
    device_blackboard->mutex.Unlock();

    ManageFlarmDialog(*device, version);
  } else if (descriptor.IsDriver(_T("LX"))) {
    device_blackboard->mutex.Lock();
    const NMEAInfo &basic = device_blackboard->RealState(current);
    const DeviceInfo info = basic.device;
    const DeviceInfo secondary_info = basic.secondary_device;
    device_blackboard->mutex.Unlock();

    LXDevice &lx_device = *(LXDevice *)device;
    if (lx_device.IsV7())
      ManageV7Dialog(lx_device, info, secondary_info);
    else if (lx_device.IsNano())
      ManageNanoDialog(lx_device, info);
    else if (lx_device.IsLX16xx())
      ManageLX16xxDialog(lx_device, info);
  } else if (descriptor.IsDriver(_T("Vega")))
    dlgConfigurationVarioShowModal(*device);
  else if (descriptor.IsDriver(_T("BlueFly")))
    dlgConfigurationBlueFlyVarioShowModal(*device);

  MessageOperationEnvironment env;
  descriptor.EnableNMEA(env);
  descriptor.Return();
}
Example #2
0
static void
SetupDevice()
{
#ifdef ToDo
  device.DoSetup();
  wf->FocusNext(NULL);
#endif

  // this is a hack, devices dont jet support device dependant setup dialogs

  changed = dlgConfigurationVarioShowModal();
}