コード例 #1
0
ファイル: PlaneFileGlue.cpp プロジェクト: MindMil/XCSoar
void
PlaneGlue::Write(const Plane &plane, KeyValueFileWriter &writer)
{
  NarrowString<255> tmp;

  writer.Write("Registration", plane.registration);
  writer.Write("CompetitionID", plane.competition_id);
  writer.Write("Type", plane.type);

  tmp.Format("%u", plane.handicap);
  writer.Write("Handicap", tmp);

  writer.Write("PolarName", plane.polar_name);

  FormatPolarShape(plane.polar_shape, tmp.buffer(), tmp.MAX_SIZE);
  writer.Write("PolarInformation", tmp);

  tmp.Format("%f", (double)plane.reference_mass);
  writer.Write("PolarReferenceMass", tmp);
  tmp.Format("%f", (double)plane.dry_mass);
  writer.Write("PolarDryMass", tmp);
  tmp.Format("%f", (double)plane.max_ballast);
  writer.Write("MaxBallast", tmp);
  tmp.Format("%f", (double)plane.dump_time);
  writer.Write("DumpTime", tmp);
  tmp.Format("%f", (double)plane.max_speed);
  writer.Write("MaxSpeed", tmp);
  tmp.Format("%f", (double)plane.wing_area);
  writer.Write("WingArea", tmp);
}
コード例 #2
0
ファイル: EWMicroRecorder.cpp プロジェクト: XCame/XCSoar
/**
 * Clean a string and write it to the Port.
 */
static bool
WriteCleanString(Port &port, const TCHAR *p,
                 OperationEnvironment &env, unsigned timeout_ms)
{
  NarrowString<256> buffer;
  buffer.SetASCII(p);

  CleanString(buffer.buffer());

  return port.FullWriteString(buffer, env, timeout_ms);
}
コード例 #3
0
ファイル: FlightPhaseJSON.cpp プロジェクト: CnZoom/XcSoarPull
static void
WritePhase(TextWriter &writer, Phase &phase)
{
  JSON::ObjectWriter object(writer);
  NarrowString<64> buffer;

  FormatISO8601(buffer.buffer(), phase.start_datetime);
  object.WriteElement("start_time", JSON::WriteString, buffer);

  FormatISO8601(buffer.buffer(), phase.end_datetime);
  object.WriteElement("end_time", JSON::WriteString, buffer);

  object.WriteElement("type", JSON::WriteString,
                      FormatPhaseType(phase.phase_type));
  object.WriteElement("duration", JSON::WriteInteger, (int)phase.duration);
  object.WriteElement("circling_direction", JSON::WriteString,
                      FormatCirclingDirection(phase.circling_direction));
  object.WriteElement("alt_diff", JSON::WriteInteger, (int)phase.alt_diff);
  object.WriteElement("distance", JSON::WriteInteger, (int)phase.distance);
  object.WriteElement("speed", JSON::WriteFixed, phase.GetSpeed());
  object.WriteElement("vario", JSON::WriteFixed, phase.GetVario());
  object.WriteElement("glide_rate", JSON::WriteFixed, phase.GetGlideRate());
}
コード例 #4
0
ファイル: AnalyseFlight.cpp プロジェクト: MindMil/XCSoar
static void
WriteEventAttributes(TextWriter &writer,
                     const BrokenDateTime &time, const GeoPoint &location)
{
  JSON::ObjectWriter object(writer);

  if (time.IsPlausible()) {
    NarrowString<64> buffer;
    FormatISO8601(buffer.buffer(), time);
    object.WriteElement("time", JSON::WriteString, buffer);
  }

  if (location.IsValid())
    JSON::WriteGeoPointAttributes(object, location);
}
コード例 #5
0
ファイル: Parser.cpp プロジェクト: kwtskran/XCSoar
static void
ReadString(NMEAInputLine &line, NarrowString<N> &value)
{
  line.Read(value.buffer(), value.capacity());
}
コード例 #6
0
ファイル: Parser.cpp プロジェクト: osteocool/XCSoar-1
static void
ReadString(NMEAInputLine &line, NarrowString<N> &value)
{
  line.Read(value.buffer(), value.MAX_SIZE);
}