MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_options.c File Reference
#include "mrtklib/mrtk_options.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mrtklib/mrtk_coords.h"
#include "mrtklib/mrtk_nav.h"
#include "mrtklib/mrtk_obs.h"
#include "mrtklib/mrtk_toml.h"
#include "mrtklib/mrtk_trace.h"
Include dependency graph for mrtk_options.c:

Go to the source code of this file.

Macros

#define D2R   (3.1415926535897932384626433832795 / 180.0)
#define R2D   (180.0 / 3.1415926535897932384626433832795)
#define SWTOPT   "0:off,1:on"
#define ISBOPT   "0:off,1:table,1:on"
#define SEEDOPT   "0:off,1:cn0+tdcp,2:cn0+tdcp+robust"
#define MODOPT
#define FRQOPT   "1:l1,2:l1+2,2:l1+l2,3:l1+2+3,3:l1+l2+l5,4:l1+2+3+4,4:l1+l2+l5+l6,5:l1+2+3+4+5,5:l1+l2+l5+l6+l7"
#define FRQOPT2   "1:l1,2:l1+l2,3:l1+l5,4:l1+l2+l5,5:l1+l5(l2)"
#define TYPOPT   "0:forward,1:backward,2:combined"
#define IONOPT   "0:off,1:brdc,2:sbas,3:dual-freq,4:est-stec,5:ionex-tec,6:qzs-brdc,9:est-adaptive"
#define TRPOPT   "0:off,1:saas,2:sbas,3:est-ztd,4:est-ztdgrad"
#define EPHOPT   "0:brdc,1:precise,2:brdc+sbas,3:brdc+ssrapc,4:brdc+ssrcom"
#define ROBOPT   "0:off,1:igg3"
#define NAVOPT   "1:gps+2:sbas+4:glo+8:gal+16:qzs+32:bds+64:navic"
#define GAROPT   "0:off,1:on"
#define SOLOPT   "0:llh,1:xyz,2:enu,3:nmea"
#define TSYOPT   "0:gpst,1:utc,2:jst"
#define TFTOPT   "0:tow,1:hms"
#define DFTOPT   "0:deg,1:dms"
#define HGTOPT   "0:ellipsoidal,1:geodetic"
#define GEOOPT   "0:internal,1:egm96,2:egm08_2.5,3:egm08_1,4:gsi2000"
#define STAOPT   "0:all,1:single"
#define STSOPT   "0:off,1:state,2:residual"
#define ARMOPT   "0:off,1:continuous,2:instantaneous,3:fix-and-hold"
#define POSOPT   "0:llh,1:xyz,2:single,3:posfile,4:rinexhead,5:rtcm,6:raw"
#define TIDEOPT   "0:off,1:on,2:otl,3:solid+otl-clasgrid+pole"
#define PHWOPT   "0:off,1:on,2:precise"
#define SIGOPT1   "0:L1/L2,1:L1/L5,2:L1/L2/L5"
#define SIGOPT2   "0:L1/L5,1:L1/L2,2:L1/L5/L2"
#define SIGOPT3   "0:E1/E5a,1:E1/E5b,2:E1/E6,3:E1/E5a/E5b/E6,4:E1/E5a/E6/E5b"
#define SIGOPT4   "0:B1I/B3I,1:B1I/B2I,2:B1I/B3I/B2I"
#define SIGOPT5   "0:B1I/B3I,1:B1I/B2a,2:B1I/B3I/B2a"
#define COMOPT   "0:off,1:ssr,2:meas"
#define ARALPHAOPT   "0:0.1%,1:0.5%,2:1%,3:5%,4:10%,5:20%"
#define PSHFTOPT   "0:off,1:table"
#define DOPOPT   "0:zd,1:sd"
#define SATCB   "0:auto,1:ssr,2:bia,3:dcb"
#define SATPB   "0:auto,1:ssr,2:bia,3:fcb"
#define CORROPT   "-1:auto,0:none,1:igs,2:igs-rts,3:qzs-madoca,4:gal-has,5:bds-b2b,6:qzs-clas"
#define BDS2OPT   "satid(C01-C18),.. BDS-2 in PRN 1-18 (\"\":no BDS-2)"
#define IGSOOPT   "satid,.. BDS-3 IGSO (\"\":C06-C08)"

