MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_streamsvr.c File Reference

Stream server functions for data relay and format conversion. More...

#include "mrtklib/rtklib.h"
Include dependency graph for mrtk_streamsvr.c:

Go to the source code of this file.

Functions

static int is_obsmsg (int msg)
static int is_navmsg (int msg)
static int is_stamsg (int msg)
static int is_tint (gtime_t time, double tint)
strconv_t * strconvnew (int itype, int otype, const char *msgs, int staid, int stasel, const char *opt)
void strconvfree (strconv_t *conv)
static void raw2rtcm (rtcm_t *out, const raw_t *raw, int ret)
static void rtcm2rtcm (rtcm_t *out, const rtcm_t *rtcm, int ret, int stasel)
static void write_rtcm3_msm (stream_t *str, rtcm_t *out, int msg, int sync)
static void write_obs (gtime_t time, stream_t *str, strconv_t *conv)
static void write_nav (gtime_t time, stream_t *str, strconv_t *conv)
static int nextsat (nav_t *nav, int sat, int msg)
static void write_nav_cycle (stream_t *str, strconv_t *conv)
static void write_sta_cycle (stream_t *str, strconv_t *conv)
static void strconv (stream_t *str, strconv_t *conv, uint8_t *buff, int n)
static void periodic_cmd (int cycle, const char *cmd, stream_t *stream)
static void * strsvrthread (void *arg)
void strsvrinit (strsvr_t *svr, int nout)
int strsvrstart (strsvr_t *svr, int *opts, int *strs, char **paths, char **logs, strconv_t **conv, char **cmds, char **cmds_periodic, const double *nmeapos)
void strsvrstop (strsvr_t *svr, char **cmds)
void strsvrstat (strsvr_t *svr, int *stat, int *log_stat, uint64_t *byte, int *bps, char *msg)
 Get stream server status.
int strsvrpeek (strsvr_t *svr, uint8_t *buff, int nmax)

Detailed Description

Stream server functions for data relay and format conversion.

version : $Revision:$ $Date:$ history : 2010/07/18 1.0 moved from stream.c 2011/01/18 1.1 change api strsvrstart() 2012/12/04 1.2 add stream conversion function 2012/12/25 1.3 fix bug on cyclic navigation data output suppress warnings 2013/05/08 1.4 fix bug on 1 s offset for javad -> rtcm conversion 2014/10/16 1.5 support input from stdout 2015/12/05 1.6 support rtcm 3 mt 63 beidou ephemeris 2016/07/23 1.7 change api strsvrstart(),strsvrstop() support command for output streams 2016/08/20 1.8 support api change of sendnmea() 2016/09/03 1.9 support ntrip caster function 2016/09/06 1.10 add api strsvrsetsrctbl() 2016/09/17 1.11 add relay back function of output stream fix bug on rtcm cyclic output of beidou ephemeris 2016/10/01 1.12 change api startstrserver() 2017/04/11 1.13 fix bug on search of next satellite in nextsat() 2018/11/05 1.14 update message type of beidou ephemeirs support multiple msm messages if nsat x nsig > 64 2020/11/30 1.15 support RTCM MT1131-1137,1041 (NavIC/IRNSS) add log paths in API strsvrstart() add log status in API strsvrstat() support multiple ephemeris sets (e.g. I/NAV-F/NAV) delete API strsvrsetsrctbl() use integer types in stdint.h

Definition in file mrtk_streamsvr.c.

Function Documentation

◆ is_navmsg()

int is_navmsg ( int msg)
static

Definition at line 49 of file mrtk_streamsvr.c.

Referenced by write_nav(), and write_nav_cycle().

Here is the caller graph for this function:

◆ is_obsmsg()

int is_obsmsg ( int msg)
static

Definition at line 43 of file mrtk_streamsvr.c.

Referenced by write_obs().

Here is the caller graph for this function:

◆ is_stamsg()

int is_stamsg ( int msg)
static

Definition at line 54 of file mrtk_streamsvr.c.

Referenced by write_sta_cycle().

Here is the caller graph for this function:

◆ is_tint()

int is_tint ( gtime_t time,
double tint )
static

Definition at line 58 of file mrtk_streamsvr.c.

References DTTOL, and time2gpst().

Referenced by write_obs().

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

◆ nextsat()

int nextsat ( nav_t * nav,
int sat,
int msg )
static

Definition at line 321 of file mrtk_streamsvr.c.

References nav_s::eph, nav_s::geph, MAXPRNCMP, MAXPRNGAL, MAXPRNGLO, MAXPRNGPS, MAXPRNIRN, MAXPRNQZS, MAXSAT, MINPRNCMP, MINPRNGAL, MINPRNGLO, MINPRNGPS, MINPRNIRN, MINPRNQZS, eph_t::sat, geph_t::sat, satno(), satsys(), SYS_CMP, SYS_GAL, SYS_GLO, SYS_GPS, SYS_IRN, and SYS_QZS.

