satdump/src-core/common/tracking/tle.h

50 lines
1.3 KiB
C
Raw Permalink Normal View History

2022-04-16 08:10:25 +02:00
#pragma once
#include "dll_export.h"
#include "nlohmann/json.hpp"
2023-10-19 00:24:43 -04:00
#include <deque>
2022-04-16 08:10:25 +02:00
#include <optional>
#include <string>
2022-04-16 08:10:25 +02:00
namespace satdump
{
// Simple struct to hold TLE definitions
struct TLE
{
2024-04-23 22:41:14 +02:00
int norad = -1;
2022-04-16 08:10:25 +02:00
std::string name;
std::string line1;
std::string line2;
uint64_t time;
2022-04-16 08:10:25 +02:00
};
inline void to_json(nlohmann::json &j, const TLE &v)
{
j["norad"] = v.norad;
j["name"] = v.name;
j["line1"] = v.line1;
j["line2"] = v.line2;
}
inline void from_json(const nlohmann::json &j, TLE &v)
{
v.norad = j["norad"].get<int>();
v.name = j["name"].get<std::string>();
v.line1 = j["line1"].get<std::string>();
v.line2 = j["line2"].get<std::string>();
}
2023-07-18 21:31:13 +02:00
struct TLEsUpdatedEvent
{
};
2022-04-21 16:10:00 +02:00
int parseTLEStream(std::istream &inputStream, std::vector<TLE> &new_registry); // Helper - Takes an input stream and parses out the valid TLEs
2022-04-21 16:10:00 +02:00
std::vector<TLE> tryFetchTLEsFromFileURL(std::string url_str);
std::vector<TLE> tryFetchSingleTLEwithNorad(int norad);
std::optional<TLE> get_from_spacetrack_time(int norad, time_t timestamp);
std::vector<TLE> get_from_spacetrack_latest_list(std::vector<int> norad);
2022-10-12 16:45:35 +02:00
std::optional<TLE> get_from_norad_in_vec(std::vector<TLE> vec, int norad);
} // namespace satdump