MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_rcv_ss2.c File Reference
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mrtklib/mrtk_bits.h"
#include "mrtklib/mrtk_eph.h"
#include "mrtklib/mrtk_mat.h"
#include "mrtklib/mrtk_nav.h"
#include "mrtklib/mrtk_obs.h"
#include "mrtklib/mrtk_rcvraw.h"
#include "mrtklib/mrtk_rtcm.h"
#include "mrtklib/mrtk_sys.h"
#include "mrtklib/mrtk_time.h"
#include "mrtklib/mrtk_trace.h"
Include dependency graph for mrtk_rcv_ss2.c:

Go to the source code of this file.

Macros

#define PI   3.1415926535897932 /* pi */
#define D2R   (PI / 180.0) /* deg to rad */
#define R2D   (180.0 / PI) /* rad to deg */
#define CLIGHT   299792458.0 /* speed of light (m/s) */
#define SC2RAD   3.1415926535898 /* semi-circle to radian (IS-GPS) */
#define SYS_NONE   0x00
#define SYS_GPS   0x01
#define SYS_SBS   0x02
#define SYS_GLO   0x04
#define SYS_GAL   0x08
#define SYS_QZS   0x10
#define SYS_CMP   0x20
#define SYS_IRN   0x40
#define TSYS_GPS   0
#define TSYS_UTC   1
#define TSYS_GLO   2
#define TSYS_GAL   3
#define TSYS_QZS   4
#define TSYS_CMP   5
#define TSYS_IRN   6
#define FREQ1   1.57542E9 /* L1/E1/B1C frequency (Hz) */
#define FREQ2   1.22760E9 /* L2 frequency (Hz) */
#define FREQ5   1.17645E9 /* L5/E5a/B2a frequency (Hz) */
#define FREQ6   1.27875E9 /* E6/L6 frequency (Hz) */
#define FREQ7   1.20714E9 /* E5b/B2I frequency (Hz) */
#define FREQ8   1.191795E9 /* E5ab/B2ab frequency (Hz) */
#define FREQ9   2.492028E9 /* S frequency (Hz) */
#define FREQ1_GLO   1.60200E9 /* GLONASS G1 base frequency (Hz) */
#define DFRQ1_GLO   0.56250E6 /* GLONASS G1 bias frequency (Hz/n) */
#define FREQ2_GLO   1.24600E9 /* GLONASS G2 base frequency (Hz) */
#define DFRQ2_GLO   0.43750E6 /* GLONASS G2 bias frequency (Hz/n) */
#define FREQ3_GLO   1.202025E9 /* GLONASS G3 frequency (Hz) */
#define FREQ1a_GLO   1.600995E9 /* GLONASS G1a frequency (Hz) */
#define FREQ2a_GLO   1.248060E9 /* GLONASS G2a frequency (Hz) */
#define FREQ1_CMP   1.561098E9 /* BDS B1I frequency (Hz) */
#define MINPRNGPS   1
#define MAXPRNGPS   32
#define MINPRNSBS   120
#define MAXPRNSBS   158
#define P2_5   0.03125
#define P2_6   0.015625
#define P2_11   4.882812500000000E-04
#define P2_15   3.051757812500000E-05
#define P2_17   7.629394531250000E-06
#define P2_19   1.907348632812500E-06
#define P2_20   9.536743164062500E-07
#define P2_21   4.768371582031250E-07
#define P2_23   1.192092895507810E-07
#define P2_24   5.960464477539063E-08
#define P2_27   7.450580596923828E-09
#define P2_29   1.862645149230957E-09
#define P2_30   9.313225746154785E-10
#define P2_31   4.656612873077393E-10
#define P2_32   2.328306436538696E-10
#define P2_33   1.164153218269348E-10
#define P2_34   5.820766091346740E-11
#define P2_35   2.910383045673370E-11
#define P2_38   3.637978807091710E-12
#define P2_40   9.094947017729280E-13
#define P2_43   1.136868377216160E-13
#define P2_46   1.421085471520200E-14
#define P2_50   8.881784197001252E-16
#define P2_55   2.775557561562891E-17
#define P2_59   1.734723475976810E-18
#define SS2SOH   0x01 /* ss2 start of header */
#define ID_SS2LLH   20 /* ss2 message ID#20 navigation data (user) */
#define ID_SS2ECEF   21 /* ss2 message ID#21 navigation data (ecef) */
#define ID_SS2EPH   22 /* ss2 message ID#22 ephemeris data */
#define ID_SS2RAW   23 /* ss2 message ID#23 measurement block */
#define ID_SS2SBAS   67 /* ss2 message ID#67 sbas data */
#define U1(p)

Functions

static uint16_t U2 (uint8_t *p)
static uint32_t U4 (uint8_t *p)
static double R8 (uint8_t *p)
static int chksum (const uint8_t *buff, int len)
static int adjweek (raw_t *raw, double sec)
static int decode_ss2llh (raw_t *raw)
static int decode_ss2ecef (raw_t *raw)
static int decode_ss2meas (raw_t *raw)
static int decode_ss2eph (raw_t *raw)
static int decode_ss2sbas (raw_t *raw)
static int decode_ss2 (raw_t *raw)
static int sync_ss2 (uint8_t *buff, uint8_t data)
int input_ss2 (raw_t *raw, uint8_t data)
int input_ss2f (raw_t *raw, FILE *fp)

Macro Definition Documentation

◆ CLIGHT

#define CLIGHT   299792458.0 /* speed of light (m/s) */

Definition at line 37 of file mrtk_rcv_ss2.c.

◆ D2R

#define D2R   (PI / 180.0) /* deg to rad */

Definition at line 35 of file mrtk_rcv_ss2.c.

◆ DFRQ1_GLO

#define DFRQ1_GLO   0.56250E6 /* GLONASS G1 bias frequency (Hz/n) */

Definition at line 65 of file mrtk_rcv_ss2.c.

◆ DFRQ2_GLO

#define DFRQ2_GLO   0.43750E6 /* GLONASS G2 bias frequency (Hz/n) */

Definition at line 67 of file mrtk_rcv_ss2.c.

◆ FREQ1

#define FREQ1   1.57542E9 /* L1/E1/B1C frequency (Hz) */

Definition at line 57 of file mrtk_rcv_ss2.c.

◆ FREQ1_CMP

#define FREQ1_CMP   1.561098E9 /* BDS B1I frequency (Hz) */

Definition at line 71 of file mrtk_rcv_ss2.c.

◆ FREQ1_GLO

#define FREQ1_GLO   1.60200E9 /* GLONASS G1 base frequency (Hz) */

Definition at line 64 of file mrtk_rcv_ss2.c.

◆ FREQ1a_GLO

#define FREQ1a_GLO   1.600995E9 /* GLONASS G1a frequency (Hz) */

Definition at line 69 of file mrtk_rcv_ss2.c.

◆ FREQ2

#define FREQ2   1.22760E9 /* L2 frequency (Hz) */

Definition at line 58 of file mrtk_rcv_ss2.c.

◆ FREQ2_GLO

#define FREQ2_GLO   1.24600E9 /* GLONASS G2 base frequency (Hz) */

Definition at line 66 of file mrtk_rcv_ss2.c.

◆ FREQ2a_GLO

#define FREQ2a_GLO   1.248060E9 /* GLONASS G2a frequency (Hz) */

Definition at line 70 of file mrtk_rcv_ss2.c.

◆ FREQ3_GLO

#define FREQ3_GLO   1.202025E9 /* GLONASS G3 frequency (Hz) */

Definition at line 68 of file mrtk_rcv_ss2.c.

◆ FREQ5

#define FREQ5   1.17645E9 /* L5/E5a/B2a frequency (Hz) */

Definition at line 59 of file mrtk_rcv_ss2.c.

◆ FREQ6

#define FREQ6   1.27875E9 /* E6/L6 frequency (Hz) */

Definition at line 60 of file mrtk_rcv_ss2.c.

◆ FREQ7

#define FREQ7   1.20714E9 /* E5b/B2I frequency (Hz) */

Definition at line 61 of file mrtk_rcv_ss2.c.

◆ FREQ8

#define FREQ8   1.191795E9 /* E5ab/B2ab frequency (Hz) */

Definition at line 62 of file mrtk_rcv_ss2.c.

◆ FREQ9

#define FREQ9   2.492028E9 /* S frequency (Hz) */

Definition at line 63 of file mrtk_rcv_ss2.c.

◆ ID_SS2ECEF

#define ID_SS2ECEF   21 /* ss2 message ID#21 navigation data (ecef) */

Definition at line 110 of file mrtk_rcv_ss2.c.

Referenced by decode_ss2().

◆ ID_SS2EPH

#define ID_SS2EPH   22 /* ss2 message ID#22 ephemeris data */

Definition at line 111 of file mrtk_rcv_ss2.c.

Referenced by decode_ss2().

◆ ID_SS2LLH

#define ID_SS2LLH   20 /* ss2 message ID#20 navigation data (user) */

Definition at line 109 of file mrtk_rcv_ss2.c.

Referenced by decode_ss2().

◆ ID_SS2RAW

#define ID_SS2RAW   23 /* ss2 message ID#23 measurement block */

Definition at line 112 of file mrtk_rcv_ss2.c.

Referenced by decode_ss2().

◆ ID_SS2SBAS

#define ID_SS2SBAS   67 /* ss2 message ID#67 sbas data */

Definition at line 113 of file mrtk_rcv_ss2.c.

Referenced by decode_ss2().

◆ MAXPRNGPS

#define MAXPRNGPS   32

Definition at line 74 of file mrtk_rcv_ss2.c.

◆ MAXPRNSBS

#define MAXPRNSBS   158

Definition at line 76 of file mrtk_rcv_ss2.c.

◆ MINPRNGPS

#define MINPRNGPS   1

Definition at line 73 of file mrtk_rcv_ss2.c.

◆ MINPRNSBS

#define MINPRNSBS   120

Definition at line 75 of file mrtk_rcv_ss2.c.

◆ P2_11

#define P2_11   4.882812500000000E-04

Definition at line 81 of file mrtk_rcv_ss2.c.

◆ P2_15

#define P2_15   3.051757812500000E-05

Definition at line 82 of file mrtk_rcv_ss2.c.

◆ P2_17

#define P2_17   7.629394531250000E-06

Definition at line 83 of file mrtk_rcv_ss2.c.

◆ P2_19

#define P2_19   1.907348632812500E-06

Definition at line 84 of file mrtk_rcv_ss2.c.

◆ P2_20

#define P2_20   9.536743164062500E-07

Definition at line 85 of file mrtk_rcv_ss2.c.

◆ P2_21

#define P2_21   4.768371582031250E-07

Definition at line 86 of file mrtk_rcv_ss2.c.

◆ P2_23

#define P2_23   1.192092895507810E-07

Definition at line 87 of file mrtk_rcv_ss2.c.

◆ P2_24

#define P2_24   5.960464477539063E-08

Definition at line 88 of file mrtk_rcv_ss2.c.

◆ P2_27

#define P2_27   7.450580596923828E-09

Definition at line 89 of file mrtk_rcv_ss2.c.

◆ P2_29

#define P2_29   1.862645149230957E-09

Definition at line 90 of file mrtk_rcv_ss2.c.

◆ P2_30

#define P2_30   9.313225746154785E-10

Definition at line 91 of file mrtk_rcv_ss2.c.

◆ P2_31

#define P2_31   4.656612873077393E-10

Definition at line 92 of file mrtk_rcv_ss2.c.

◆ P2_32

#define P2_32   2.328306436538696E-10

Definition at line 93 of file mrtk_rcv_ss2.c.

◆ P2_33

#define P2_33   1.164153218269348E-10

Definition at line 94 of file mrtk_rcv_ss2.c.

◆ P2_34

#define P2_34   5.820766091346740E-11

Definition at line 95 of file mrtk_rcv_ss2.c.

◆ P2_35

#define P2_35   2.910383045673370E-11

Definition at line 96 of file mrtk_rcv_ss2.c.

◆ P2_38

#define P2_38   3.637978807091710E-12

Definition at line 97 of file mrtk_rcv_ss2.c.

◆ P2_40

#define P2_40   9.094947017729280E-13

Definition at line 98 of file mrtk_rcv_ss2.c.

◆ P2_43

#define P2_43   1.136868377216160E-13

Definition at line 99 of file mrtk_rcv_ss2.c.

◆ P2_46

#define P2_46   1.421085471520200E-14

Definition at line 100 of file mrtk_rcv_ss2.c.

◆ P2_5

#define P2_5   0.03125

Definition at line 79 of file mrtk_rcv_ss2.c.

◆ P2_50

#define P2_50   8.881784197001252E-16

Definition at line 101 of file mrtk_rcv_ss2.c.

◆ P2_55

#define P2_55   2.775557561562891E-17

Definition at line 102 of file mrtk_rcv_ss2.c.

◆ P2_59

#define P2_59   1.734723475976810E-18

Definition at line 103 of file mrtk_rcv_ss2.c.

◆ P2_6

#define P2_6   0.015625

Definition at line 80 of file mrtk_rcv_ss2.c.

◆ PI

#define PI   3.1415926535897932 /* pi */

Definition at line 34 of file mrtk_rcv_ss2.c.

◆ R2D

#define R2D   (180.0 / PI) /* rad to deg */

Definition at line 36 of file mrtk_rcv_ss2.c.

◆ SC2RAD

#define SC2RAD   3.1415926535898 /* semi-circle to radian (IS-GPS) */

Definition at line 38 of file mrtk_rcv_ss2.c.

◆ SS2SOH

#define SS2SOH   0x01 /* ss2 start of header */

Definition at line 107 of file mrtk_rcv_ss2.c.

Referenced by sync_ss2().

◆ SYS_CMP

#define SYS_CMP   0x20

Definition at line 46 of file mrtk_rcv_ss2.c.

◆ SYS_GAL

#define SYS_GAL   0x08

Definition at line 44 of file mrtk_rcv_ss2.c.

◆ SYS_GLO

#define SYS_GLO   0x04

Definition at line 43 of file mrtk_rcv_ss2.c.

◆ SYS_GPS

#define SYS_GPS   0x01

Definition at line 41 of file mrtk_rcv_ss2.c.

◆ SYS_IRN

#define SYS_IRN   0x40

Definition at line 47 of file mrtk_rcv_ss2.c.

◆ SYS_NONE

#define SYS_NONE   0x00

Definition at line 40 of file mrtk_rcv_ss2.c.

◆ SYS_QZS

#define SYS_QZS   0x10

Definition at line 45 of file mrtk_rcv_ss2.c.

◆ SYS_SBS

#define SYS_SBS   0x02

Definition at line 42 of file mrtk_rcv_ss2.c.

◆ TSYS_CMP

#define TSYS_CMP   5

Definition at line 54 of file mrtk_rcv_ss2.c.

◆ TSYS_GAL

#define TSYS_GAL   3

Definition at line 52 of file mrtk_rcv_ss2.c.

◆ TSYS_GLO

#define TSYS_GLO   2

Definition at line 51 of file mrtk_rcv_ss2.c.

◆ TSYS_GPS

#define TSYS_GPS   0

Definition at line 49 of file mrtk_rcv_ss2.c.

◆ TSYS_IRN

#define TSYS_IRN   6

Definition at line 55 of file mrtk_rcv_ss2.c.

◆ TSYS_QZS

#define TSYS_QZS   4

Definition at line 53 of file mrtk_rcv_ss2.c.

◆ TSYS_UTC

#define TSYS_UTC   1

Definition at line 50 of file mrtk_rcv_ss2.c.

◆ U1

#define U1 ( p)
Value:
(*((uint8_t*)(p)))

Definition at line 116 of file mrtk_rcv_ss2.c.

Referenced by decode_ss2(), decode_ss2llh(), and decode_ss2meas().

Function Documentation

◆ adjweek()

int adjweek ( raw_t * raw,
double sec )
static

Definition at line 144 of file mrtk_rcv_ss2.c.

References gpst2time(), gtime_t::time, raw_t::time, and time2gpst().

Referenced by decode_ss2meas().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ chksum()

int chksum ( const uint8_t * buff,
int len )
static

Definition at line 134 of file mrtk_rcv_ss2.c.

Referenced by decode_ss2().

Here is the caller graph for this function:

◆ decode_ss2()

int decode_ss2 ( raw_t * raw)
static

Definition at line 329 of file mrtk_rcv_ss2.c.

References raw_t::buff, chksum(), decode_ss2ecef(), decode_ss2eph(), decode_ss2llh(), decode_ss2meas(), decode_ss2sbas(), ID_SS2ECEF, ID_SS2EPH, ID_SS2LLH, ID_SS2RAW, ID_SS2SBAS, raw_t::len, raw_t::msgtype, raw_t::outtype, trace(), and U1.

Referenced by input_ss2(), and input_ss2f().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decode_ss2ecef()

int decode_ss2ecef ( raw_t * raw)
static

Definition at line 181 of file mrtk_rcv_ss2.c.

References raw_t::buff, gpst2time(), raw_t::len, R8, raw_t::time, trace(), and U2.

Referenced by decode_ss2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decode_ss2eph()

int decode_ss2eph ( raw_t * raw)
static

Definition at line 256 of file mrtk_rcv_ss2.c.

References raw_t::buff, decode_frame(), nav_s::eph, raw_t::ephsat, raw_t::ephset, eph_t::iode, raw_t::len, raw_t::nav, raw_t::opt, eph_t::sat, satno(), SYS_GPS, gtime_t::time, raw_t::time, time2gpst(), trace(), eph_t::ttr, and U4.

Referenced by decode_ss2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decode_ss2llh()

int decode_ss2llh ( raw_t * raw)
static

Definition at line 161 of file mrtk_rcv_ss2.c.

References raw_t::buff, epoch2time(), raw_t::len, R8, raw_t::time, trace(), U1, U2, and utc2gpst().

Referenced by decode_ss2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decode_ss2meas()

int decode_ss2meas ( raw_t * raw)
static

Definition at line 194 of file mrtk_rcv_ss2.c.

References adjweek(), raw_t::buff, CLIGHT, obsd_t::code, CODE_L1C, CODE_NONE, obsd_t::D, obs_t::data, FREQ1, raw_t::icpc, raw_t::icpp, obsd_t::L, raw_t::len, obsd_t::LLI, raw_t::lockt, MAXOBS, obs_t::n, raw_t::obs, raw_t::off, obsd_t::P, R8, obsd_t::sat, satno(), obsd_t::SNR, SNR_UNIT, SYS_GPS, SYS_SBS, obsd_t::time, raw_t::time, trace(), U1, and U4.

Referenced by decode_ss2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decode_ss2sbas()

int decode_ss2sbas ( raw_t * raw)
static

Definition at line 303 of file mrtk_rcv_ss2.c.

References raw_t::buff, gpst2time(), raw_t::len, MAXPRNSBS, MINPRNSBS, sbsmsg_t::msg, sbsmsg_t::prn, R8, raw_t::sbsmsg, sbsmsg_t::tow, trace(), U4, and sbsmsg_t::week.

Referenced by decode_ss2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ input_ss2()

int input_ss2 ( raw_t * raw,
uint8_t data )
extern

Definition at line 373 of file mrtk_rcv_ss2.c.

References raw_t::buff, decode_ss2(), raw_t::len, MAXRAWLEN, raw_t::nbyte, sync_ss2(), trace(), and U1.

Referenced by input_raw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ input_ss2f()

int input_ss2f ( raw_t * raw,
FILE * fp )
extern

Definition at line 407 of file mrtk_rcv_ss2.c.

References raw_t::buff, decode_ss2(), raw_t::len, MAXRAWLEN, raw_t::nbyte, sync_ss2(), trace(), and U1.

Referenced by input_rawf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ R8()

double R8 ( uint8_t * p)
static

Definition at line 127 of file mrtk_rcv_ss2.c.

◆ sync_ss2()

int sync_ss2 ( uint8_t * buff,
uint8_t data )
static

Definition at line 357 of file mrtk_rcv_ss2.c.

References SS2SOH.

Referenced by input_ss2(), and input_ss2f().

Here is the caller graph for this function:

◆ U2()

uint16_t U2 ( uint8_t * p)
static

Definition at line 117 of file mrtk_rcv_ss2.c.

◆ U4()

uint32_t U4 ( uint8_t * p)
static

Definition at line 122 of file mrtk_rcv_ss2.c.