Files
StarPilot/openpilot/tools/replay/py_tools.h
T
firestar5683 e9dd458699 Replay
Provide route replay, log migration and recorded vehicle fixtures for regression checks.

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com>
Co-authored-by: Kacper Rączy <gfw.kra@gmail.com>
Co-authored-by: YassineYousfi <yyousfi1@binghamton.edu>
Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com>
2026-10-14 20:02:39 -05:00

37 lines
1.5 KiB
C++

#pragma once
#include <atomic>
#include <functional>
#include <string>
typedef std::function<void(uint64_t cur, uint64_t total, bool success)> DownloadProgressHandler;
void installDownloadProgressHandler(DownloadProgressHandler handler);
namespace PyTools {
// Downloads url to local cache, returns local file path. Reports progress via installDownloadProgressHandler.
std::string download(const std::string &url, bool use_cache = true, std::atomic<bool> *abort = nullptr);
// Decompresses a local log file and returns the temporary output path.
std::string decompress(const std::string &path, std::atomic<bool> *abort = nullptr, size_t max_bytes = 0);
// Returns JSON string of route files (same format as /v1/route/.../files API)
std::string getRouteFiles(const std::string &route);
// Resolves API/internal files into a JSON manifest keyed by segment number. End is inclusive.
std::string resolveRouteFiles(const std::string &route, int begin, int end, const std::string &selector);
// Browser sign-in; abort closes the local callback server. Returns a JSON status.
std::string authenticate(const std::string &provider, std::atomic<bool> *abort);
// Returns JSON string of user's devices
std::string getDevices();
// Returns JSON string of device routes
std::string getDeviceRoutes(const std::string &dongle_id, int64_t start_ms = 0, int64_t end_ms = 0, bool preserved = false);
// Migrated bytes retain binary stdout exactly; empty on failure.
std::string migrateLog(const std::string &log_path);
} // namespace PyTools