pull/110/merge
bert hubert 2021-09-21 17:30:57 +02:00
parent 155f4c6e72
commit 95a41e9612
4 changed files with 31 additions and 23 deletions

View File

@ -257,7 +257,8 @@ int main(int argc, char **argv)
res = mc.getURL(url+"svs.json");
j = nlohmann::json::parse(res);
bool first=true;
bool first=true;
bool globalOsnma=false;
for(const auto& sv : j) {
if(!sv.count("gnssid") || !sv.count("fullName") || !sv.count("sigid")) {
cout<<"Skipping "<< sv.count("gnssid") <<", "<< sv.count("fullName") <<", " <<sv.count("sigid") <<endl;
@ -279,7 +280,8 @@ int main(int argc, char **argv)
// cout<<"Skipping "<<fullName<<" in loop: "<<sv.count("healthissue")<<", "<<sv.count("eph-age-m") << ", "<<sv.count("perrecv")<<endl;
continue;
}
for(const auto& recv : sv["perrecv"]) {
if(!recv.count("last-seen-s")) {
cout<<"Missing last-seen-s"<<endl;
@ -289,20 +291,10 @@ int main(int argc, char **argv)
numfresh++;
if((int)recv["last-seen-s"] < 3600)
notseen=false;
}
if(sv.count("osnma") && sv["osnma"]==true)
globalOsnma |= 1;
static int ctr;
bool overriden=false;
/*
if(fullName=="E01@1") {
if(((ctr++) % 130) < 65)
if(sv.count("osnma"))
overriden = true;
cerr<<"Reporting for "<<fullName<<": "<<(overriden || (sv.count("osnma") && (sv["osnma"] != false)))<<endl;
}
*/
auto osnmachange = g_sk.reportState(fullName, "osnma", overriden || (sv.count("osnma") && (sv["osnma"] != false)));
auto healthchange = g_sk.reportState(fullName, "health", sv["healthissue"]!=0);
std::optional<string> tooOldChange;
@ -343,8 +335,6 @@ int main(int argc, char **argv)
*/
ostringstream out;
if(osnmachange)
out<<"OSNMA state change: "<< (*osnmachange) <<" ";
if(healthchange)
out<< *healthchange<<" ";
@ -408,6 +398,17 @@ int main(int argc, char **argv)
cout<<humanTimeNow() <<" " << tweet << endl;
}
}
auto osnmachange = g_sk.reportState("global", "osnma", globalOsnma);
if(osnmachange) {
string tweet= "Galileo OSNMA new state: "+*osnmachange;
cout<<humanTimeNow()<< " " <<tweet<<endl;
if(doTweet) {
sendTweet(tweet);
}
}
cout<<".";
cout.flush();
}

View File

@ -2632,7 +2632,7 @@ try
for(const auto& ed : rm.d_ephs) {
auto iter = g_svstats.find(ed.id);
// XXX NAVCAST ONLY
if(iter != g_svstats.end() && iter->second.completeIOD() && iter->second.liveIOD().getIOD() == ed.iod && nmm.sourceid()==300)
if(iter != g_svstats.end() && iter->second.completeIOD() && iter->second.liveIOD().getIOD() == ed.iod && nmm.sourceid()==302)
iter->second.rtcmEphDelta = ed;
idb.addValue(ed.id, "rtcm-eph-correction", {
@ -2658,7 +2658,7 @@ try
for(const auto& cd : rm.d_clocks) {
auto iter = g_svstats.find(cd.id);
if(iter != g_svstats.end() && nmm.sourceid()==300) /// XXX wrong
if(iter != g_svstats.end() && nmm.sourceid()==302) /// XXX wrong
iter->second.rtcmClockDelta = cd;
idb.addValue(cd.id, "rtcm-clock-correction", {
@ -2686,7 +2686,7 @@ try
else if(rm.type == 1060 || rm.type == 1243) {
for(const auto& ed : rm.d_ephs) {
auto iter = g_svstats.find(ed.id);
if(iter != g_svstats.end() && iter->second.completeIOD() && iter->second.liveIOD().getIOD() == ed.iod && nmm.sourceid()==300)
if(iter != g_svstats.end() && iter->second.completeIOD() && iter->second.liveIOD().getIOD() == ed.iod && nmm.sourceid()==302)
iter->second.rtcmEphDelta = ed;
idb.addValue(ed.id, "rtcm-eph-correction", {
@ -2754,7 +2754,7 @@ try
for(const auto& cd : rm.d_clocks) {
auto iter = g_svstats.find(cd.id);
if(iter != g_svstats.end() && nmm.sourceid()==300)
if(iter != g_svstats.end() && nmm.sourceid()==302)
iter->second.rtcmClockDelta = cd;
idb.addValue(cd.id, "rtcm-clock-correction", {

View File

@ -133,9 +133,11 @@ try
bool doVERSION{false}, doSTDOUT{false};
CLI::App app(program);
string sourceaddr;
bool quiet{false};
app.add_option("--source", sourceaddr, "Connect to this IP address:port to source SBF (otherwise stdin)");
app.add_option("--destination,-d", destinations, "Send output to this IPv4/v6 address");
app.add_option("--station", g_srcid, "Station id")->required();
app.add_option("--quiet", quiet, "Don't emit noise");
app.add_flag("--version", doVERSION, "show program version and copyright");
app.add_flag("--stdout", doSTDOUT, "Emit output to stdout");
try {
@ -181,7 +183,8 @@ try
for(;;) {
double to=1000;
auto res = getSEPMessage(srcfd, &to);
cerr<<res.first.getID()<<" - " <<res.first.getIDBare() << endl;
if(!quiet)
cerr<<res.first.getID()<<" - " <<res.first.getIDBare() << endl;
if(res.first.getID() == 4023) { // I/NAV
auto str = res.first.getPayload();
struct SEPInav
@ -571,6 +574,7 @@ try
}
else {
if(!quiet)
cerr<<"Unknown message "<<res.first.getID() << " / " <<res.first.getIDBare()<<" ("<<res.first.d_store.size()<<" bytes)"<<endl;
}
}

View File

@ -158,9 +158,12 @@ void ZStdReader::worker()
while(input.pos != input.size) {
output.pos=0;
output.size=outputcapacity;
ZSTD_decompressStream(z, &output, &input);
int res = ZSTD_decompressStream(z, &output, &input);
if(ZSTD_isError(res)) {
cerr<<"Error decompressing ZSTD data"<<endl;
break;
}
int res;
res = writen(d_writepipe, output.dst, output.pos);
if(!res) // we are history
break;