store ephemerides raw data as integers in infludxb (only galileo for now) THIS BREAKS COMPATIBILITY WITH OLDER INFLUXDB DATABASES THAT PREDATE THIS COMMIT
parent
79ee7139c2
commit
2ee4d53ee0
|
@ -53,7 +53,7 @@ void InfluxPusher::addValueObserver(int src, string_view name, const initializer
|
|||
}
|
||||
|
||||
|
||||
void InfluxPusher::addValue(const SatID& id, string_view name, const initializer_list<pair<const char*, double>>& values, double t, std::optional<int> src, std::optional<string> tag)
|
||||
void InfluxPusher::addValue(const SatID& id, string_view name, const initializer_list<pair<const char*, var_t>>& values, double t, std::optional<int> src, std::optional<string> tag)
|
||||
{
|
||||
if(d_mute)
|
||||
return;
|
||||
|
@ -63,8 +63,9 @@ void InfluxPusher::addValue(const SatID& id, string_view name, const initializer
|
|||
return;
|
||||
}
|
||||
for(const auto& p : values) {
|
||||
if(isnan(p.second))
|
||||
return;
|
||||
if(auto ptr = std::get_if<double>(&p.second))
|
||||
if(isnan(*ptr))
|
||||
return;
|
||||
}
|
||||
|
||||
string buffer = string(name) +",gnssid="+to_string(id.gnss)+",sv=" +to_string(id.sv)+",sigid="+to_string(id.sigid);
|
||||
|
@ -78,7 +79,14 @@ void InfluxPusher::addValue(const SatID& id, string_view name, const initializer
|
|||
buffer +=",";
|
||||
}
|
||||
lefirst=false;
|
||||
buffer += string(v.first) + "="+to_string(v.second);
|
||||
buffer += string(v.first) + "=";
|
||||
|
||||
std::visit([&buffer](auto&& arg) {
|
||||
using T = std::decay_t<decltype(arg)>;
|
||||
buffer += to_string(arg);
|
||||
if constexpr (!std::is_same_v<T, double>)
|
||||
buffer+="i";
|
||||
}, v.second);
|
||||
}
|
||||
buffer += " " + to_string((uint64_t)(t*1000000000))+"\n";
|
||||
queueValue(buffer);
|
||||
|
|
|
@ -4,12 +4,14 @@
|
|||
#include <optional>
|
||||
#include <initializer_list>
|
||||
#include "navparse.hh"
|
||||
#include <variant>
|
||||
|
||||
struct InfluxPusher
|
||||
{
|
||||
typedef std::variant<double, int32_t, uint32_t, int64_t> var_t;
|
||||
explicit InfluxPusher(std::string_view dbname);
|
||||
void addValueObserver(int src, std::string_view name, const std::initializer_list<std::pair<const char*, double>>& values, double t, std::optional<SatID> satid=std::optional<SatID>());
|
||||
void addValue(const SatID& id, std::string_view name, const std::initializer_list<std::pair<const char*, double>>& values, double t, std::optional<int> src = std::optional<int>(), std::optional<string> tag = std::optional<string>("src"));
|
||||
void addValue(const SatID& id, std::string_view name, const std::initializer_list<std::pair<const char*, var_t>>& values, double t, std::optional<int> src = std::optional<int>(), std::optional<string> tag = std::optional<string>("src"));
|
||||
|
||||
void checkSend();
|
||||
void doSend(const std::set<std::string>& buffer);
|
||||
|
|
36
navparse.cc
36
navparse.cc
|
@ -259,6 +259,34 @@ void SVStat::reportNewEphemeris(const SatID& id, InfluxPusher& idb)
|
|||
else
|
||||
latestDisco= -1;
|
||||
|
||||
if(gnss==2) {
|
||||
const auto& eg = ephgalmsg;
|
||||
|
||||
idb.addValue(id, "ephemeris-actual", {
|
||||
{"iod", eg.getIOD()}}, satUTCTime(id));
|
||||
|
||||
|
||||
idb.addValue(id, "ephemeris-actual", {
|
||||
{"iod", eg.getIOD()},
|
||||
{"t0e", eg.t0e},
|
||||
{"sqrta", eg.sqrtA},
|
||||
{"e", eg.e},
|
||||
{"cuc", eg.cuc},
|
||||
{"cus", eg.cus},
|
||||
{"crc", eg.crc},
|
||||
{"crs", eg.crs},
|
||||
{"m0", eg.m0},
|
||||
{"deltan", eg.deltan},
|
||||
{"i0", eg.i0},
|
||||
{"cic", eg.cic},
|
||||
{"cis", eg.cis},
|
||||
{"omegadot", eg.omegadot},
|
||||
{"omega0", eg.omega0},
|
||||
{"idot", eg.idot},
|
||||
{"omega", eg.omega}}, satUTCTime(id));
|
||||
|
||||
}
|
||||
|
||||
if(hours < 24) {
|
||||
idb.addValue(id, "eph-disco",
|
||||
{{"meters", disco},
|
||||
|
@ -2110,10 +2138,10 @@ try
|
|||
if(frame == 1) {
|
||||
|
||||
idb.addValue(id, "clock", {{"offset_ns", getGPSAtomicOffset(svstat.tow(), svstat.gpsmsg).first},
|
||||
{"t0c", 16.0*gm.t0c},
|
||||
{"af0", 8.0*gm.af0},
|
||||
{"af1", 8.0*gm.af1},
|
||||
{"af2", 16.0*gm.af2}}, satUTCTime(id));
|
||||
{"t0c", 16*gm.t0c},
|
||||
{"af0", 8*gm.af0},
|
||||
{"af1", 8*gm.af1},
|
||||
{"af2", 16*gm.af2}}, satUTCTime(id));
|
||||
|
||||
// cout<<"Got ura "<<gm.ura<<" for sv "<<id.first<<","<<id.second<<endl;
|
||||
idb.addValue(id, "gpsura", {{"value", gm.ura}}, satUTCTime(id));
|
||||
|
|
Loading…
Reference in New Issue