WIP: checkpoint geocaching before main integration

This commit is contained in:
Trail Mate Dev
2026-09-24 08:47:53 +08:00
parent d7a2f35328
commit 3d65ece83d
244 changed files with 25291 additions and 126 deletions
@@ -1,4 +1,6 @@
#include "platform/ui/team_ui_store_runtime.h"
#include "gps/gpx/track_writer.h"
#include "gps/gpx/ostream_sink.h"
#include "platform/linux/runtime_paths.h"
#include <algorithm>
@@ -452,21 +454,9 @@ bool team_ui_append_member_track(const TeamId& team_id,
const double lon = static_cast<double>(pt.lon_e7) / 1e7;
const uint32_t ts = track.start_ts + static_cast<uint32_t>(track.interval_s) * static_cast<uint32_t>(i);
char line[128] = {0};
std::snprintf(line, sizeof(line), "<trkpt lat=\"%.7f\" lon=\"%.7f\">\n", lat, lon);
stream << line;
stream << " <ele>0.0</ele>\n";
if (ts >= kMinValidEpoch)
{
stream << " <time>" << iso_time(static_cast<std::time_t>(ts)) << "</time>\n";
}
stream << " <extensions>\n";
stream << " <speed>0.00</speed>\n";
stream << " <course>0.0</course>\n";
stream << " <hdop>0.0</hdop>\n";
stream << " <sat>0</sat>\n";
stream << " </extensions>\n";
stream << "</trkpt>\n";
const std::string time_str = ts >= kMinValidEpoch ? iso_time(static_cast<std::time_t>(ts)) : "";
::gps::gpx::OstreamSink output(stream);
if (!::gps::gpx::writeTrackPoint(output, lat, lon, time_str, 0, 7)) return false;
}
stream.flush();
return stream.good();
@@ -1,4 +1,7 @@
#include "platform/ui/tracker_runtime.h"
#include "gps/gpx/track_writer.h"
#include "gps/gpx/ostream_sink.h"
#include <ctime>
#include <algorithm>
#include <chrono>
@@ -116,31 +119,24 @@ void append_gpx_point(std::ofstream& stream,
const platform::ui::gps::GpsState& state,
uint32_t epoch_s)
{
stream << "<trkpt lat=\""
<< std::fixed << std::setprecision(7) << state.lat
<< "\" lon=\""
<< std::fixed << std::setprecision(7) << state.lng
<< "\">";
if (state.has_alt)
char iso[32]{};
const std::time_t seconds = static_cast<std::time_t>(epoch_s);
if (epoch_s != 0)
{
stream << "<ele>"
<< std::fixed << std::setprecision(1) << state.alt_m
<< "</ele>";
const std::tm* utc = std::gmtime(&seconds);
if (utc) std::strftime(iso, sizeof(iso), "%Y-%m-%dT%H:%M:%SZ", utc);
}
stream << "<time>" << epoch_s << "</time>";
if (state.has_speed)
{
stream << "<speed>"
<< std::fixed << std::setprecision(2) << state.speed_mps
<< "</speed>";
}
if (state.has_course)
{
stream << "<course>"
<< std::fixed << std::setprecision(1) << state.course_deg
<< "</course>";
}
stream << "</trkpt>\n";
::gps::gpx::TrackPointOptions options;
options.has_elevation = state.has_alt;
options.elevation = state.alt_m;
options.legacy_extensions = false;
options.has_speed = state.has_speed;
options.speed_mps = state.speed_mps;
options.has_course = state.has_course;
options.course_deg = state.course_deg;
::gps::gpx::OstreamSink output(stream);
if (!::gps::gpx::writeTrackPoint(output, state.lat, state.lng, iso, state.satellites, 7, options))
stream.setstate(std::ios::badbit);
}
void append_binary_point(std::ofstream& stream,