Beispiel #1
0
bool
LXDevice::DownloadFlight(const RecordedFlightInfo &flight,
                         const TCHAR *path,
                         OperationEnvironment &env)
{
    if (flight.internal.lx.nano_filename[0] != 0) {
        assert(!busy);
        busy = true;

        bool success = Nano::DownloadFlight(port, flight, path, env);
        busy = false;
        return success;
    }

    if (!EnableCommandMode(env))
        return false;

    FILE *file = _tfopen(path, _T("wb"));
    if (file == NULL)
        return false;

    assert(!busy);
    busy = true;

    bool success = DownloadFlightInner(port, flight, file, env);
    fclose(file);

    LX::CommandModeQuick(port, env);

    busy = false;

    return success;
}
Beispiel #2
0
bool
LXDevice::DownloadFlight(const RecordedFlightInfo &flight,
                         const TCHAR *path,
                         OperationEnvironment &env)
{
  if (!EnableCommandMode(env))
    return false;

  FILE *file = _tfopen(path, _T("wb"));
  if (file == NULL)
    return false;

  assert(!busy);
  mutex.Lock();
  busy = true;
  mutex.Unlock();

  bool success = DownloadFlightInner(port, flight, file, env);
  fclose(file);

  LX::CommandModeQuick(port, env);

  mutex.Lock();
  busy = false;
  mutex.Unlock();

  return success;
}
Beispiel #3
0
bool
Nano::DownloadFlight(Port &port, const RecordedFlightInfo &flight,
                     const TCHAR *path, OperationEnvironment &env)
{
  port.StopRxThread();

  FILE *file = _tfopen(path, _T("wb"));
  if (file == NULL)
    return false;

  bool success = DownloadFlightInner(port, flight.internal.lx.nano_filename,
                                     file, env);
  if (fclose(file) != 0)
    success = false;

  return success;
}
Beispiel #4
0
bool
VolksloggerDevice::DownloadFlight(const RecordedFlightInfo &flight,
                                  const TCHAR *path,
                                  OperationEnvironment &env)
{
  port.StopRxThread();

  // change to IO mode baud rate
  unsigned old_baud_rate = port.GetBaudrate();
  if (old_baud_rate == 9600)
    old_baud_rate = 0;
  else if (old_baud_rate != 0 && !port.SetBaudrate(9600))
    return false;

  bool success = DownloadFlightInner(port, bulkrate,
                                     flight, path, env);
  // restore baudrate
  if (old_baud_rate != 0)
     port.SetBaudrate(old_baud_rate);

  return success;
}
Beispiel #5
0
bool
CAI302Device::DownloadFlight(const RecordedFlightInfo &flight,
                             const TCHAR *path,
                             OperationEnvironment &env)
{
  assert(flight.internal.cai302 < 64);

  if (!EnableBulkMode(env))
    return false;

  if (!UploadMode(env)) {
    DisableBulkMode(env);
    return false;
  }

  if (!DownloadFlightInner(port, flight, path, env)) {
    mode = Mode::UNKNOWN;
    DisableBulkMode(env);
    return false;
  }

  DisableBulkMode(env);
  return true;
}