Referenced by write_nav_cycle().

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

◆ periodic_cmd()

void periodic_cmd ( int cycle,
const char * cmd,
stream_t * stream )
static

Definition at line 476 of file mrtk_streamsvr.c.

References strsendcmd().

Referenced by strsvrthread().

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

◆ raw2rtcm()

void raw2rtcm ( rtcm_t * out,
const raw_t * raw,
int ret )
static

Definition at line 131 of file mrtk_streamsvr.c.

References obs_t::data, nav_s::eph, raw_t::ephsat, rtcm_t::ephsat, raw_t::ephset, rtcm_t::ephset, nav_s::geph, nav_s::glo_fcn, nav_s::ion_cmp, nav_s::ion_gal, nav_s::ion_gps, nav_s::ion_irn, nav_s::ion_qzs, matcpy(), MAXSAT, obs_t::n, raw_t::nav, rtcm_t::nav, raw_t::obs, rtcm_t::obs, obsd_t::sat, satsys(), raw_t::sta, rtcm_t::sta, SYS_CMP, SYS_GAL, SYS_GLO, SYS_GPS, SYS_IRN, SYS_QZS, obsd_t::time, raw_t::time, rtcm_t::time, nav_s::utc_cmp, nav_s::utc_gal, nav_s::utc_glo, nav_s::utc_gps, nav_s::utc_irn, nav_s::utc_qzs, and nav_s::utc_sbs.

Referenced by strconv().

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

◆ rtcm2rtcm()

void rtcm2rtcm ( rtcm_t * out,
const rtcm_t * rtcm,
int ret,
int stasel )
static

Definition at line 178 of file mrtk_streamsvr.c.

References obs_t::data, nav_s::eph, rtcm_t::ephsat, rtcm_t::ephset, nav_s::geph, nav_s::glo_fcn, MAXSAT, obs_t::n, rtcm_t::nav, rtcm_t::obs, rtcm, satsys(), rtcm_t::sta, rtcm_t::staid, SYS_CMP, SYS_GAL, SYS_GLO, SYS_GPS, SYS_IRN, SYS_QZS, and rtcm_t::time.

Referenced by strconv().

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

◆ strconv()

void strconv ( stream_t * str,
strconv_t * conv,
uint8_t * buff,
int n )
static

Definition at line 442 of file mrtk_streamsvr.c.

References input_raw(), input_rtcm2(), input_rtcm3(), strconv_t::itype, strconv_t::out, strconv_t::raw, raw2rtcm(), strconv_t::rtcm, rtcm2rtcm(), strconv_t::stasel, STRFMT_RTCM2, STRFMT_RTCM3, rtcm_t::time, write_nav(), write_nav_cycle(), write_obs(), and write_sta_cycle().

Referenced by strsvrthread().

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

◆ strconvfree()

void strconvfree ( strconv_t * conv)
extern

Definition at line 123 of file mrtk_streamsvr.c.

References free, free_raw(), free_rtcm(), strconv_t::out, strconv_t::raw, and strconv_t::rtcm.

Here is the call graph for this function:

◆ strconvnew()

strconv_t * strconvnew ( int itype,
int otype,
const char * msgs,
int staid,
int stasel,
const char * opt )
extern

Definition at line 72 of file mrtk_streamsvr.c.

References calloc, strconv_t::ephsat, free, free_rtcm(), init_raw(), init_rtcm(), strconv_t::itype, strconv_t::msgs, strconv_t::nmsg, raw_t::opt, rtcm_t::opt, strconv_t::otype, strconv_t::out, strconv_t::raw, strconv_t::rtcm, rtcm_t::staid, strconv_t::stasel, strconv_t::tick, tickget(), and strconv_t::tint.

Here is the call graph for this function:

◆ strsvrinit()

void strsvrinit ( strsvr_t * svr,
int nout )
extern

Definition at line 584 of file mrtk_streamsvr.c.

References strsvr_t::buff, strsvr_t::buffsize, strsvr_t::cmds_periodic, strsvr_t::conv, strsvr_t::cycle, strsvr_t::lock, strsvr_t::nmeacycle, strsvr_t::nmeapos, strsvr_t::npb, strsvr_t::nstr, strsvr_t::pbuf, strsvr_t::relayback, rtk_initlock, strsvr_t::state, strsvr_t::stream, strinit(), strsvr_t::strlog, strsvr_t::thread, strsvr_t::tick, and tracet().

Here is the call graph for this function:

◆ strsvrpeek()

int strsvrpeek ( strsvr_t * svr,
uint8_t * buff,
int nmax )
extern

◆ strsvrstart()

int strsvrstart ( strsvr_t * svr,
int * opts,
int * strs,
char ** paths,
char ** logs,
strconv_t ** conv,
char ** cmds,
char ** cmds_periodic,
const double * nmeapos )
extern

◆ strsvrstat()

void strsvrstat ( strsvr_t * svr,
int * stat,
int * log_stat,
uint64_t * byte,
int * bps,
char * msg )
extern

Get stream server status.

Parameters
[in]svrstream server
[out]statstatus of each stream [svr->nstr]
[out]log_statstatus of each stream log [svr->nstr]
[out]bytebytes received (stream 0) / sent (others) [svr->nstr]
[out]bpsbit rate received / sent [svr->nstr]
[out]msgstatus messages

Definition at line 760 of file mrtk_streamsvr.c.

References MAXSTRMSG, strsvr_t::nstr, strsvr_t::stream, strsvr_t::strlog, strstat(), strsum(), and tracet().

Here is the call graph for this function:

◆ strsvrstop()

void strsvrstop ( strsvr_t * svr,
char ** cmds )
extern

Definition at line 738 of file mrtk_streamsvr.c.

References strsvr_t::nstr, strsvr_t::state, strsvr_t::stream, strsendcmd(), strsvr_t::thread, and tracet().

Here is the call graph for this function:

◆ strsvrthread()

void * strsvrthread ( void * arg)
static

Definition at line 509 of file mrtk_streamsvr.c.

References strsvr_t::buff, strsvr_t::buffsize, strsvr_t::cmds_periodic, strsvr_t::conv, strsvr_t::cycle, free, strsvr_t::lock, matcpy(), strsvr_t::nmeacycle, strsvr_t::nmeapos, strsvr_t::npb, strsvr_t::nstr, strsvr_t::pbuf, periodic_cmd(), strsvr_t::relayback, sol_t::rr, rtk_lock, rtk_unlock, sleepms(), SOLQ_SINGLE, sol_t::stat, strsvr_t::state, strclose(), strconv(), strsvr_t::stream, strsvr_t::strlog, strread(), strsendnmea(), strwrite(), strsvr_t::tick, tickget(), sol_t::time, timeget(), tracet(), and utc2gpst().

Referenced by strsvrstart().

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

◆ write_nav()

void write_nav ( gtime_t time,
stream_t * str,
strconv_t * conv )
static

Definition at line 302 of file mrtk_streamsvr.c.

References rtcm_t::buff, gen_rtcm2(), gen_rtcm3(), is_navmsg(), strconv_t::msgs, rtcm_t::nbyte, strconv_t::nmsg, strconv_t::otype, strconv_t::out, STRFMT_RTCM2, STRFMT_RTCM3, strwrite(), and strconv_t::tint.

Referenced by strconv().

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

◆ write_nav_cycle()

void write_nav_cycle ( stream_t * str,
strconv_t * conv )
static

Definition at line 386 of file mrtk_streamsvr.c.

References rtcm_t::buff, rtcm_t::ephsat, strconv_t::ephsat, gen_rtcm2(), gen_rtcm3(), is_navmsg(), strconv_t::msgs, rtcm_t::nav, rtcm_t::nbyte, nextsat(), strconv_t::nmsg, strconv_t::otype, strconv_t::out, STRFMT_RTCM2, STRFMT_RTCM3, strwrite(), strconv_t::tick, tickget(), and strconv_t::tint.

Referenced by strconv().

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

◆ write_obs()

void write_obs ( gtime_t time,
stream_t * str,
strconv_t * conv )
static

Definition at line 274 of file mrtk_streamsvr.c.

References rtcm_t::buff, gen_rtcm2(), gen_rtcm3(), is_obsmsg(), is_tint(), strconv_t::msgs, rtcm_t::nbyte, strconv_t::nmsg, strconv_t::otype, strconv_t::out, STRFMT_RTCM2, STRFMT_RTCM3, strwrite(), strconv_t::tint, and write_rtcm3_msm().

Referenced by strconv().

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

◆ write_rtcm3_msm()

void write_rtcm3_msm ( stream_t * str,
rtcm_t * out,
int msg,
int sync )
static

Definition at line 213 of file mrtk_streamsvr.c.

References rtcm_t::buff, obs_t::data, gen_rtcm3(), MAXCODE, MAXOBS, obs_t::n, rtcm_t::nbyte, rtcm_t::obs, satsys(), strwrite(), SYS_CMP, SYS_GAL, SYS_GLO, SYS_GPS, SYS_IRN, SYS_QZS, and SYS_SBS.

Referenced by write_obs().

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

◆ write_sta_cycle()

void write_sta_cycle ( stream_t * str,
strconv_t * conv )
static

Definition at line 417 of file mrtk_streamsvr.c.

References rtcm_t::buff, gen_rtcm2(), gen_rtcm3(), is_stamsg(), strconv_t::msgs, rtcm_t::nbyte, strconv_t::nmsg, strconv_t::otype, strconv_t::out, STRFMT_RTCM2, STRFMT_RTCM3, strwrite(), strconv_t::tick, tickget(), and strconv_t::tint.

Referenced by strconv().

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