implement SAR messages in ubxtool

sarsend
bert hubert 2020-07-03 19:56:04 +01:00
parent a3debb152c
commit f5cae429ff
3 changed files with 27 additions and 22 deletions

View File

@ -1,6 +1,6 @@
CFLAGS = -O3 -Wall -ggdb
CXXFLAGS:= -std=gnu++17 -Wall -O2 -ggdb -MMD -MP -fno-omit-frame-pointer -Iext/CLI11 \
CXXFLAGS:= -std=gnu++17 -Wall -O0 -ggdb -MMD -MP -fno-omit-frame-pointer -Iext/CLI11 \
-Iext/fmt-6.1.2/include/ -Iext/powerblog/ext/simplesocket -Iext/powerblog/ext/ \
-I/usr/local/opt/openssl/include/ \
-Iext/sgp4/libsgp4/ \

View File

@ -1128,6 +1128,18 @@ try
}
cout<<endl;
}
else if(nmm.type() == NavMonMessage::SARResponseType) {
etstamp();
string hexstring;
string id = nmm.sr().identifier();
for(int n = 0; n < 15; ++n)
hexstring+=fmt::sprintf("%x", (int)getbitu((unsigned char*)id.c_str(), 4 + 4*n, 4));
cout<<" SAR RLM type "<< nmm.sr().type() <<" from gal sv ";
cout<< nmm.sr().gnsssv() << " beacon "<<hexstring <<" code "<<(int)nmm.sr().code()<<" params "<< makeHexDump(nmm.sr().params()) <<endl;
}
else {
etstamp();
cout<<"Unknown type "<< (int)nmm.type()<<endl;

View File

@ -1564,8 +1564,6 @@ int main(int argc, char** argv)
}
}
else if(msg.getClass() == 0x02 && msg.getType() == 0x59) { // UBX-RXM-RLM
int type = (int)payload[1];
int sv = (int)payload[2];
NavMonMessage nmm;
nmm.set_sourceid(g_srcid);
@ -1573,34 +1571,29 @@ int main(int argc, char** argv)
nmm.set_localutcnanoseconds(g_gnssutc.tv_nsec);
nmm.set_type(NavMonMessage::SARResponseType);
// short version:
// 0 1 2 3 4 - 11 12 13,14 15
// version, type, sv, reserved beacon id msg-code param res2
// long version:
// 0 1 2 3 4 - 11 12 13-24 25
// version, type, sv, reserved beacon id msg-code params res2
nmm.mutable_sr()->set_gnssid(2); // Galileo only for now
nmm.mutable_sr()->set_gnsssv(sv);
nmm.mutable_sr()->set_sigid(0); // we should fill this in later
nmm.mutable_sr()->set_gnsssv(payload[2]);
nmm.mutable_sr()->set_sigid(1); //
nmm.mutable_sr()->set_type(payload[1]);
nmm.mutable_sr()->set_identifier(string((char*)payload.c_str()+4, 8));
nmm.mutable_sr()->set_code(payload[12]);
nmm.mutable_sr()->set_params(string((char*)payload.c_str()+13, payload.size()-14));
string hexstring;
for(int n = 0; n < 15; ++n)
for(int n = 0; n < 15; ++n)
hexstring+=fmt::sprintf("%x", (int)getbitu(payload.c_str(), 36 + 4*n, 4));
// if (doDEBUG) { cerr<<humanTimeNow()<<" "<<humanTime(g_gnssutc.tv_sec)<<" SAR RLM type "<<type<<" from gal sv " << sv << " beacon "<<hexstring <<" code "<<(int)payload[12]<<" params "<<payload[12] + 256*payload[13]<<endl; }
// wk.emitLine(sv, "SAR "+hexstring);
// cout<<"SAR: sv = "<< (int)msg[2] <<" ";
// for(int n=4; n < 12; ++n)
// fmt::printf("%02x", (int)msg[n]);
// for(int n = 0; n < 15; ++n)
// fmt::printf("%x", (int)getbitu(msg.c_str(), 36 + 4*n, 4));
// cout << " Type: "<< (int) msg[12] <<"\n";
// cout<<"Parameter: (len = "<<msg.length()<<") ";
// for(unsigned int n = 13; n < msg.length(); ++n)
// fmt::printf("%02x ", (int)msg[n]);
// cout<<"\n";
ns.emitNMM(nmm);
}
else if(msg.getClass()==39 && msg.getType()==0) {
NavMonMessage nmm;