MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_l6.h File Reference

MRTKLIB L6 Module — QZSS L6 frame header parsing. More...

#include <stdint.h>
Include dependency graph for mrtk_l6.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  l6_header_t
 Decoded L6 frame header. Raw bit fields; no service-specific remapping. More...
struct  l6_prn_info_t
 Auxiliary per-PRN information for one L6 PRN. More...

Macros

#define L6_PREAMBLE   0x1ACFFC1DU /* L6 frame preamble */
#define L6_FRAME_LEN   218 /* frame length without R-S parity (bytes) */
#define L6_RAW_LEN   250 /* frame length with R-S parity (bytes) */
#define L6_HEADER_BITS   49 /* preamble + PRN + type ID + alert (bits) */
#define L6_DATA_BITS   1695 /* data part (bits) */
#define L6_FILE_SCAN_BYTES   65536 /* read chunk of l6_file_service() */
#define L6_VID_MADOCA   2 /* vendor ID 010b: MADOCA-PPP (L6D and L6E) [3] */
#define L6_VID_QZNMA   3 /* vendor ID 011b: QZNMA (L6E only) [3] */
#define L6_VID_CLAS   5 /* vendor ID 101b: CLAS (L6D only) [3] */

Enumerations

enum  l6_service_t {
  L6_SVC_UNKNOWN = 0 , L6_SVC_NULL , L6_SVC_CLAS , L6_SVC_MADOCA ,
  L6_SVC_MADOCA_IONO , L6_SVC_QZNMA
}
 Service carried by an L6 frame. More...
enum  l6_file_type_t { L6_FILE_NONE = 0 , L6_FILE_L6 , L6_FILE_L6D , L6_FILE_L6E }
 QZSS L6 file type from the file name extension. More...

Functions

int l6_parse_header (const uint8_t *frame, l6_header_t *h)
 Parse the header of one L6 frame and classify its service.
int l6_is_null (const uint8_t *frame)
 Test whether an L6 frame is a null message.
const l6_prn_info_t * l6_prn_info (int prn)
 Look up the auxiliary information of an L6 PRN.
int l6_service_expected (const l6_header_t *h)
 Test whether a classified frame matches the nominal assignment of its PRN.
l6_file_type_t l6_file_type (const char *file)
 Classify a file name by its QZSS L6 extension (case-insensitive).
l6_service_t l6_file_service (const char *file)
 Service of an L6 frame file, from the first non-null frame header.
const char * l6_service_name (l6_service_t svc)
 Short name of an L6 service, for logs.

Detailed Description

MRTKLIB L6 Module — QZSS L6 frame header parsing.

Every QZSS L6 frame (L6D and L6E) starts with a 49-bit header: 32-bit preamble, 8-bit PRN, 8-bit L6 message type ID and 1-bit alert flag, followed by 1695 data bits and a 256-bit Reed-Solomon parity. The service carried by a frame (CLAS, MADOCA-PPP, QZNMA) is identified by the vendor ID in the message type ID [3], never by the PRN: L6E PRNs time-multiplex MADOCA-PPP and QZNMA frames, and PRN-to-service assignments change over time.

The functions here are stateless; byte synchronisation and subframe assembly stay with each service decoder.

Definition in file mrtk_l6.h.

Macro Definition Documentation

◆ L6_DATA_BITS

#define L6_DATA_BITS   1695 /* data part (bits) */

Definition at line 46 of file mrtk_l6.h.

Referenced by decode_qzss_l6dmsg(), and decode_qzss_l6emsg().

◆ L6_FILE_SCAN_BYTES

#define L6_FILE_SCAN_BYTES   65536 /* read chunk of l6_file_service() */

Definition at line 47 of file mrtk_l6.h.

Referenced by l6_file_service().

◆ L6_FRAME_LEN

#define L6_FRAME_LEN   218 /* frame length without R-S parity (bytes) */

Definition at line 43 of file mrtk_l6.h.

Referenced by input_qzssl6d(), input_qzssl6e(), l6_file_service(), and l6_is_null().

◆ L6_HEADER_BITS

#define L6_HEADER_BITS   49 /* preamble + PRN + type ID + alert (bits) */

Definition at line 45 of file mrtk_l6.h.

Referenced by decode_qzss_l6dmsg(), and decode_qzss_l6emsg().

◆ L6_PREAMBLE

#define L6_PREAMBLE   0x1ACFFC1DU /* L6 frame preamble */

Definition at line 42 of file mrtk_l6.h.

Referenced by decode_qzss_l6dmsg(), decode_qzss_l6emsg(), and l6_parse_header().

◆ L6_RAW_LEN

#define L6_RAW_LEN   250 /* frame length with R-S parity (bytes) */

Definition at line 44 of file mrtk_l6.h.

◆ L6_VID_CLAS

#define L6_VID_CLAS   5 /* vendor ID 101b: CLAS (L6D only) [3] */

Definition at line 51 of file mrtk_l6.h.

Referenced by l6_parse_header().

◆ L6_VID_MADOCA

#define L6_VID_MADOCA   2 /* vendor ID 010b: MADOCA-PPP (L6D and L6E) [3] */

Definition at line 49 of file mrtk_l6.h.

Referenced by l6_parse_header().

◆ L6_VID_QZNMA

#define L6_VID_QZNMA   3 /* vendor ID 011b: QZNMA (L6E only) [3] */

Definition at line 50 of file mrtk_l6.h.

Referenced by l6_parse_header().

Enumeration Type Documentation

◆ l6_file_type_t

QZSS L6 file type from the file name extension.

Enumerator
L6_FILE_NONE 

not an L6 file

L6_FILE_L6 

".l6" (legacy: CLAS L6D or MADOCA-PPP L6E)

L6_FILE_L6D 

".l6d"

L6_FILE_L6E 

".l6e"

Definition at line 142 of file mrtk_l6.h.

◆ l6_service_t

Service carried by an L6 frame.

Enumerator
L6_SVC_UNKNOWN 

bad preamble or reserved vendor ID

L6_SVC_NULL 

null message [1] 4.1.2.3

L6_SVC_CLAS 

CLAS (vendor 101b)

L6_SVC_MADOCA 

MADOCA-PPP clock/ephemeris (vendor 010b, CSID 0)

L6_SVC_MADOCA_IONO 

MADOCA-PPP ionospheric corrections (vendor 010b, CSID 1)

L6_SVC_QZNMA 

QZNMA (vendor 011b)

Definition at line 58 of file mrtk_l6.h.

Function Documentation

◆ l6_file_service()

l6_service_t l6_file_service ( const char * file)

Service of an L6 frame file, from the first non-null frame header.

Scans the start of the file (concatenated 218- or 250-byte frames, as written by receivers and archives) for the preamble and classifies the first frame that is not a null message.

Parameters
[in]fileFile path (no keyword expansion).
Returns
Service, or L6_SVC_UNKNOWN if the file cannot be read or holds no classifiable frame. The file is read in L6_FILE_SCAN_BYTES chunks until the first classifiable frame, so a leading run of null messages of any length is skipped.

Definition at line 120 of file mrtk_l6.c.

References free, L6_FILE_SCAN_BYTES, L6_FRAME_LEN, l6_parse_header(), L6_SVC_NULL, L6_SVC_UNKNOWN, malloc, and l6_header_t::svc.

Referenced by readpreceph().

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

◆ l6_file_type()

l6_file_type_t l6_file_type ( const char * file)

Classify a file name by its QZSS L6 extension (case-insensitive).

Parameters
[in]fileFile path or name.
Returns
L6 file type, L6_FILE_NONE if the extension is not .l6/.l6d/.l6e.

Definition at line 100 of file mrtk_l6.c.

References L6_FILE_L6, and L6_FILE_NONE.

Referenced by postpos(), readobsnav(), and readpreceph().

Here is the caller graph for this function:

◆ l6_is_null()

int l6_is_null ( const uint8_t * frame)

Test whether an L6 frame is a null message.

Null message [1] 4.1.2.3: message type ID 0, alert flag 1, data part "0101010"b followed by repeated "10101010"b, i.e. bytes 6..217 all 0xAA.

Parameters
[in]frameL6 frame starting at the preamble; at least L6_FRAME_LEN bytes.
Returns
1 if the frame is a null message, 0 otherwise.

Definition at line 29 of file mrtk_l6.c.

References L6_FRAME_LEN.

Referenced by l6_parse_header().

Here is the caller graph for this function:

◆ l6_parse_header()

int l6_parse_header ( const uint8_t * frame,
l6_header_t * h )

Parse the header of one L6 frame and classify its service.

Parameters
[in]frameL6 frame starting at the preamble; at least L6_FRAME_LEN bytes.
[out]hDecoded header. All fields are filled even when the preamble is invalid.
Returns
1 if the preamble is valid, 0 otherwise (h->svc is L6_SVC_UNKNOWN).

Definition at line 44 of file mrtk_l6.c.

References l6_header_t::alert, l6_header_t::anme, l6_header_t::csid, l6_header_t::fac, l6_is_null(), L6_PREAMBLE, L6_SVC_CLAS, L6_SVC_MADOCA, L6_SVC_MADOCA_IONO, L6_SVC_NULL, L6_SVC_QZNMA, L6_SVC_UNKNOWN, L6_VID_CLAS, L6_VID_MADOCA, L6_VID_QZNMA, l6_header_t::msgid, l6_header_t::preamble, l6_header_t::prn, l6_header_t::ptn, l6_header_t::sf_ind, l6_header_t::svc, and l6_header_t::vid.

Referenced by clas_input_cssr(), decode_qzss_l6dmsg(), decode_qzss_l6emsg(), decode_qzss_l6frame(), decoderaw(), and l6_file_service().

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

◆ l6_prn_info()

const l6_prn_info_t * l6_prn_info ( int prn)

Look up the auxiliary information of an L6 PRN.

Parameters
[in]prnL6 PRN (header byte 4).
Returns
Table entry, or NULL if the PRN has no nominal L6 assignment.

Definition at line 74 of file mrtk_l6.c.

References l6_prn_table.

Referenced by decode_qzss_l6dmsg(), decoderaw(), and l6_service_expected().

Here is the caller graph for this function:

◆ l6_service_expected()

int l6_service_expected ( const l6_header_t * h)

Test whether a classified frame matches the nominal assignment of its PRN.

Null messages always match; on L6E PRNs both MADOCA and QZNMA match.

Parameters
[in]hParsed header.
Returns
1 if consistent, 0 if the PRN is unassigned or carries an unexpected service.

Definition at line 85 of file mrtk_l6.c.

References l6_prn_info(), L6_SVC_MADOCA, L6_SVC_NULL, L6_SVC_QZNMA, l6_prn_info_t::l6e, l6_header_t::prn, l6_header_t::svc, and l6_prn_info_t::svc.

Referenced by decode_qzss_l6frame().

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

◆ l6_service_name()

const char * l6_service_name ( l6_service_t svc)

Short name of an L6 service, for logs.

Parameters
[in]svcService.
Returns
Static string (e.g. "CLAS", "MADOCA", "QZNMA").

Definition at line 162 of file mrtk_l6.c.

References L6_SVC_CLAS, L6_SVC_MADOCA, L6_SVC_MADOCA_IONO, L6_SVC_NULL, and L6_SVC_QZNMA.

Referenced by clas_input_cssr(), and decode_qzss_l6frame().

Here is the caller graph for this function: