Compare commits
No commits in common. "master" and "string2vec" have entirely different histories.
master
...
string2vec
17
Makefile
|
|
@ -39,11 +39,12 @@ navmon.pb.cc: navmon.proto
|
|||
protoc --cpp_out=./ navmon.proto
|
||||
|
||||
|
||||
H2OPP=ext/powerblog/h2o-pp.o
|
||||
SIMPLESOCKETS=ext/powerblog/ext/simplesocket/swrappers.o ext/powerblog/ext/simplesocket/sclasses.o ext/powerblog/ext/simplesocket/comboaddress.o
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.d ext/*/*.o ext/*/*.d $(PROGRAMS) navmon.pb.h navmon.pb.cc $(patsubst %.cc,%.o,$(wildcard ext/sgp4/libsgp4/*.cc)) $(SIMPLESOCKETS)
|
||||
rm -f *~ *.o *.d ext/*/*.o ext/*/*.d $(PROGRAMS) navmon.pb.h navmon.pb.cc $(patsubst %.cc,%.o,$(wildcard ext/sgp4/libsgp4/*.cc)) $(H2OPP) $(SIMPLESOCKETS)
|
||||
rm -f ext/sgp4/libsgp4/*.d ext/powerblog/ext/simplesocket/*.d
|
||||
|
||||
help2man:
|
||||
|
|
@ -62,11 +63,21 @@ install: $(PROGRAMS) help2man
|
|||
mkdir -p $(DESTDIR)$(prefix)$(htdocs)/galmon
|
||||
cp -a html $(DESTDIR)$(prefix)$(htdocs)/galmon/
|
||||
|
||||
download-debian-package:
|
||||
apt-key adv --fetch-keys https://ota.bike/public-package-signing-keys/86E7F51C04FBAAB0.asc
|
||||
echo "deb https://ota.bike/debian/ buster main" > /etc/apt/sources.list.d/galmon.list
|
||||
apt-get update && apt-get install -y galmon
|
||||
|
||||
download-raspbian-package:
|
||||
apt-key adv --fetch-keys https://ota.bike/public-package-signing-keys/86E7F51C04FBAAB0.asc
|
||||
echo "deb https://ota.bike/raspbian/ buster main" > /etc/apt/sources.list.d/galmon.list
|
||||
apt-get update && apt-get install -y galmon
|
||||
|
||||
decrypt: decrypt.o bits.o
|
||||
$(CXX) -std=gnu++17 $^ -o $@ -lfmt
|
||||
|
||||
navparse: navparse.o $(SIMPLESOCKETS) minicurl.o ubx.o bits.o navmon.pb.o gps.o ephemeris.o beidou.o glonass.o $(patsubst %.cc,%.o,$(wildcard ext/sgp4/libsgp4/*.cc)) tle.o navmon.o coverage.o osen.o trkmeas.o influxpush.o ${EXTRADEP} githash.o sbas.o rtcm.o galileo.o
|
||||
$(CXX) -std=gnu++17 $^ -o $@ -pthread -L/usr/local/lib -L/usr/local/opt/openssl/lib/ -lz -lcurl -lprotobuf -lfmt
|
||||
navparse: navparse.o $(H2OPP) $(SIMPLESOCKETS) minicurl.o ubx.o bits.o navmon.pb.o gps.o ephemeris.o beidou.o glonass.o $(patsubst %.cc,%.o,$(wildcard ext/sgp4/libsgp4/*.cc)) tle.o navmon.o coverage.o osen.o trkmeas.o influxpush.o ${EXTRADEP} githash.o sbas.o rtcm.o galileo.o
|
||||
$(CXX) -std=gnu++17 $^ -o $@ -pthread -L/usr/local/lib -L/usr/local/opt/openssl/lib/ -lh2o-evloop -lssl -lcrypto -lz -lcurl -lprotobuf $(WSLAY) -lfmt
|
||||
|
||||
reporter: reporter.o $(SIMPLESOCKETS) minicurl.o ubx.o bits.o navmon.pb.o gps.o ephemeris.o beidou.o glonass.o $(patsubst %.cc,%.o,$(wildcard ext/sgp4/libsgp4/*.cc)) tle.o navmon.o coverage.o osen.o githash.o influxpush.o
|
||||
$(CXX) -std=gnu++17 $^ -o $@ -pthread -L/usr/local/lib -lprotobuf -lcurl -lfmt
|
||||
|
|
|
|||
15
README.md
|
|
@ -82,20 +82,27 @@ receiver-only tools.
|
|||
To build everything, including the webserver, try:
|
||||
|
||||
```
|
||||
apt-get install protobuf-compiler libcurl4-openssl-dev libssl-dev libprotobuf-dev \
|
||||
libncurses5-dev libeigen3-dev libzstd-dev g++ libfmt-dev
|
||||
apt-get install protobuf-compiler libh2o-dev libcurl4-openssl-dev libssl-dev libprotobuf-dev \
|
||||
libh2o-evloop-dev libwslay-dev libncurses5-dev libeigen3-dev libzstd-dev g++ libfmt-dev
|
||||
git clone https://github.com/berthubert/galmon.git --recursive
|
||||
cd galmon
|
||||
make
|
||||
```
|
||||
|
||||
If this doesn't succeed with an error about h2o, make sure you have this
|
||||
library installed. If you get an error about 'wslay', do the following, and run make again:
|
||||
|
||||
```
|
||||
echo WSLAY=-lwslay > Makefile.local
|
||||
```
|
||||
|
||||
Building on OSX
|
||||
---------------
|
||||
With thanks to a contributor from Prague. First make sure you've installed
|
||||
brew, which you can get [here](https://brew.sh/). Then do:
|
||||
|
||||
```
|
||||
brew install protobuf lzlib zstd eigen
|
||||
brew install protobuf lzlib zstd h2o eigen
|
||||
```
|
||||
|
||||
And then:
|
||||
|
|
@ -321,7 +328,7 @@ Documents
|
|||
* [GLONASS CDMA](http://russianspacesystems.ru/wp-content/uploads/2016/08/ICD-GLONASS-CDMA-General.-Edition-1.0-2016.pdf)
|
||||
not actually relevant for the CDMA aspects, but has appendices on more
|
||||
precise orbit determinations.
|
||||
* [GPS](https://www.navcen.uscg.gov/sites/default/files/pdf/gps/IS-GPS-200N.pdf)
|
||||
* [GPS](https://www.gps.gov/technical/icwg/IS-GPS-200K.pdf)
|
||||
* [U-blox 8 interface specification](https://www.u-blox.com/sites/default/files/products/documents/u-blox8-M8_ReceiverDescrProtSpec_%28UBX-13003221%29_Public.pdf)
|
||||
* [U-blox 9 interface specification](https://www.u-blox.com/sites/default/files/u-blox_ZED-F9P_InterfaceDescription_%28UBX-18010854%29.pdf)
|
||||
* [U-blox 10 interface specification](https://content.u-blox.com/sites/default/files/documents/u-blox-F10-SPG-6.00_InterfaceDescription_UBX-23002975.pdf)
|
||||
|
|
|
|||
|
|
@ -4,12 +4,11 @@
|
|||
#include "navmon.hh"
|
||||
#include "fmt/format.h"
|
||||
#include "fmt/printf.h"
|
||||
|
||||
#include "ext/powerblog/h2o-pp.hh"
|
||||
#include <variant>
|
||||
|
||||
#include "CLI/CLI.hpp"
|
||||
#include "version.hh"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
static char program[]="galmonmon";
|
||||
|
||||
|
|
|
|||
2
gps.cc
|
|
@ -38,8 +38,6 @@ int GPSState::parseGPSMessage(const std::vector<uint8_t>& cond, uint8_t* pageptr
|
|||
wn = 2048 + getbitu(&cond[0], 2*24, 10);
|
||||
ura = getbitu(&cond[0], 2*24+12, 4);
|
||||
gpshealth = getbitu(&cond[0], 2*24+16, 6);
|
||||
iodc = getbitu(&cond[0], 2*24 +22, 2) * 256;
|
||||
iodc += getbitu(&cond[0], 7*24, 8);
|
||||
|
||||
// cerr<<"GPS Week Number: "<< wn <<", URA: "<< (int)ura<<", health: "<<
|
||||
// (int)gpshealth <<endl;
|
||||
|
|
|
|||
2
gps.hh
|
|
@ -134,10 +134,8 @@ struct GPSState : GPSLikeEphemeris
|
|||
uint16_t wnLSF{0};
|
||||
uint8_t dn; // leap second day number
|
||||
// 1 2^-31 2^-43 2^-55 16 second
|
||||
int iodc;
|
||||
int ura;
|
||||
|
||||
|
||||
int gpsiod{-1};
|
||||
|
||||
int getIOD() const
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
var repeat;
|
||||
|
||||
moment.relativeTimeThreshold('m', 120);
|
||||
|
||||
function maketable(str, arr)
|
||||
{
|
||||
var table=d3.select(str);
|
||||
|
|
@ -102,7 +104,8 @@ function maketable(str, arr)
|
|||
|
||||
|
||||
if(row[column] != null) {
|
||||
ret.value = row[column].toFixed(0) + " minutes ago";
|
||||
var b = moment.duration(-row[column], 'm');
|
||||
ret.value = b.humanize(true);
|
||||
}
|
||||
else
|
||||
ret.value="";
|
||||
|
|
@ -150,11 +153,8 @@ function maketable(str, arr)
|
|||
}
|
||||
|
||||
else if(column == "last-seen-s") {
|
||||
var seconds = row[column].toFixed(0);
|
||||
if(seconds < 30)
|
||||
ret.value = "a few seconds ago";
|
||||
else
|
||||
ret.value = (seconds/60) + " minutes ago";
|
||||
var b = moment.duration(row[column], 's');
|
||||
ret.value = b.humanize();
|
||||
}
|
||||
else if(column == "best-tle") {
|
||||
ret.value = "<small>"+row[column]+"</small>";
|
||||
|
|
@ -351,14 +351,9 @@ function update()
|
|||
str += ", "+d["leap-seconds"]+"</b> leap seconds (GPS/Galileo)";
|
||||
|
||||
d3.select('#facts').html(str);
|
||||
var ageSeconds = (Date.now() - 1000*d["last-seen"])/1000;
|
||||
var ageString;
|
||||
if(ageSeconds < 60)
|
||||
ageString = "a few seconds ago";
|
||||
else
|
||||
ageString = (ageSeconds/60).toFixed(0) +" minutes ago";
|
||||
|
||||
d3.select("#freshness").html(ageString);
|
||||
lastseen = moment(1000*d["last-seen"]);
|
||||
d3.select("#freshness").html(lastseen.fromNow());
|
||||
|
||||
|
||||
str = d["total-live-receivers"]+" receivers active, tracking ";
|
||||
str += d["total-live-svs"] + " satellites via " ;
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 399 B |
|
Before Width: | Height: | Size: 399 B |
|
Before Width: | Height: | Size: 940 B |
|
Before Width: | Height: | Size: 297 B |
|
Before Width: | Height: | Size: 703 B |
|
Before Width: | Height: | Size: 332 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 499 B |
|
Before Width: | Height: | Size: 820 B |
|
|
@ -143,9 +143,6 @@ var Tooltip;
|
|||
|
||||
function create_tooltop()
|
||||
{
|
||||
if (Tooltip) {
|
||||
return;
|
||||
}
|
||||
// create a tooltip
|
||||
Tooltip = d3.select("#combined")
|
||||
.append("span")
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
</head>
|
||||
<body>
|
||||
Last update: <span id="freshness"></span>. More information about this Galileo/GPS/BeiDou/Glonass open source monitor can be found <a href="https://berthub.eu/articles/posts/galmon-project/">here</a>. Live observer map <a href="geo">here</a>, status (coverage, DOP) map <a href="geo/coverage.html">here</a>. <b><strike>Experimental Grafana dashboard on <a href="https://public.galmon.eu/">public.galmon.eu</a> (user: guest, password: guest)</strike></b>. SBAS <a href="sbas.html">status</a>, <a href="sbstatus.html">per-satellite</a>. <a rel="me" href="https://bot.country/@GNSS_Changes">Mastodon</a>. <span id="allstats"></span><br/>
|
||||
Last update: <span id="freshness"></span>. More information about this Galileo/GPS/BeiDou/Glonass open source monitor can be found <a href="https://berthub.eu/articles/posts/galmon-project/">here</a>. Live observer map <a href="geo">here</a>, status (coverage, DOP) map <a href="geo/coverage.html">here</a>. <b>Experimental Grafana dashboard on <a href="https://public.galmon.eu/">public.galmon.eu</a> (user: guest, password: guest)</b>. SBAS <a href="sbas.html">status</a>, <a href="sbstatus.html">per-satellite</a>. <span id="allstats"></span><br/>
|
||||
<div class="centered">
|
||||
<hr/>
|
||||
<input type="checkbox" id="GalE1" onclick="updateSats();"> <label for="GalE1">Galileo E1</label>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
<input type="checkbox" id="GPSL2C" onclick="updateSats();"> <label for="GPSL2C">GPS L2C</label>
|
||||
</div>
|
||||
<hr/>
|
||||
|
||||
<a rel="me" href="https://bot.country/@GNSS_Changes">Mastodon</a>
|
||||
<table id="svs"></table>
|
||||
<hr>
|
||||
<p>
|
||||
|
|
@ -75,9 +75,10 @@
|
|||
Information on the status of BeiDou can be found on <a href="http://www.csno-tarc.cn/system/constellation&ce=english">this page</a> from the Chinese Test and Assessment Research Center of China Satellite Navigation Office.
|
||||
</p>
|
||||
<p>
|
||||
Feedback is very welcome on bert@hubertnet.nl or via Mastodon <a href="https://eupolicy.social/@bert_hubert">@bert_hubert@eupolicy.social</a>.
|
||||
Feedback is very welcome on bert@hubertnet.nl or <a href="https://twitter.com/bert_hu_bert">@bert_hu_bert</a>.
|
||||
</p>
|
||||
<script src="d3.v4.min.js"></script>
|
||||
<script src="ext/moment-with-locales.js"></script>
|
||||
<script src="doalles.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
37
html/sbas.js
|
|
@ -56,11 +56,11 @@ function maketable(str, arr)
|
|||
var img="";
|
||||
var sv = row["sv"];
|
||||
var sbas="";
|
||||
if(sv == 138 || sv == 131 || sv == 133 || sv == 135) {
|
||||
if(sv == 138 || sv == 131 || sv == 133) {
|
||||
img = 'ext/gps.png';
|
||||
sbas = "WAAS";
|
||||
}
|
||||
else if(sv == 136 || sv == 123 || sv == 121 || sv == 150) {
|
||||
else if(sv== 126 || sv == 136 || sv == 123 ) {
|
||||
img='ext/gal.png';
|
||||
sbas = "EGNOS";
|
||||
}
|
||||
|
|
@ -68,41 +68,10 @@ function maketable(str, arr)
|
|||
img='ext/glo.png';
|
||||
sbas = "SDCM";
|
||||
}
|
||||
else if(sv == 127 || sv == 128 || sv == 132) {
|
||||
else if(sv == 127 || sv == 128 || sv == 138) {
|
||||
img='ext/gagan.png';
|
||||
sbas ="GAGAN";
|
||||
}
|
||||
else if(sv == 129 || sv == 137 || sv == 139) {
|
||||
img='ext/msas.png';
|
||||
sbas ="MSAS";
|
||||
}
|
||||
else if(sv == 130 || sv == 143 || sv == 144) {
|
||||
img='ext/bei.png';
|
||||
sbas ="BDSBAS";
|
||||
}
|
||||
else if(sv == 120 || sv == 147) {
|
||||
img='ext/asecna.png';
|
||||
sbas ="ASECNA";
|
||||
}
|
||||
else if(sv == 122 || sv == 124) {
|
||||
img='ext/span.png';
|
||||
sbas ="SPAN";
|
||||
}
|
||||
else if(sv == 134 || sv == 142) {
|
||||
img='ext/kass.png';
|
||||
sbas ="KASS";
|
||||
}
|
||||
else if(sv == 148) {
|
||||
img='ext/asbas.png';
|
||||
sbas ="A-SBAS";
|
||||
}
|
||||
else if(sv == 158) {
|
||||
img='ext/uksbas.png';
|
||||
sbas ="UK SBAS";
|
||||
}
|
||||
else if(sv == 145) {
|
||||
sbas ="Pak-SBAS";
|
||||
}
|
||||
|
||||
ret.value = sbas + " ";
|
||||
if(img != "")
|
||||
|
|
|
|||
|
|
@ -6,12 +6,16 @@
|
|||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
Last update: <span id="freshness"></span>. More information about this Galileo/GPS/BeiDou/Glonass open source monitor can be found <a href="https://github.com/ahupowerdns/galmon/blob/master/README.md#galmon">here</a>. Live map <a href="geo">here!</a>. <br/>
|
||||
Last update: <span id="freshness"></span>. More information about this Galileo/GPS/BeiDou/Glonass open source monitor can be found <a href="https://github.com/ahupowerdns/galmon/blob/master/README.md#galmon">here</a>. Live map <a href="geo">here!</a>. Contact <a href="https://berthub.eu/">me</a> if you want access to the Grafana dashboard.<br/>
|
||||
<table id="galileo"></table>
|
||||
<p>
|
||||
This table shows live output from four Galileo/GPS/BeiDou/GLONASS receivers hosted in Nootdorp, The Netherlands and California, United States.
|
||||
It is very much a work in progress, and will not be available at all times. Extremely rough code is on
|
||||
<a href="https://github.com/ahuPowerDNS/galmon">GitHub</a>.
|
||||
|
||||
Some technical detail behind this setup can be found in <a href="https://berthub.eu/articles/posts/galileo-notes/">this post</a>.
|
||||
|
||||
For updates, follow <a href="https://eupolicy.social/@bert_hubert">@bert_hubert@eupolicy.social</a> on Mastodon, or join us on our IRC channel (chat) via the
|
||||
For updates, follow <a href="https://twitter.com/GalileoSats">@GalileoSats</a> on Twitter, or join us on our IRC channel (chat) via the
|
||||
<a href="https://webchat.oftc.net/?channels=galileo">web gateway</a>.
|
||||
|
||||
<script src="d3.v4.min.js"></script>
|
||||
|
|
|
|||
167
navparse.cc
|
|
@ -11,6 +11,7 @@
|
|||
#include <thread>
|
||||
#include <signal.h>
|
||||
#include <mutex>
|
||||
#include "ext/powerblog/h2o-pp.hh"
|
||||
#include "minicurl.hh"
|
||||
#include <time.h>
|
||||
#include "ubx.hh"
|
||||
|
|
@ -22,7 +23,6 @@
|
|||
#include "glonass.hh"
|
||||
#include "beidou.hh"
|
||||
#include "galileo.hh"
|
||||
#include "httplib.h"
|
||||
#include "tle.hh"
|
||||
#include <optional>
|
||||
#include "navmon.hh"
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
#include "influxpush.hh"
|
||||
#include "sbas.hh"
|
||||
#include <sys/resource.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "CLI/CLI.hpp"
|
||||
#include "gpscnav.hh"
|
||||
#include "rtcm.hh"
|
||||
|
|
@ -448,10 +448,15 @@ std::string humanBhs(int bhs)
|
|||
return options.at(bhs);
|
||||
}
|
||||
|
||||
void addHeaders(httplib::Response& res)
|
||||
void addHeaders(h2o_req_t* req)
|
||||
{
|
||||
res.set_header("Cache-Control", "max-age=3");
|
||||
res.set_header("Access-Control-Allow-Origin", "*");
|
||||
h2o_add_header(&req->pool, &req->res.headers, H2O_TOKEN_CACHE_CONTROL,
|
||||
NULL, H2O_STRLIT("max-age=3"));
|
||||
|
||||
// Access-Control-Allow-Origin
|
||||
h2o_add_header(&req->pool, &req->res.headers, H2O_TOKEN_ACCESS_CONTROL_ALLOW_ORIGIN,
|
||||
NULL, H2O_STRLIT("*"));
|
||||
|
||||
}
|
||||
|
||||
time_t getSatelliteUTC(svstats_t& svstats)
|
||||
|
|
@ -673,16 +678,10 @@ try
|
|||
InfluxPusher idb(influxDBName);
|
||||
MiniCurl::init();
|
||||
|
||||
httplib::Server svr;
|
||||
svr.set_socket_options([](socket_t sock) {
|
||||
int yes = 1;
|
||||
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
reinterpret_cast<const void *>(&yes), sizeof(yes));
|
||||
});
|
||||
|
||||
H2OWebserver h2s("galmon");
|
||||
|
||||
svr.Get("/global.json", [](const auto& req, auto& res) {
|
||||
addHeaders(res);
|
||||
h2s.addHandler("/global.json", [](auto handler, auto req) {
|
||||
addHeaders(req);
|
||||
|
||||
nlohmann::json ret = nlohmann::json::object();
|
||||
auto svstats = g_statskeeper.get();
|
||||
|
|
@ -744,11 +743,12 @@ try
|
|||
ret["galileo-sigs"] = siggnsscount[2];
|
||||
ret["beidou-sigs"] = siggnsscount[3];
|
||||
ret["glonass-sigs"] = siggnsscount[6];
|
||||
res.set_content(ret.dump(), "application/json");
|
||||
});
|
||||
|
||||
svr.Get("/almanac.json", [](const auto& req, auto& res) {
|
||||
addHeaders(res);
|
||||
return ret;
|
||||
});
|
||||
|
||||
h2s.addHandler("/almanac.json", [](auto handler, auto req) {
|
||||
addHeaders(req);
|
||||
|
||||
auto beidoualma = g_beidoualmakeeper.get();
|
||||
auto svstats = g_statskeeper.get();
|
||||
|
|
@ -972,11 +972,12 @@ try
|
|||
item["name"]=name;
|
||||
ret[name] = item;
|
||||
}
|
||||
res.set_content(ret.dump(), "application/json");
|
||||
|
||||
return ret;
|
||||
});
|
||||
|
||||
svr.Get("/observers.json", [](const auto& req, auto& res) {
|
||||
addHeaders(res);
|
||||
h2s.addHandler("/observers.json", [](auto handler, auto req) {
|
||||
addHeaders(req);
|
||||
|
||||
nlohmann::json ret = nlohmann::json::array();
|
||||
for(const auto& src : g_srcfacts) {
|
||||
|
|
@ -1068,22 +1069,32 @@ try
|
|||
|
||||
ret.push_back(obj);
|
||||
}
|
||||
res.set_content(ret.dump(), "application/json");
|
||||
return ret;
|
||||
});
|
||||
|
||||
svr.Get("/sv.json", [](const auto& req, auto& res) {
|
||||
addHeaders(res);
|
||||
h2s.addHandler("/sv.json", [](auto handler, auto req) {
|
||||
addHeaders(req);
|
||||
string_view path = convert(req->path);
|
||||
nlohmann::json ret = nlohmann::json::object();
|
||||
|
||||
SatID id;
|
||||
id.sv = atoi(req.get_param_value("sv").c_str());
|
||||
id.gnss = atoi(req.get_param_value("gnssid").c_str());
|
||||
string psigid = req.get_param_value("sigid");
|
||||
if(!psigid.empty())
|
||||
id.sigid = atoi(psigid.c_str());
|
||||
else
|
||||
id.sigid =1 ;
|
||||
auto pos = path.find("sv=");
|
||||
if(pos == string::npos) {
|
||||
return ret;
|
||||
}
|
||||
id.sv = atoi(&path[0] + pos+3);
|
||||
|
||||
pos = path.find("gnssid=");
|
||||
if(pos == string::npos) {
|
||||
return ret;
|
||||
}
|
||||
id.gnss = atoi(&path[0]+pos+7);
|
||||
|
||||
id.sigid = 1;
|
||||
pos = path.find("sigid=");
|
||||
if(pos != string::npos) {
|
||||
id.sigid = atoi(&path[0]+pos+6);
|
||||
}
|
||||
|
||||
auto svstats = g_statskeeper.get();
|
||||
|
||||
|
|
@ -1091,10 +1102,8 @@ try
|
|||
ret["gnssid"] =id.gnss;
|
||||
ret["sigid"] = id.sigid;
|
||||
auto iter = svstats.find(id);
|
||||
if(iter == svstats.end()) {
|
||||
res.set_content(ret.dump(), "application/json");
|
||||
return;
|
||||
}
|
||||
if(iter == svstats.end())
|
||||
return ret;
|
||||
const auto& s= iter->second;
|
||||
// XXX CONVERSION
|
||||
/*
|
||||
|
|
@ -1225,24 +1234,37 @@ try
|
|||
|
||||
}
|
||||
ret["recvs"]=recvs;
|
||||
res.set_content(ret.dump(), "application/json");
|
||||
return ret;
|
||||
}
|
||||
);
|
||||
|
||||
svr.Get("/cov.json", [](const auto& req, auto& res) {
|
||||
addHeaders(res);
|
||||
h2s.addHandler("/cov.json", [](auto handler, auto req) {
|
||||
addHeaders(req);
|
||||
vector<Point> sats;
|
||||
auto galileoalma = g_galileoalmakeeper.get();
|
||||
auto gpsalma = g_gpsalmakeeper.get();
|
||||
auto beidoualma = g_beidoualmakeeper.get();
|
||||
auto svstats = g_statskeeper.get();
|
||||
// cout<<"pseudoTow "<<pseudoTow<<endl;
|
||||
string_view path = convert(req->path);
|
||||
|
||||
bool doGalileo{true}, doGPS{false}, doBeidou{false}, doGlonass{false};
|
||||
doGPS = req.get_param_value("gps") == "1";
|
||||
doGalileo = req.get_param_value("galileo") == "1";
|
||||
doBeidou = req.get_param_value("beidou") == "1";
|
||||
doGlonass = req.get_param_value("glonass") == "1";
|
||||
auto pos = path.find("gps=");
|
||||
if(pos != string::npos) {
|
||||
doGPS = (path[pos+4]=='1');
|
||||
}
|
||||
pos = path.find("galileo=");
|
||||
if(pos != string::npos) {
|
||||
doGalileo = (path[pos+8]=='1');
|
||||
}
|
||||
pos = path.find("beidou=");
|
||||
if(pos != string::npos) {
|
||||
doBeidou = (path[pos+7]=='1');
|
||||
}
|
||||
pos = path.find("glonass=");
|
||||
if(pos != string::npos) {
|
||||
doGlonass = (path[pos+8]=='1');
|
||||
}
|
||||
|
||||
if(doGalileo)
|
||||
for(const auto &g : galileoalma) {
|
||||
|
|
@ -1349,14 +1371,21 @@ try
|
|||
|
||||
ret.push_back(jslatvect);
|
||||
}
|
||||
res.set_content(ret.dump(), "application/json");
|
||||
return ret;
|
||||
});
|
||||
|
||||
svr.Get("/sbas.json", [](const auto& req, auto& res) {
|
||||
addHeaders(res);
|
||||
h2s.addHandler("/sbas.json", [](auto handler, auto req) {
|
||||
addHeaders(req);
|
||||
auto svstats = g_statskeeper.get();
|
||||
auto sbas = g_sbaskeeper.get();
|
||||
nlohmann::json ret = nlohmann::json::object();
|
||||
h2o_add_header(&req->pool, &req->res.headers, H2O_TOKEN_CACHE_CONTROL,
|
||||
NULL, H2O_STRLIT("max-age=3"));
|
||||
|
||||
// Access-Control-Allow-Origin
|
||||
h2o_add_header(&req->pool, &req->res.headers, H2O_TOKEN_ACCESS_CONTROL_ALLOW_ORIGIN,
|
||||
NULL, H2O_STRLIT("*"));
|
||||
|
||||
|
||||
for(const auto& s: sbas) {
|
||||
nlohmann::json item = nlohmann::json::object();
|
||||
|
|
@ -1381,13 +1410,21 @@ try
|
|||
|
||||
ret[to_string(s.first)]=item;
|
||||
}
|
||||
res.set_content(ret.dump(), "application/json");
|
||||
return ret;
|
||||
});
|
||||
|
||||
svr.Get("/svs.json", [](const auto& req, auto& res) {
|
||||
addHeaders(res);
|
||||
h2s.addHandler("/svs.json", [](auto handler, auto req) {
|
||||
addHeaders(req);
|
||||
auto svstats = g_statskeeper.get();
|
||||
nlohmann::json ret = nlohmann::json::object();
|
||||
h2o_add_header(&req->pool, &req->res.headers, H2O_TOKEN_CACHE_CONTROL,
|
||||
NULL, H2O_STRLIT("max-age=3"));
|
||||
|
||||
// Access-Control-Allow-Origin
|
||||
h2o_add_header(&req->pool, &req->res.headers, H2O_TOKEN_ACCESS_CONTROL_ALLOW_ORIGIN,
|
||||
NULL, H2O_STRLIT("*"));
|
||||
|
||||
|
||||
for(const auto& s: svstats) {
|
||||
nlohmann::json item = nlohmann::json::object();
|
||||
if(!s.second.tow()) // I know, I know, will suck briefly
|
||||
|
|
@ -1674,12 +1711,19 @@ try
|
|||
item["name"] = makeSatPartialName(s.first);
|
||||
ret[makeSatIDName(s.first)] = item;
|
||||
}
|
||||
res.set_content(ret.dump(), "application/json");
|
||||
return ret;
|
||||
});
|
||||
|
||||
svr.Get("/sbstatus.json", [](const auto& req, auto& res) {
|
||||
addHeaders(res);
|
||||
h2s.addHandler("/sbstatus.json", [](auto handler, auto req) {
|
||||
addHeaders(req);
|
||||
auto svstats = g_statskeeper.get();
|
||||
h2o_add_header(&req->pool, &req->res.headers, H2O_TOKEN_CACHE_CONTROL,
|
||||
NULL, H2O_STRLIT("max-age=3"));
|
||||
|
||||
// Access-Control-Allow-Origin
|
||||
h2o_add_header(&req->pool, &req->res.headers, H2O_TOKEN_ACCESS_CONTROL_ALLOW_ORIGIN,
|
||||
NULL, H2O_STRLIT("*"));
|
||||
|
||||
auto ret = nlohmann::json::array();
|
||||
|
||||
time_t now = time(0);
|
||||
|
|
@ -1756,19 +1800,20 @@ try
|
|||
ret.push_back(obj);
|
||||
}
|
||||
}
|
||||
res.set_content(ret.dump(), "application/json");
|
||||
});
|
||||
return ret;
|
||||
});
|
||||
|
||||
|
||||
svr.set_mount_point("/", htmlDir);
|
||||
|
||||
h2s.addDirectory("/", htmlDir);
|
||||
|
||||
const char *address = localAddress.c_str();
|
||||
std::thread ws([&svr, address]() {
|
||||
ComboAddress listenOn(address, 29599);
|
||||
fmt::print("Launching webserver on {}..\n", listenOn.toStringWithPort());
|
||||
svr.listen(listenOn.toString(), ntohs(listenOn.sin4.sin_port));
|
||||
fmt::print("Exiting - {}\n", strerror(errno));
|
||||
});
|
||||
std::thread ws([&h2s, address]() {
|
||||
auto actx = h2s.addContext();
|
||||
ComboAddress listenOn(address);
|
||||
h2s.addListener(listenOn, actx);
|
||||
cout<<"Listening on "<< listenOn.toStringWithPort() <<endl;
|
||||
h2s.runLoop();
|
||||
});
|
||||
ws.detach();
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include <nlohmann/json.hpp>
|
||||
#include "ext/powerblog/h2o-pp.hh"
|
||||
#include "minicurl.hh"
|
||||
#include <iostream>
|
||||
#include "navmon.hh"
|
||||
|
|
@ -534,7 +534,7 @@ try
|
|||
|
||||
// cout<<" z-error: "<<dir.inner(v);
|
||||
|
||||
csv << e.first << " " << id.gnss <<" " << id.sv << " " << id.sigid <<" " << dir.inner(v) << " " << clkoffset << endl;
|
||||
csv << e.first << " " << id.gnss <<" " << id.sv << " " << id.sigid <<" " << dir.inner(v) << endl;
|
||||
idb.addValue({{"gnssid", id.gnss}, {"sv", id.sv}, {"sp3src", sp3src}},
|
||||
"sp3delta",
|
||||
{{"ecef-dx", v.x}, {"ecef-dy", v.y}, {"ecef-dz", v.z}, {"sv-dz", dir.inner(v)}, {"dclock", clkoffset},
|
||||
|
|
|
|||
|
|
@ -806,7 +806,8 @@ int main(int argc, char** argv)
|
|||
|
||||
0x22,0x00,0x31,0x10, doBeidou,
|
||||
0x0d,0x00,0x31,0x10, doBeidou,
|
||||
0x0e,0x00,0x31,0x10, doBeidou,
|
||||
0x0f,0x00,0x31,0x10, doBeidou,
|
||||
0x28,0x00,0x31,0x10, doBeidou,
|
||||
|
||||
0x25,0x00,0x31,0x10, doGlonass,
|
||||
0x18,0x00,0x31,0x10, doGlonass,
|
||||
|
|
|
|||