Functions

static void chop (char *str)
static int enum2str (char *s, const char *comment, int val)
static int str2enum (const char *str, const char *comment, int *val)
opt_t * searchopt (const char *name, const opt_t *opts)
 Search option record.
int str2opt (opt_t *opt, const char *str)
 Convert string to option value.
int opt2str (const opt_t *opt, char *str)
 Convert option value to string.
int opt2buf (const opt_t *opt, char *buff)
 Convert option to string (keyword=value # comment).
int loadopts (const char *file, opt_t *opts)
 Load options from file.
int saveopts (const char *file, const char *mode, const char *comment, const opt_t *opts)
 Save options to file.
static void buff2sysopts (void)
static void sysopts2buff (void)
void resetsysopts (void)
 Reset system options to default.
void getsysopts (prcopt_t *popt, solopt_t *sopt, filopt_t *fopt)
 Get system options.
void setsysopts (const prcopt_t *prcopt, const solopt_t *solopt, const filopt_t *filopt)
 Set system options.

Variables

static prcopt_t prcopt_
static solopt_t solopt_
static filopt_t filopt_
static int antpostype_ [2]
static double elmask_
static double elmaskar_
static double elmaskhold_
static double antpos_ [2][3]
static char exsats_ [1024]
static char snrmask_ [5][1024]
static char signals_ [1024]
static int bds2prn_given_
opt_t sysopts []
 System options table.

Macro Definition Documentation

◆ ARALPHAOPT

#define ARALPHAOPT   "0:0.1%,1:0.5%,2:1%,3:5%,4:10%,5:20%"

Definition at line 82 of file mrtk_options.c.

◆ ARMOPT

#define ARMOPT   "0:off,1:continuous,2:instantaneous,3:fix-and-hold"

Definition at line 72 of file mrtk_options.c.

◆ BDS2OPT

#define BDS2OPT   "satid(C01-C18),.. BDS-2 in PRN 1-18 (\"\":no BDS-2)"

Definition at line 88 of file mrtk_options.c.

◆ COMOPT

#define COMOPT   "0:off,1:ssr,2:meas"

Definition at line 81 of file mrtk_options.c.

◆ CORROPT

#define CORROPT   "-1:auto,0:none,1:igs,2:igs-rts,3:qzs-madoca,4:gal-has,5:bds-b2b,6:qzs-clas"

Definition at line 87 of file mrtk_options.c.

◆ D2R

#define D2R   (3.1415926535897932384626433832795 / 180.0)

Definition at line 31 of file mrtk_options.c.

◆ DFTOPT

#define DFTOPT   "0:deg,1:dms"

Definition at line 67 of file mrtk_options.c.

◆ DOPOPT

#define DOPOPT   "0:zd,1:sd"

Definition at line 84 of file mrtk_options.c.

◆ EPHOPT

#define EPHOPT   "0:brdc,1:precise,2:brdc+sbas,3:brdc+ssrapc,4:brdc+ssrcom"

Definition at line 60 of file mrtk_options.c.

◆ FRQOPT

#define FRQOPT   "1:l1,2:l1+2,2:l1+l2,3:l1+2+3,3:l1+l2+l5,4:l1+2+3+4,4:l1+l2+l5+l6,5:l1+2+3+4+5,5:l1+l2+l5+l6+l7"

Definition at line 55 of file mrtk_options.c.

◆ FRQOPT2

#define FRQOPT2   "1:l1,2:l1+l2,3:l1+l5,4:l1+l2+l5,5:l1+l5(l2)"

Definition at line 56 of file mrtk_options.c.

◆ GAROPT

#define GAROPT   "0:off,1:on"

Definition at line 63 of file mrtk_options.c.

◆ GEOOPT

#define GEOOPT   "0:internal,1:egm96,2:egm08_2.5,3:egm08_1,4:gsi2000"

Definition at line 69 of file mrtk_options.c.

◆ HGTOPT

#define HGTOPT   "0:ellipsoidal,1:geodetic"

Definition at line 68 of file mrtk_options.c.

◆ IGSOOPT

#define IGSOOPT   "satid,.. BDS-3 IGSO (\"\":C06-C08)"

Definition at line 89 of file mrtk_options.c.

◆ IONOPT

#define IONOPT   "0:off,1:brdc,2:sbas,3:dual-freq,4:est-stec,5:ionex-tec,6:qzs-brdc,9:est-adaptive"

Definition at line 58 of file mrtk_options.c.

◆ ISBOPT

#define ISBOPT   "0:off,1:table,1:on"

Definition at line 50 of file mrtk_options.c.

◆ MODOPT

#define MODOPT
Value:
"0:single,1:dgps,2:kinematic,3:static,4:movingbase,5:fixed,6:ppp-kine,7:ppp-static,8:ppp-fixed,9:ppp-rtk,10:" \
"ssr2osr,11:ssr2osr-fixed,12:vrs-rtk"

Definition at line 52 of file mrtk_options.c.

◆ NAVOPT

#define NAVOPT   "1:gps+2:sbas+4:glo+8:gal+16:qzs+32:bds+64:navic"

Definition at line 62 of file mrtk_options.c.

◆ PHWOPT

#define PHWOPT   "0:off,1:on,2:precise"

Definition at line 75 of file mrtk_options.c.

◆ POSOPT

#define POSOPT   "0:llh,1:xyz,2:single,3:posfile,4:rinexhead,5:rtcm,6:raw"

Definition at line 73 of file mrtk_options.c.

◆ PSHFTOPT

#define PSHFTOPT   "0:off,1:table"

Definition at line 83 of file mrtk_options.c.

◆ R2D

#define R2D   (180.0 / 3.1415926535897932384626433832795)

Definition at line 32 of file mrtk_options.c.

◆ ROBOPT

#define ROBOPT   "0:off,1:igg3"

Definition at line 61 of file mrtk_options.c.

◆ SATCB

#define SATCB   "0:auto,1:ssr,2:bia,3:dcb"

Definition at line 85 of file mrtk_options.c.

◆ SATPB

#define SATPB   "0:auto,1:ssr,2:bia,3:fcb"

Definition at line 86 of file mrtk_options.c.

◆ SEEDOPT

#define SEEDOPT   "0:off,1:cn0+tdcp,2:cn0+tdcp+robust"

Definition at line 51 of file mrtk_options.c.

◆ SIGOPT1

#define SIGOPT1   "0:L1/L2,1:L1/L5,2:L1/L2/L5"

Definition at line 76 of file mrtk_options.c.

◆ SIGOPT2

#define SIGOPT2   "0:L1/L5,1:L1/L2,2:L1/L5/L2"

Definition at line 77 of file mrtk_options.c.

◆ SIGOPT3

#define SIGOPT3   "0:E1/E5a,1:E1/E5b,2:E1/E6,3:E1/E5a/E5b/E6,4:E1/E5a/E6/E5b"

Definition at line 78 of file mrtk_options.c.

◆ SIGOPT4

#define SIGOPT4   "0:B1I/B3I,1:B1I/B2I,2:B1I/B3I/B2I"

Definition at line 79 of file mrtk_options.c.

◆ SIGOPT5

#define SIGOPT5   "0:B1I/B3I,1:B1I/B2a,2:B1I/B3I/B2a"

Definition at line 80 of file mrtk_options.c.

◆ SOLOPT

#define SOLOPT   "0:llh,1:xyz,2:enu,3:nmea"

Definition at line 64 of file mrtk_options.c.

◆ STAOPT

#define STAOPT   "0:all,1:single"

Definition at line 70 of file mrtk_options.c.

◆ STSOPT

#define STSOPT   "0:off,1:state,2:residual"

Definition at line 71 of file mrtk_options.c.

◆ SWTOPT

#define SWTOPT   "0:off,1:on"

Definition at line 49 of file mrtk_options.c.

◆ TFTOPT

#define TFTOPT   "0:tow,1:hms"

Definition at line 66 of file mrtk_options.c.

◆ TIDEOPT

#define TIDEOPT   "0:off,1:on,2:otl,3:solid+otl-clasgrid+pole"

Definition at line 74 of file mrtk_options.c.

◆ TRPOPT

#define TRPOPT   "0:off,1:saas,2:sbas,3:est-ztd,4:est-ztdgrad"

Definition at line 59 of file mrtk_options.c.

◆ TSYOPT

#define TSYOPT   "0:gpst,1:utc,2:jst"

Definition at line 65 of file mrtk_options.c.

◆ TYPOPT

#define TYPOPT   "0:forward,1:backward,2:combined"

Definition at line 57 of file mrtk_options.c.

Function Documentation

◆ buff2sysopts()

void buff2sysopts ( void )
static

Definition at line 559 of file mrtk_options.c.

References antpos_, antpostype_, bds2prn_given_, D2R, elmask_, elmaskar_, elmaskhold_, exsats_, MAXSAT, mrtk_sigcfg_from_signals(), mrtk_sigcfg_to_obsdef(), pos2ecef(), prcopt_, satid2no(), signals_, snrmask_, and trace().

Referenced by getsysopts().

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

◆ chop()

void chop ( char * str)
static

Definition at line 304 of file mrtk_options.c.

Referenced by loadopts().

Here is the caller graph for this function:

◆ enum2str()

int enum2str ( char * s,
const char * comment,
int val )
static

Definition at line 314 of file mrtk_options.c.

Referenced by opt2str().

Here is the caller graph for this function:

◆ getsysopts()

void getsysopts ( prcopt_t * popt,
solopt_t * sopt,
filopt_t * fopt )
extern

Get system options.

Parameters
[out]poptProcessing options (NULL: no output)
[out]soptSolution options (NULL: no output)
[out]foptFile options (NULL: no output)

Definition at line 738 of file mrtk_options.c.

References buff2sysopts(), filopt_, prcopt_, solopt_, and trace().

Here is the call graph for this function:

◆ loadopts()

int loadopts ( const char * file,
opt_t * opts )
extern

Load options from file.

Parameters
[in]fileOptions file
[in,out]optsOptions table (terminated with name="")
Returns
Status (1:ok, 0:error)

Definition at line 464 of file mrtk_options.c.

References chop(), loadopts_toml(), searchopt(), str2opt(), and trace().

Here is the call graph for this function:

◆ opt2buf()

int opt2buf ( const opt_t * opt,
char * buff )
extern

Convert option to string (keyword=value # comment).

Parameters
[in]optOption
[out]buffOption string
Returns
Length of output string

Definition at line 441 of file mrtk_options.c.

References opt_t::comment, opt_t::name, opt2str(), and trace().

Referenced by saveopts().

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

◆ opt2str()

int opt2str ( const opt_t * opt,
char * str )
extern

Convert option value to string.

Parameters
[in]optOption
[out]strOption value string
Returns
Length of output string

Definition at line 414 of file mrtk_options.c.

References opt_t::comment, enum2str(), opt_t::format, opt_t::name, trace(), and opt_t::var.

Referenced by opt2buf(), and saveopts_toml().

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

◆ resetsysopts()

void resetsysopts ( void )
extern

Reset system options to default.

Definition at line 700 of file mrtk_options.c.

References antpos_, antpostype_, bds2prn_given_, elmask_, elmaskar_, elmaskhold_, exsats_, filopt_, prcopt_, prcopt_default, signals_, solopt_, solopt_default, and trace().

Referenced by setsysopts().

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

◆ saveopts()

int saveopts ( const char * file,
const char * mode,
const char * comment,
const opt_t * opts )
extern

Save options to file.

Parameters
[in]fileOptions file
[in]modeWrite mode ("w":overwrite, "a":append; append is not supported for a .toml file and returns 0)
[in]commentHeader comment (NULL: no comment)
[in]optsOptions table (terminated with name="")
Returns
Status (1:ok, 0:error)

Definition at line 523 of file mrtk_options.c.

References opt_t::name, opt2buf(), saveopts_toml(), and trace().

Here is the call graph for this function:

◆ searchopt()

opt_t * searchopt ( const char * name,
const opt_t * opts )
extern

Search option record.

Parameters
[in]nameOption name
[in]optsOptions table (terminated with name="")
Returns
Option record (NULL: not found)

Definition at line 364 of file mrtk_options.c.

References opt_t::name, and trace().

Referenced by loadopts(), loadopts_toml(), and saveopts_toml().

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

◆ setsysopts()

void setsysopts ( const prcopt_t * prcopt,
const solopt_t * solopt,
const filopt_t * filopt )
extern

Set system options.

Parameters
[in]prcoptProcessing options (NULL: default)
[in]soloptSolution options (NULL: default)
[in]filoptFile options (NULL: default)

Definition at line 760 of file mrtk_options.c.

References filopt_, prcopt_, resetsysopts(), solopt_, sysopts2buff(), and trace().

Here is the call graph for this function:

◆ str2enum()

int str2enum ( const char * str,
const char * comment,
int * val )
static

Definition at line 331 of file mrtk_options.c.

Referenced by str2opt().

Here is the caller graph for this function:

◆ str2opt()

int str2opt ( opt_t * opt,
const char * str )
extern

Convert string to option value.

Parameters
[out]optOption
[in]strOption value string
Returns
Status (1:ok, 0:error)

Definition at line 382 of file mrtk_options.c.

References bds2prn_given_, opt_t::comment, opt_t::format, prcopt_, str2enum(), and opt_t::var.

Referenced by loadopts(), and loadopts_toml().

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

◆ sysopts2buff()

void sysopts2buff ( void )
static

Definition at line 653 of file mrtk_options.c.

References antpos_, antpostype_, bds2prn_given_, ecef2pos(), elmask_, elmaskar_, elmaskhold_, exsats_, MAXSAT, prcopt_, R2D, satno2id(), and snrmask_.

Referenced by setsysopts().

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

Variable Documentation

◆ antpos_

double antpos_[2][3]
static

Definition at line 42 of file mrtk_options.c.

Referenced by buff2sysopts(), resetsysopts(), and sysopts2buff().

◆ antpostype_

int antpostype_[2]
static

Definition at line 40 of file mrtk_options.c.

Referenced by buff2sysopts(), resetsysopts(), and sysopts2buff().

◆ bds2prn_given_

int bds2prn_given_
static

Definition at line 46 of file mrtk_options.c.

Referenced by buff2sysopts(), resetsysopts(), str2opt(), and sysopts2buff().

◆ elmask_

double elmask_
static

Definition at line 41 of file mrtk_options.c.

Referenced by buff2sysopts(), resetsysopts(), and sysopts2buff().

◆ elmaskar_

double elmaskar_
static

Definition at line 41 of file mrtk_options.c.

Referenced by buff2sysopts(), resetsysopts(), and sysopts2buff().

◆ elmaskhold_

double elmaskhold_
static

Definition at line 41 of file mrtk_options.c.

Referenced by buff2sysopts(), resetsysopts(), and sysopts2buff().

◆ exsats_

char exsats_[1024]
static

Definition at line 43 of file mrtk_options.c.

Referenced by buff2sysopts(), resetsysopts(), and sysopts2buff().

◆ filopt_

filopt_t filopt_
static

Definition at line 39 of file mrtk_options.c.

Referenced by getsysopts(), resetsysopts(), and setsysopts().

◆ prcopt_

prcopt_t prcopt_
static

Definition at line 37 of file mrtk_options.c.

Referenced by buff2sysopts(), getsysopts(), resetsysopts(), setsysopts(), str2opt(), and sysopts2buff().

◆ signals_

char signals_[1024]
static

Definition at line 45 of file mrtk_options.c.

Referenced by buff2sysopts(), and resetsysopts().

◆ snrmask_

char snrmask_[5][1024]
static

Definition at line 44 of file mrtk_options.c.

Referenced by buff2sysopts(), and sysopts2buff().

◆ solopt_

solopt_t solopt_
static

Definition at line 38 of file mrtk_options.c.

Referenced by getsysopts(), resetsysopts(), and setsysopts().

◆ sysopts

opt_t sysopts[]

System options table.

Note
Terminated with an entry where name[0]=='\0'.

Definition at line 90 of file mrtk_options.c.