add githash and receiver uptime to stream
parent
e795f29d8a
commit
869aaebfe0
5
Makefile
5
Makefile
|
@ -6,6 +6,9 @@ CXXFLAGS:= -std=gnu++17 -Wall -O3 -MMD -MP -ggdb -fno-omit-frame-pointer -Iext/C
|
||||||
|
|
||||||
# CXXFLAGS += -Wno-delete-non-virtual-dtor
|
# CXXFLAGS += -Wno-delete-non-virtual-dtor
|
||||||
|
|
||||||
|
|
||||||
|
CHEAT_ARG := $(shell ./update-git-hash-if-necessary)
|
||||||
|
|
||||||
PROGRAMS = navparse ubxtool navnexus navcat navrecv navdump testrunner navdisplay tlecatch reporter
|
PROGRAMS = navparse ubxtool navnexus navcat navrecv navdump testrunner navdisplay tlecatch reporter
|
||||||
|
|
||||||
all: navmon.pb.cc $(PROGRAMS)
|
all: navmon.pb.cc $(PROGRAMS)
|
||||||
|
@ -52,7 +55,7 @@ tlecatch: tlecatch.o $(patsubst %.cc,%.o,$(wildcard ext/sgp4/libsgp4/*.cc))
|
||||||
navmon.pb.cc: navmon.proto
|
navmon.pb.cc: navmon.proto
|
||||||
protoc --cpp_out=./ navmon.proto
|
protoc --cpp_out=./ navmon.proto
|
||||||
|
|
||||||
ubxtool: navmon.pb.o ubxtool.o ubx.o bits.o ext/fmt-5.2.1/src/format.o galileo.o gps.o beidou.o navmon.o ephemeris.o $(SIMPLESOCKETS) osen.o
|
ubxtool: navmon.pb.o ubxtool.o ubx.o bits.o ext/fmt-5.2.1/src/format.o galileo.o gps.o beidou.o navmon.o ephemeris.o $(SIMPLESOCKETS) osen.o githash.o
|
||||||
$(CXX) -std=gnu++17 $^ -o $@ -L/usr/local/lib -lprotobuf -pthread
|
$(CXX) -std=gnu++17 $^ -o $@ -L/usr/local/lib -lprotobuf -pthread
|
||||||
|
|
||||||
testrunner: navmon.pb.o testrunner.o ubx.o bits.o ext/fmt-5.2.1/src/format.o galileo.o gps.o beidou.o ephemeris.o sp3.o osen.o
|
testrunner: navmon.pb.o testrunner.o ubx.o bits.o ext/fmt-5.2.1/src/format.o galileo.o gps.o beidou.o ephemeris.o sp3.o osen.o
|
||||||
|
|
|
@ -139,6 +139,8 @@ message NavMonMessage {
|
||||||
optional double freqAccuracyPS = 9;
|
optional double freqAccuracyPS = 9;
|
||||||
optional string owner = 10;
|
optional string owner = 10;
|
||||||
optional string remark = 11;
|
optional string remark = 11;
|
||||||
|
optional string recvgithash = 12;
|
||||||
|
optional uint32 uptime = 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "comboaddress.hh"
|
#include "comboaddress.hh"
|
||||||
#include "swrappers.hh"
|
#include "swrappers.hh"
|
||||||
#include "sclasses.hh"
|
#include "sclasses.hh"
|
||||||
|
#include "githash.h"
|
||||||
|
|
||||||
bool doDEBUG{false};
|
bool doDEBUG{false};
|
||||||
bool doLOGFILE{false};
|
bool doLOGFILE{false};
|
||||||
|
@ -521,6 +522,7 @@ int initFD(const char* fname, bool doRTSCTS)
|
||||||
// ubxtool device srcid
|
// ubxtool device srcid
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
time_t starttime=time(0);
|
||||||
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
||||||
|
|
||||||
CLI::App app("ubxtool");
|
CLI::App app("ubxtool");
|
||||||
|
@ -1395,6 +1397,11 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
nmm.mutable_od()->set_owner(owner);
|
nmm.mutable_od()->set_owner(owner);
|
||||||
nmm.mutable_od()->set_remark(remark);
|
nmm.mutable_od()->set_remark(remark);
|
||||||
|
extern const char* g_gitHash;
|
||||||
|
nmm.mutable_od()->set_recvgithash(g_gitHash);
|
||||||
|
nmm.mutable_od()->set_uptime(time(0) - starttime);
|
||||||
|
|
||||||
|
|
||||||
ns.emitNMM( nmm);
|
ns.emitNMM( nmm);
|
||||||
}
|
}
|
||||||
else if(msg.getClass() == 0x02 && msg.getType() == 0x14) { // UBX-RXM-MEASX
|
else if(msg.getClass() == 0x02 && msg.getType() == 0x14) { // UBX-RXM-MEASX
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/sh
|
||||||
|
HASH=$(git describe --always --dirty=+ | tr -d '\n')
|
||||||
|
|
||||||
|
echo \#define GIT_HASH \"$HASH\" > githash.h.tmp
|
||||||
|
echo $HASH > githash
|
||||||
|
|
||||||
|
cmp -s githash.h githash.h.tmp > /dev/null
|
||||||
|
|
||||||
|
if [ "$?" -ne "0" ]
|
||||||
|
then
|
||||||
|
mv githash.h.tmp githash.h
|
||||||
|
echo updated githash.h
|
||||||
|
else
|
||||||
|
rm githash.h.tmp
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue