add SBAS to influx
parent
fc03e2ed35
commit
4fa7b30f50
|
@ -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)
|
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)
|
||||||
{
|
{
|
||||||
if(d_mute)
|
if(d_mute)
|
||||||
return;
|
return;
|
||||||
|
@ -69,7 +69,7 @@ void InfluxPusher::addValue(const SatID& id, string_view name, const initializer
|
||||||
|
|
||||||
string buffer = string(name) +",gnssid="+to_string(id.gnss)+",sv=" +to_string(id.sv)+",sigid="+to_string(id.sigid);
|
string buffer = string(name) +",gnssid="+to_string(id.gnss)+",sv=" +to_string(id.sv)+",sigid="+to_string(id.sigid);
|
||||||
if(src)
|
if(src)
|
||||||
buffer += ",src="+to_string(*src);
|
buffer += ","+*tag+"="+to_string(*src);
|
||||||
|
|
||||||
buffer+= " ";
|
buffer+= " ";
|
||||||
bool lefirst=true;
|
bool lefirst=true;
|
||||||
|
|
|
@ -9,7 +9,7 @@ struct InfluxPusher
|
||||||
{
|
{
|
||||||
explicit InfluxPusher(std::string_view dbname);
|
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 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>());
|
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 checkSend();
|
void checkSend();
|
||||||
void doSend(const std::set<std::string>& buffer);
|
void doSend(const std::set<std::string>& buffer);
|
||||||
|
|
30
navparse.cc
30
navparse.cc
|
@ -1544,6 +1544,7 @@ try
|
||||||
}
|
}
|
||||||
|
|
||||||
char bert[6];
|
char bert[6];
|
||||||
|
// I apologise deeply
|
||||||
if(fread(bert, 1, 6, stdin) != 6 || bert[0]!='b' || bert[1]!='e' || bert[2] !='r' || bert[3]!='t') {
|
if(fread(bert, 1, 6, stdin) != 6 || bert[0]!='b' || bert[1]!='e' || bert[2] !='r' || bert[3]!='t') {
|
||||||
cerr<<"EOF or bad magic"<<endl;
|
cerr<<"EOF or bad magic"<<endl;
|
||||||
break;
|
break;
|
||||||
|
@ -2347,7 +2348,34 @@ try
|
||||||
sb.perrecv[nmm.sourceid()].last_seen = nmm.localutcseconds();
|
sb.perrecv[nmm.sourceid()].last_seen = nmm.localutcseconds();
|
||||||
|
|
||||||
basic_string<uint8_t> sbas((uint8_t*)nmm.sbm().contents().c_str(), nmm.sbm().contents().length());
|
basic_string<uint8_t> sbas((uint8_t*)nmm.sbm().contents().c_str(), nmm.sbm().contents().length());
|
||||||
sb.status.parse(sbas, nmm.localutcseconds());
|
auto delta = sb.status.parse(sbas, nmm.localutcseconds());
|
||||||
|
// fast correction
|
||||||
|
for(const auto& f : delta.first) {
|
||||||
|
idb.addValue(f.id, "sbas_fast",
|
||||||
|
{{"correction", f.correction},
|
||||||
|
{"udrei", f.udrei}}, nmm.localutcseconds(),
|
||||||
|
nmm.sbm().gnsssv(), "sbas");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
for(const auto& lt : delta.second) {
|
||||||
|
idb.addValue(lt.id,"sbas_lterm",
|
||||||
|
{
|
||||||
|
{"iod8", lt.iod8},
|
||||||
|
{"toa", lt.toa},
|
||||||
|
{"iodp", lt.iodp},
|
||||||
|
{"dx", lt.dx},
|
||||||
|
{"dy", lt.dy},
|
||||||
|
{"dz", lt.dz},
|
||||||
|
{"dai", lt.dai},
|
||||||
|
{"ddx", lt.ddx},
|
||||||
|
{"ddy", lt.ddy},
|
||||||
|
{"ddz", lt.ddz},
|
||||||
|
{"ddai", lt.ddai}
|
||||||
|
}, nmm.localutcseconds(), nmm.sbm().gnsssv(), "sbas");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if(nmm.localutcseconds() - sb.status.d_lastDNU > 120) {
|
if(nmm.localutcseconds() - sb.status.d_lastDNU > 120) {
|
||||||
for(const auto& c : sb.status.d_fast) {
|
for(const auto& c : sb.status.d_fast) {
|
||||||
g_svstats[c.first].sbas[nmm.sbm().gnsssv()].fast = c.second;
|
g_svstats[c.first].sbas[nmm.sbm().gnsssv()].fast = c.second;
|
||||||
|
|
12
sbas.cc
12
sbas.cc
|
@ -135,8 +135,9 @@ pair<vector<SBASState::FastCorrection>, vector<SBASState::LongTermCorrection>> S
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SBASState::parse(const std::basic_string<uint8_t>& sbas, time_t now)
|
pair<vector<SBASState::FastCorrection>, vector<SBASState::LongTermCorrection>> SBASState::parse(const std::basic_string<uint8_t>& sbas, time_t now)
|
||||||
{
|
{
|
||||||
|
pair<vector<SBASState::FastCorrection>, vector<SBASState::LongTermCorrection>> ret;
|
||||||
int type = getbitu(&sbas[0], 8, 6);
|
int type = getbitu(&sbas[0], 8, 6);
|
||||||
if(type == 0) {
|
if(type == 0) {
|
||||||
parse0(sbas, now);
|
parse0(sbas, now);
|
||||||
|
@ -145,21 +146,22 @@ void SBASState::parse(const std::basic_string<uint8_t>& sbas, time_t now)
|
||||||
parse1(sbas, now);
|
parse1(sbas, now);
|
||||||
}
|
}
|
||||||
else if(type >= 2 && type <= 5) {
|
else if(type >= 2 && type <= 5) {
|
||||||
parse2_5(sbas, now);
|
ret.first = parse2_5(sbas, now);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(type == 6) {
|
else if(type == 6) {
|
||||||
parse6(sbas, now);
|
ret.first = parse6(sbas, now);
|
||||||
}
|
}
|
||||||
else if(type ==7) {
|
else if(type ==7) {
|
||||||
parse7(sbas, now);
|
parse7(sbas, now);
|
||||||
}
|
}
|
||||||
else if(type == 24) {
|
else if(type == 24) {
|
||||||
parse24(sbas, now);
|
ret = parse24(sbas, now);
|
||||||
}
|
}
|
||||||
else if(type == 25) {
|
else if(type == 25) {
|
||||||
parse25(sbas, now);
|
ret.second = parse25(sbas, now);
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SBASState::parse25H(const basic_string<uint8_t>& sbas, time_t t, int offset, vector<LongTermCorrection>& ret)
|
void SBASState::parse25H(const basic_string<uint8_t>& sbas, time_t t, int offset, vector<LongTermCorrection>& ret)
|
||||||
|
|
4
sbas.hh
4
sbas.hh
|
@ -40,12 +40,12 @@ struct SBASState
|
||||||
int toa;
|
int toa;
|
||||||
int iodp;
|
int iodp;
|
||||||
double dx, dy, dz, dai;
|
double dx, dy, dz, dai;
|
||||||
double ddx, ddy, ddz, ddai;
|
double ddx{0}, ddy{0}, ddz{0}, ddai{0};
|
||||||
bool velocity{false};
|
bool velocity{false};
|
||||||
time_t lastUpdate{-1};
|
time_t lastUpdate{-1};
|
||||||
};
|
};
|
||||||
|
|
||||||
void parse(const std::basic_string<uint8_t>& sbas, time_t now);
|
std::pair<std::vector<SBASState::FastCorrection>, std::vector<SBASState::LongTermCorrection>> parse(const std::basic_string<uint8_t>& sbas, time_t now);
|
||||||
|
|
||||||
void parse0(const std::basic_string<uint8_t>& message, time_t now);
|
void parse0(const std::basic_string<uint8_t>& message, time_t now);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue