MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_rtcm.c File Reference
#include "mrtklib/mrtk_rtcm.h"
#include <stdlib.h>
#include <string.h>
#include "mrtklib/mrtk_bits.h"
#include "mrtklib/mrtk_trace.h"
Include dependency graph for mrtk_rtcm.c:

Go to the source code of this file.

Macros

#define RTCM2PREAMB   0x66 /* rtcm ver.2 frame preamble */
#define RTCM3PREAMB   0xD3 /* rtcm ver.3 frame preamble */

Functions

int init_rtcm (rtcm_t *rtcm)
 Initialize RTCM control struct.
void free_rtcm (rtcm_t *rtcm)
 Free RTCM control struct.
lclblock_t * rtcm_lclblk (rtcm_t *rtcm)
 Get the local correction block, lazily allocating it on first use.
int input_rtcm2 (rtcm_t *rtcm, uint8_t data)
 Input RTCM 2 message from stream (byte-by-byte).
int input_rtcm3 (rtcm_t *rtcm, uint8_t data)
 Input RTCM 3 message from stream (byte-by-byte).
int input_rtcm2f (rtcm_t *rtcm, FILE *fp)
 Input RTCM 2 message from file.
int input_rtcm3f (rtcm_t *rtcm, FILE *fp)
 Input RTCM 3 message from file.
int gen_rtcm2 (rtcm_t *rtcm, int type, int sync)
 Generate RTCM 2 message.
int gen_rtcm3 (rtcm_t *rtcm, int type, int subtype, int sync)
 Generate RTCM 3 message.

Macro Definition Documentation

◆ RTCM2PREAMB

#define RTCM2PREAMB   0x66 /* rtcm ver.2 frame preamble */

Definition at line 28 of file mrtk_rtcm.c.

Referenced by input_rtcm2().

◆ RTCM3PREAMB

#define RTCM3PREAMB   0xD3 /* rtcm ver.3 frame preamble */

Definition at line 29 of file mrtk_rtcm.c.

Referenced by gen_rtcm3(), and input_rtcm3().

Function Documentation

◆ free_rtcm()

void free_rtcm ( rtcm_t * rtcm)

Free RTCM control struct.

Parameters
[in,out]rtcmRTCM control struct

Definition at line 118 of file mrtk_rtcm.c.

References free, rtcm, and trace().

Referenced by free_strfile(), freepreceph(), init_rtcm(), rtksvrthread(), strconvfree(), and strconvnew().

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

◆ gen_rtcm2()

int gen_rtcm2 ( rtcm_t * rtcm,
int type,
int sync )

Generate RTCM 2 message.

Parameters
[in,out]rtcmRTCM control struct
[in]typeMessage type
[in]syncSync flag (1:another message follows)
Returns
Status (1:ok, 0:error)

Definition at line 369 of file mrtk_rtcm.c.

References rtcm, and trace().

Referenced by write_nav(), write_nav_cycle(), write_obs(), and write_sta_cycle().

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

◆ gen_rtcm3()

int gen_rtcm3 ( rtcm_t * rtcm,
int type,
int subtype,
int sync )

Generate RTCM 3 message.

Parameters
[in,out]rtcmRTCM control struct
[in]typeMessage type
[in]subtypeMessage subtype (0:no subtype)
[in]syncSync flag (1:another message follows)
Returns
Status (1:ok, 0:error)

Definition at line 392 of file mrtk_rtcm.c.

References encode_rtcm3(), rtcm, RTCM3PREAMB, rtk_crc24q(), setbitu(), and trace().

Referenced by output_lclcmb(), write_nav(), write_nav_cycle(), write_obs(), write_rtcm3_msm(), and write_sta_cycle().

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

◆ init_rtcm()

int init_rtcm ( rtcm_t * rtcm)

Initialize RTCM control struct.

Parameters
[out]rtcmRTCM control struct
Returns
Status (1:ok, 0:memory allocation error)
Note
The struct must be zero-initialized (calloc/memset) before the first call; an existing lclblk allocation is preserved across re-init.

Definition at line 37 of file mrtk_rtcm.c.

References free_rtcm(), malloc, MAXOBS, MAXPRNGLO, MAXSAT, rtcm, and trace().

Referenced by gen_strfile(), readpreceph(), rtksvrstart(), and strconvnew().

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

◆ input_rtcm2()

int input_rtcm2 ( rtcm_t * rtcm,
uint8_t data )

Input RTCM 2 message from stream (byte-by-byte).

Parameters
[in,out]rtcmRTCM control struct
[in]dataStream data (1 byte)
Returns
Status (-1:error, 0:no message, 1:obs data, 2:ephemeris, ...)

Definition at line 159 of file mrtk_rtcm.c.

References decode_rtcm2(), decode_word(), rtcm, RTCM2PREAMB, and trace().

Referenced by decoderaw(), input_rtcm2f(), and strconv().

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

◆ input_rtcm2f()

int input_rtcm2f ( rtcm_t * rtcm,
FILE * fp )

Input RTCM 2 message from file.

Parameters
[in,out]rtcmRTCM control struct
[in]fpFile pointer
Returns
Status (-2:end of file, -1:error, 0:no message, 1:obs, 2:eph, ...)

Definition at line 325 of file mrtk_rtcm.c.

References input_rtcm2(), rtcm, and trace().

Referenced by input_strfile().

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

◆ input_rtcm3()

int input_rtcm3 ( rtcm_t * rtcm,
uint8_t data )

Input RTCM 3 message from stream (byte-by-byte).

Parameters
[in,out]rtcmRTCM control struct
[in]dataStream data (1 byte)
Returns
Status (-1:error, 0:no message, 1:obs data, 2:ephemeris, ...)

Definition at line 289 of file mrtk_rtcm.c.

References decode_rtcm3(), getbitu(), rtcm, RTCM3PREAMB, rtk_crc24q(), and trace().

Referenced by decoderaw(), input_rtcm3f(), and strconv().

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

◆ input_rtcm3f()

int input_rtcm3f ( rtcm_t * rtcm,
FILE * fp )

Input RTCM 3 message from file.

Parameters
[in,out]rtcmRTCM control struct
[in]fpFile pointer
Returns
Status (-2:end of file, -1:error, 0:no message, 1:obs, 2:eph, ...)

Definition at line 347 of file mrtk_rtcm.c.

References input_rtcm3(), rtcm, and trace().

Referenced by input_strfile(), and update_rtcm().

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

◆ rtcm_lclblk()

lclblock_t * rtcm_lclblk ( rtcm_t * rtcm)

Get the local correction block, lazily allocating it on first use.

Parameters
[in,out]rtcmRTCM control struct
Returns
Local correction block (NULL: memory allocation error).

Definition at line 139 of file mrtk_rtcm.c.

References calloc, and rtcm.

Referenced by decode_lcliono(), and decode_lcltrop().

Here is the caller graph for this function: