43extern int satsys(
int sat,
int* prn);
44extern void satno2id(
int sat,
char*
id);
45extern int satno(
int sys,
int prn);
55#define MIONO_MAX_FRAME 40
60#define MIONO_MAX_SYS 5
61#define MIONO_SYS_GPS 0
62#define MIONO_SYS_GLO 1
63#define MIONO_SYS_GAL 2
64#define MIONO_SYS_BDS 3
65#define MIONO_SYS_QZS 4
67#define MIONO_INVALID_14BIT -8192
68#define MIONO_INVALID_12BIT -2048
69#define MIONO_INVALID_10BIT -512
70#define MIONO_INVALID_8BIT -128
72#define SQR(x) ((x) * (x))
115 if (tow < tow_p - 302400.0) {
117 }
else if (tow > tow_p + 302400.0) {
125 int j, ep, udi, sync, iod, ralert, corlen, narea, anum, ref[2], span[2];
144 trace(NULL, 4,
"decode_miono_coverage: head ep=%d,udi=%d,sync=%d,iod=%d,rid=%d,ralert=%d,corlen=%d,narea=%d\n", ep,
145 udi, sync, iod, *rid, ralert, corlen, narea);
150 mi->
tow0 = ep / 3600 * 3600;
158 for (j = 0; j < narea; j++) {
172 re->
area[anum].
ref[0] = ref[0] * 0.1;
173 re->
area[anum].
ref[1] = ref[1] * 0.1;
174 re->
area[anum].
span[0] = span[0] * 0.1;
175 re->
area[anum].
span[1] = span[1] * 0.1;
184 re->
area[anum].
ref[0] = ref[0] * 0.01;
185 re->
area[anum].
ref[1] = ref[1] * 0.01;
186 re->
area[anum].
span[0] = span[0] * 10.0;
190 "decode_miono_coverage: data "
191 "%s,i=%4d,rid=%3d,j=%2d,anum=%2d,sid=%d,ref=%5d,%5d,%7.2f,%7.2f,span=%4d,%4d,%6.1f,%6.1f\n",
192 time_str(mi->
gt, 3), i, *rid, j, anum, re->
area[anum].
sid, ref[0], ref[1], re->
area[anum].
ref[0],
201 int j, k, l, ep, udi, sync, iod, rid, anum, type;
225 trace(NULL, 2,
"decode_miono_correction: %s,unprocessed coverage\n",
time_str(mi->
gt, 3));
232 if (mi->
iod != iod) {
233 trace(NULL, 2,
"decode_miono_correction: %s,iod mismatch %d != %d\n",
time_str(mi->
gt, 3), mi->
iod, iod);
244 "decode_miono_correction: head ep=%d,udi=%d,sync=%d,iod=%d,rid=%d,anum=%d,type=%d,ns=%d,%d,%d,%d,%d\n", ep,
245 udi, sync, iod, rid, anum, type, ns[0], ns[1], ns[2], ns[3], ns[4]);
248 for (k = 0; k < ns[j]; k++) {
249 for (l = 1; l < 6; l++) {
280 "decode_miono_correction: data "
281 "%s,i=%4d,rid=%3d,anum=%2d,type=%d,j=%d,k=%2d,sat=%2d,%3s,sqi=0x%02X,coef=%5d,%5d,%5d,%4d,%4d,%4d,%7."
282 "2f,%7.2f,%7.2f,%7.2f,%8.3f,%8.3f\n",
283 time_str(mi->
gt, 3), i, rid, anum, type, j, k,
id, satid, sqi, coef[0], coef[1], coef[2], coef[3],
284 coef[4], coef[5], coef[0] * 0.05, coef[1] * 0.02, coef[2] * 0.02, coef[3] * 0.02, coef[4] * 0.005,
300 re->
area[anum].
sat[sat - 1].
coef[0] = coef[0] * 0.05;
301 re->
area[anum].
sat[sat - 1].
coef[1] = coef[1] * 0.02;
302 re->
area[anum].
sat[sat - 1].
coef[2] = coef[2] * 0.02;
303 re->
area[anum].
sat[sat - 1].
coef[3] = coef[3] * 0.02;
304 re->
area[anum].
sat[sat - 1].
coef[4] = coef[4] * 0.005;
305 re->
area[anum].
sat[sat - 1].
coef[5] = coef[5] * 0.005;
323 unsigned int preamb, prn, type, alert, vid, mgfid, csid, anme, si;
326 int i = 0, j, imax, n, ibuff, mn, apply, ret, optprn;
329 unsigned int corlen, narea;
353 trace(NULL, 3,
"decode_qzss_l6dmsg: invalid prn=%d\n", prn);
358 "decode_qzss_l6dmsg: %s,preamb=0x%08X,prn=%d,type=0x%X(vid=%d,mgfid=%d,csid=%d,anme=%d,si=%d),alert=%d\n",
359 time_str(
_miono[j].gt, 3), preamb, prn, type, vid, mgfid, csid, anme, si, alert);
362 trace(NULL, 2,
"decode_qzss_l6dmsg: %s,invalid preamb=0x%08X\n",
time_str(
_miono[j].gt, 3), preamb);
367 if (strstr(
mdcl6d->opt,
"-IGNORE_MIONO_ALERT")) {
368 trace(NULL, 3,
"decode_qzss_l6dmsg: ignore alert\n");
370 trace(NULL, 2,
"decode_qzss_l6dmsg: alert\n");
379 if ((str = strstr(
mdcl6d->opt,
"-MIONO_PRN"))) {
380 optprn = atoi(strstr(str,
"=") + 1);
381 if (optprn != (
int)prn) {
382 trace(NULL, 3,
"decode_qzss_l6dmsg: -MIONO_PRN=%d\n", optprn);
392 if (
_miono[j].maxframe <= 0) {
399 trace(NULL, 3,
"decode_qzss_l6dmsg: %s,mn=%d,maxframe=%d,corlen=%d,narea=%d\n",
time_str(
_miono[j].gt, 3),
400 mn,
_miono[j].maxframe, corlen, narea);
413 switch (
_miono[j].frame % 8) {
415 ibuff = 0 +
_miono[j].frame / 8;
420 ibuff = 211 +
_miono[j].frame / 8;
425 ibuff = 423 +
_miono[j].frame / 8;
430 ibuff = 635 +
_miono[j].frame / 8;
435 ibuff = 847 +
_miono[j].frame / 8;
440 ibuff = 1059 +
_miono[j].frame / 8;
445 ibuff = 1271 +
_miono[j].frame / 8;
450 ibuff = 1483 +
_miono[j].frame / 8;
462 _miono[j].buff[ibuff - 1] &= mask;
476 if (
_miono[j].mgfid != (
int)mgfid) {
477 trace(NULL, 2,
"decode_qzss_l6dmsg: %s,mgfid switched %d -> %d\n",
time_str(
_miono[j].gt, 3),
483 trace(NULL, 5,
"decode_qzss_l6dmsg: i=%d,imax=%d,corlen=%d\n", i, imax, corlen);
487 if ((
_miono[j].mgfid & 0x1) != ((
int)mgfid & 0x1)) {
488 trace(NULL, 2,
"decode_qzss_l6dmsg: %s,mgfid mismatch %d != %d\n",
time_str(
_miono[j].gt, 3),
494 trace(NULL, 2,
"decode_qzss_l6dmsg: invalid mn=%d\n", mn);
533 trace(NULL, 5,
"input_qzssl6d: data=0x%02X,%d\n", data,
mdcl6d->nbyte);
536 if ((
mdcl6d->nbyte == 0) && (data != 0x1A)) {
538 }
else if (((
mdcl6d->nbyte == 1) && (data != 0xCF)) || ((
mdcl6d->nbyte == 2) && (data != 0xFC)) ||
539 ((
mdcl6d->nbyte == 3) && (data != 0x1D))) {
565 trace(NULL, 4,
"input_qzssl6df\n");
567 for (i = 0; i < 4096; i++) {
568 if ((data = fgetc(fp)) == EOF) {
uint32_t getbitu(const uint8_t *buff, int pos, int len)
Extract unsigned bits from byte data.
int32_t getbits(const uint8_t *buff, int pos, int len)
Extract signed bits from byte data.
MRTKLIB Bits Module — Binary bit operations and CRC functions.
MRTKLIB Constants — Physical, navigation, and system constants.
const l6_prn_info_t * l6_prn_info(int prn)
Look up the auxiliary information of an L6 PRN.
int l6_parse_header(const uint8_t *frame, l6_header_t *h)
Parse the header of one L6 frame and classify its service.
MRTKLIB L6 Module — QZSS L6 frame header parsing.
void satno2id(int sat, char *id)
int satsys(int sat, int *prn)
static void adjweek(gtime_t *gt, double tow)
gtime_t gpst2time(int week, double sec)
int satno(int sys, int prn)
void init_miono(const gtime_t gt)
Initialize MADOCA-PPP L6D ionospheric correction control.
static int gnssid2sys(int gnssid)
static int decode_miono_coverage(miono_t *mi, miono_region_t *re, int i, int *imax, int *rid)
#define MIONO_INVALID_12BIT
int decode_qzss_l6dmsg(mdcl6d_t *mdcl6d)
Decode QZSS L6D message.
static int decode_miono_correction(miono_t *mi, miono_region_t *re, int i, int apply)
double timediff(gtime_t t1, gtime_t t2)
double time2gpst(gtime_t t, int *week)
#define MIONO_INVALID_14BIT
int input_qzssl6d(mdcl6d_t *mdcl6d, const uint8_t data)
Input QZSS L6D message byte-by-byte.
#define MIONO_INVALID_10BIT
int input_qzssl6df(mdcl6d_t *mdcl6d, FILE *fp)
Input QZSS L6D message from file.
char * time_str(gtime_t t, int n)
static miono_t _miono[MIONO_MAX_PRN]
#define MIONO_INVALID_8BIT
gtime_t utc2gpst(gtime_t t)
MRTKLIB Navigation Module — Navigation data types and satellite/nav utility functions.
static mdcl6d_t mdcl6d[MIONO_MAX_PRN]
MRTKLIB Precise Point Positioning (PPP) Module.
void trace(mrtk_ctx_t *ctx, int level, const char *format,...)
Output trace message.
MRTKLIB Trace Module — debug trace and logging functions.
GNSS time representation.
Auxiliary per-PRN information for one L6 PRN.
QZSS L6D message control struct.
miono_area_t area[MIONO_MAX_ANUM]
uint8_t buff[L6_FRAME_LEN *40]