From f71e2a988063d15f6fdf7161e6acaa909b3f6c1f Mon Sep 17 00:00:00 2001 From: oaq Date: Fri, 12 Jun 2026 11:40:51 +1000 Subject: [PATCH 1/2] rtknavi_qt: keep the stream details even if disabled When the options were opened the stream details were copied over only when the stream was enabled which lost the stream details when disabled. Change this to keep the stream details even if disabled, so that a stream can be disabled and re-enabled without having to reenter all the details. --- app/qtapp/rtknavi_qt/navimain.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/qtapp/rtknavi_qt/navimain.cpp b/app/qtapp/rtknavi_qt/navimain.cpp index 1f3f4db6b..673fd6443 100644 --- a/app/qtapp/rtknavi_qt/navimain.cpp +++ b/app/qtapp/rtknavi_qt/navimain.cpp @@ -514,10 +514,8 @@ void MainWindow::showOptionsDialog() strfmt[i] = inputFormat[i]; - if (!streamEnabled[i]) { - strtype[i] = STR_NONE; - strncpy(strpath[i], "", MAXSTR-1); - } else if (strtype[i] == STR_SERIAL) { + strncpy(strpath[i], "", MAXSTR-1); + if (strtype[i] == STR_SERIAL) { strncpy(strpath[i], qPrintable(paths[i][0]), MAXSTR-1); } else if (strtype[i] == STR_FILE) { strncpy(strpath[i], qPrintable(paths[i][2]), MAXSTR-1); From 7d5d2f6a6a05cbf15c175b7c9c62349c0f3feb16 Mon Sep 17 00:00:00 2001 From: oaq Date: Fri, 3 Oct 2025 18:53:42 +1000 Subject: [PATCH 2/2] rtkrcv, rtknavi: support more input and solution out streams Move towards the number of input and output streams being a compilation option, adding the RTKSVRNIN, and RTKSVRNSOL defines and also make better use of MAXSTRRTK rather than baking in constants. Move the output streams to the end of the stream index range so that adding more does not affect indices of the input and log streams. rtkrcv and rtknavi now accepts one more input and one more output stream, and rtkrcv now builds with up to 5 input and 6 output streams and could support more by simply adding move config options for them. --- app/consapp/rtkrcv/gcc/makefile | 2 +- app/consapp/rtkrcv/rtkrcv.c | 215 +++++++++++++-------- app/qtapp/rtknavi_qt/instrdlg.cpp | 104 ++++++++--- app/qtapp/rtknavi_qt/instrdlg.h | 14 +- app/qtapp/rtknavi_qt/instrdlg.ui | 112 ++++++++++- app/qtapp/rtknavi_qt/logstrdlg.cpp | 61 ++++-- app/qtapp/rtknavi_qt/logstrdlg.h | 6 +- app/qtapp/rtknavi_qt/logstrdlg.ui | 76 +++++++- app/qtapp/rtknavi_qt/mondlg.cpp | 100 +++++----- app/qtapp/rtknavi_qt/mondlg.ui | 16 +- app/qtapp/rtknavi_qt/navimain.cpp | 233 ++++++++++++----------- app/qtapp/rtknavi_qt/navimain.h | 6 +- app/qtapp/rtknavi_qt/navimain.ui | 82 ++++++-- app/qtapp/rtknavi_qt/outstrdlg.cpp | 74 ++++++-- app/qtapp/rtknavi_qt/outstrdlg.h | 6 +- app/qtapp/rtknavi_qt/outstrdlg.ui | 215 +++++++++++++++------ app/winapp/rtknavi/instrdlg.cpp | 88 ++++++++- app/winapp/rtknavi/instrdlg.dfm | 164 +++++++++++++--- app/winapp/rtknavi/instrdlg.h | 21 ++- app/winapp/rtknavi/logstrdlg.cpp | 45 ++++- app/winapp/rtknavi/logstrdlg.dfm | 100 ++++++++-- app/winapp/rtknavi/logstrdlg.h | 13 +- app/winapp/rtknavi/mondlg.cpp | 59 +++--- app/winapp/rtknavi/mondlg.dfm | 10 +- app/winapp/rtknavi/navimain.cpp | 140 +++++++------- app/winapp/rtknavi/navimain.dfm | 113 +++++++---- app/winapp/rtknavi/navimain.h | 9 +- app/winapp/rtknavi/naviopt.cpp | 64 ++++--- app/winapp/rtknavi/naviopt.h | 1 + app/winapp/rtknavi/outstrdlg.cpp | 40 ++++ app/winapp/rtknavi/outstrdlg.dfm | 290 ++++++++++++++++++----------- app/winapp/rtknavi/outstrdlg.h | 18 +- src/rtklib.h | 40 ++-- src/rtksvr.c | 134 +++++++------ 34 files changed, 1864 insertions(+), 807 deletions(-) diff --git a/app/consapp/rtkrcv/gcc/makefile b/app/consapp/rtkrcv/gcc/makefile index fdde9a9c7..520287ba0 100644 --- a/app/consapp/rtkrcv/gcc/makefile +++ b/app/consapp/rtkrcv/gcc/makefile @@ -3,7 +3,7 @@ BINDIR = /usr/local/bin SRC = ../../../../src -CTARGET= -DTRACE -DENAGLO -DENAQZS -DENACMP -DENAGAL -DENAIRN -DNFREQ=4 -DNEXOBS=3 -DSVR_REUSEADDR +CTARGET= -DTRACE -DENAGLO -DENAQZS -DENACMP -DENAGAL -DENAIRN -DNFREQ=4 -DNEXOBS=3 -DSVR_REUSEADDR -DRTKSVRNIN=5 -DRTKSVRNSOL=6 #CTARGET= -DENAGLO -DENAQZS -DENACMP -DENAGAL -DENAIRN -DNFREQ=4 -DIERS_MODEL -DSVR_REUSEADDR CFLAGS = -std=c99 -Wall -O3 -pedantic -Wno-unused-but-set-variable -I$(SRC) -I.. -DTRACE $(CTARGET) -g diff --git a/app/consapp/rtkrcv/rtkrcv.c b/app/consapp/rtkrcv/rtkrcv.c index f0eba0b1c..fe4480391 100644 --- a/app/consapp/rtkrcv/rtkrcv.c +++ b/app/consapp/rtkrcv/rtkrcv.c @@ -91,14 +91,11 @@ static char passwd[MAXSTR]="admin"; /* login password */ static int timetype =0; /* time format (0:gpst,1:utc,2:jst,3:tow) */ static int soltype =0; /* sol format (0:dms,1:deg,2:xyz,3:enu,4:pyl) */ static int solflag =2; /* sol flag (1:std+2:age/ratio/ns) */ -static int strtype[]={ /* stream types */ - STR_SERIAL,STR_NONE,STR_NONE,STR_NONE,STR_NONE,STR_NONE,STR_NONE,STR_NONE -}; -static char strpath[8][MAXSTR]={"","","","","","","",""}; /* stream paths */ -static int strfmt[]={ /* stream formats */ - STRFMT_UBX,STRFMT_RTCM3,STRFMT_SP3,SOLF_LLH,SOLF_NMEA -}; -static char rcvopt[3][256]={""}; /* Receiver options */ +static int strtype[MAXSTRRTK]; /* stream types */ +static char strpath[MAXSTRRTK][MAXSTR]; /* stream paths */ +static int strfmt[RTKSVRNIN]; /* Input stream formats */ +static int ostrfmt[RTKSVRNSOL]; /* Output stream formats */ +static char rcvopt[RTKSVRNIN][256]; /* Receiver options */ static int svrcycle =10; /* server cycle (ms) */ static int timeout =10000; /* timeout time (ms) */ static int reconnect =10000; /* reconnect interval (ms) */ @@ -107,8 +104,8 @@ static int buffsize =32768; /* input buffer size (bytes) */ static int navmsgsel =0; /* navigation message select */ static char proxyaddr[256]=""; /* http/ntrip proxy */ static int nmeareq =0; /* nmea request type (0:off,1:lat/lon,2:single) */ -static double nmeapos[] ={0,0,0}; /* nmea position (lat/lon/height) (deg,m) */ -static char rcvcmds[3][MAXSTR]={""}; /* receiver commands files */ +static double nmeapos[] ={0,0,0,0}; /* nmea position (lat/lon/height) (deg,m) */ +static char rcvcmds[RTKSVRNIN][MAXSTR]; /* receiver commands files */ #ifdef RTKSHELLCMDS static char startcmd[MAXSTR]=""; /* start command */ static char stopcmd [MAXSTR]=""; /* stop command */ @@ -122,7 +119,7 @@ static int fswapmargin =30; /* file swap margin (s) */ static char sta_name[256]=""; /* station name */ static prcopt_t prcopt; /* processing options */ -static solopt_t solopt[2]={{0}}; /* solution options */ +static solopt_t solopt[RTKSVRNSOL]={{0}}; /* solution options */ static filopt_t filopt ={""}; /* file options */ /* help text -----------------------------------------------------------------*/ @@ -152,7 +149,7 @@ static const char *helptxt[]={ "observ [-n] [cycle] : show observation data", "navidata [-p] [-n] [cycle] : show navigation data", "stream [cycle] : show stream status", - "ssr [-[1,2,3]] [-c] [-p] [cycle] : show ssr corrections", + "ssr [-n] [-c] [-p] [cycle] : show ssr corrections", "error : show error/warning messages", "option [opt] : show option(s)", "set opt [val] : set option", @@ -197,33 +194,65 @@ static opt_t rcvopts[]={ {"console-solflag", 0, (void *)&solflag, FLGOPT }, {"inpstr1-type", 3, (void *)&strtype[0], ISTOPT }, - {"inpstr2-type", 3, (void *)&strtype[1], ISTOPT }, - {"inpstr3-type", 3, (void *)&strtype[2], ISTOPT }, {"inpstr1-path", 2, (void *)strpath [0], "" }, - {"inpstr2-path", 2, (void *)strpath [1], "" }, - {"inpstr3-path", 2, (void *)strpath [2], "" }, {"inpstr1-format", 3, (void *)&strfmt [0], FMTOPT }, - {"inpstr2-format", 3, (void *)&strfmt [1], FMTOPT }, - {"inpstr3-format", 3, (void *)&strfmt [2], FMTOPT }, {"inpstr1-rcvopt", 2, (void *)rcvopt[0], "" }, + {"inpstr2-type", 3, (void *)&strtype[1], ISTOPT }, + {"inpstr2-path", 2, (void *)strpath [1], "" }, + {"inpstr2-format", 3, (void *)&strfmt [1], FMTOPT }, {"inpstr2-rcvopt", 2, (void *)rcvopt[1], "" }, - {"inpstr3-rcvopt", 2, (void *)rcvopt[2], "" }, {"inpstr2-nmeareq", 3, (void *)&nmeareq, NMEOPT }, {"inpstr2-nmealat", 1, (void *)&nmeapos[0], "deg" }, {"inpstr2-nmealon", 1, (void *)&nmeapos[1], "deg" }, {"inpstr2-nmeahgt", 1, (void *)&nmeapos[2], "m" }, - {"outstr1-type", 3, (void *)&strtype[3], OSTOPT }, - {"outstr2-type", 3, (void *)&strtype[4], OSTOPT }, - {"outstr1-path", 2, (void *)strpath [3], "" }, - {"outstr2-path", 2, (void *)strpath [4], "" }, - {"outstr1-format", 3, (void *)&strfmt [3], SOLOPT }, - {"outstr2-format", 3, (void *)&strfmt [4], SOLOPT }, - {"logstr1-type", 3, (void *)&strtype[5], OSTOPT }, - {"logstr2-type", 3, (void *)&strtype[6], OSTOPT }, - {"logstr3-type", 3, (void *)&strtype[7], OSTOPT }, - {"logstr1-path", 2, (void *)strpath [5], "" }, - {"logstr2-path", 2, (void *)strpath [6], "" }, - {"logstr3-path", 2, (void *)strpath [7], "" }, + {"inpstr3-type", 3, (void *)&strtype[2], ISTOPT }, + {"inpstr3-path", 2, (void *)strpath [2], "" }, + {"inpstr3-format", 3, (void *)&strfmt [2], FMTOPT }, + {"inpstr3-rcvopt", 2, (void *)rcvopt[2], "" }, + {"inpstr4-type", 3, (void *)&strtype[3], ISTOPT }, + {"inpstr4-path", 2, (void *)strpath [3], "" }, + {"inpstr4-format", 3, (void *)&strfmt [3], FMTOPT }, + {"inpstr4-rcvopt", 2, (void *)rcvopt[3], "" }, +#if RTKSVRNIN > 4 + {"inpstr5-type", 3, (void *)&strtype[4], ISTOPT }, + {"inpstr5-path", 2, (void *)strpath [4], "" }, + {"inpstr5-format", 3, (void *)&strfmt [4], FMTOPT }, + {"inpstr5-rcvopt", 2, (void *)rcvopt[4], "" }, +#endif + {"logstr1-type", 3, (void *)&strtype[RTKSVRNIN], OSTOPT }, + {"logstr1-path", 2, (void *)strpath [RTKSVRNIN], "" }, + {"logstr2-type", 3, (void *)&strtype[RTKSVRNIN + 1], OSTOPT }, + {"logstr2-path", 2, (void *)strpath [RTKSVRNIN + 1], "" }, + {"logstr3-type", 3, (void *)&strtype[RTKSVRNIN + 2], OSTOPT }, + {"logstr3-path", 2, (void *)strpath [RTKSVRNIN + 2], "" }, + {"logstr4-type", 3, (void *)&strtype[RTKSVRNIN + 3], OSTOPT }, + {"logstr4-path", 2, (void *)strpath [RTKSVRNIN + 3], "" }, +#if RTKSVRNIN > 4 + {"logstr5-type", 3, (void *)&strtype[RTKSVRNIN + 4], OSTOPT }, + {"logstr5-path", 2, (void *)strpath [RTKSVRNIN + 4], "" }, +#endif + {"outstr1-type", 3, (void *)&strtype[RTKSVRNIN*2], OSTOPT }, + {"outstr1-path", 2, (void *)strpath [RTKSVRNIN*2], "" }, + {"outstr1-format", 3, (void *)&ostrfmt[0], SOLOPT }, + {"outstr2-type", 3, (void *)&strtype[RTKSVRNIN*2 + 1], OSTOPT }, + {"outstr2-path", 2, (void *)strpath [RTKSVRNIN*2 + 1], "" }, + {"outstr2-format", 3, (void *)&ostrfmt[1], SOLOPT }, + {"outstr3-type", 3, (void *)&strtype[RTKSVRNIN*2 + 2], OSTOPT }, + {"outstr3-path", 2, (void *)strpath [RTKSVRNIN*2 + 2], "" }, + {"outstr3-format", 3, (void *)&ostrfmt[2], SOLOPT }, + {"outstr4-type", 3, (void *)&strtype[RTKSVRNIN*2 + 3], OSTOPT }, + {"outstr4-path", 2, (void *)strpath [RTKSVRNIN*2 + 3], "" }, + {"outstr4-format", 3, (void *)&ostrfmt[3], SOLOPT }, +#if RTKSVRNSOL > 4 + {"outstr5-type", 3, (void *)&strtype[RTKSVRNIN*2 + 4], OSTOPT }, + {"outstr5-path", 2, (void *)strpath [RTKSVRNIN*2 + 4], "" }, + {"outstr5-format", 3, (void *)&ostrfmt[4], SOLOPT }, +#endif +#if RTKSVRNSOL > 5 + {"outstr6-type", 3, (void *)&strtype[RTKSVRNIN*2 + 5], OSTOPT }, + {"outstr6-path", 2, (void *)strpath [RTKSVRNIN*2 + 5], "" }, + {"outstr6-format", 3, (void *)&ostrfmt[5], SOLOPT }, +#endif {"misc-svrcycle", 0, (void *)&svrcycle, "ms" }, {"misc-timeout", 0, (void *)&timeout, "ms" }, @@ -242,6 +271,10 @@ static opt_t rcvopts[]={ {"file-cmdfile1", 2, (void *)rcvcmds[0], "" }, {"file-cmdfile2", 2, (void *)rcvcmds[1], "" }, {"file-cmdfile3", 2, (void *)rcvcmds[2], "" }, + {"file-cmdfile4", 2, (void *)rcvcmds[3], "" }, +#if RTKSVRNSOL > 4 + {"file-cmdfile5", 2, (void *)rcvcmds[4], "" }, +#endif {"",0,NULL,""} }; @@ -433,20 +466,20 @@ static int startsvr(vt_t *vt) { static sta_t sta[MAXRCV]={{""}}; double pos[3],npos[3]; - char s1[3][MAXRCVCMD]={"","",""},*cmds[]={NULL,NULL,NULL}; - char s2[3][MAXRCVCMD]={"","",""},*cmds_periodic[]={NULL,NULL,NULL}; - char *ropts[]={rcvopt[0],rcvopt[1],rcvopt[2]}; - char *paths[]={ - strpath[0],strpath[1],strpath[2],strpath[3],strpath[4],strpath[5], - strpath[6],strpath[7] - }; + char s1[RTKSVRNIN][MAXRCVCMD],*cmds[RTKSVRNIN]; + char s2[RTKSVRNIN][MAXRCVCMD],*cmds_periodic[RTKSVRNIN]; + char *ropts[RTKSVRNIN]; + char *paths[MAXSTRRTK]; char errmsg[2048]=""; - int i,stropt[8]={0}; + int i,stropt[MAXSTRRTK]={0}; trace(3,"startsvr:\n"); - + /* read start commands from command files */ - for (i=0;i<3;i++) { + for (i=0;inmsg2[j]==0) continue; @@ -781,7 +818,7 @@ static void prstatus(vt_t *vt) if (rtcm[i]->nmsg3[0]>0) { sprintf(p,"%sother3(%d)",p>s?",":"",rtcm[i]->nmsg3[0]); } - vt_printf(vt,"%-15s %-9s: %s\n","# of rtcm messages",type[i],s); + vt_printf(vt,"%-15s %-9s: %s\n","# of rtcm messages", i < 2 ? type[i] : "corr" ,s); } vt_printf(vt,"%-28s: %s\n","solution status",sol[rtkstat]); time2str(rtk->sol.time,tstr,9); @@ -843,7 +880,7 @@ static void prstatus(vt_t *vt) done: free(rtk); - for (int i = 0; i < 3; i++) free(rtcm[i]); + for (int i = 0; i < RTKSVRNIN; i++) free(rtcm[i]); } /* print satellite -----------------------------------------------------------*/ static void prsatellite(vt_t *vt, int nf) @@ -1020,10 +1057,8 @@ static void prerror(vt_t *vt) /* print stream --------------------------------------------------------------*/ static void prstream(vt_t *vt) { - const char *ch[]={ - "input rover","input base","input corr","output sol1","output sol2", - "log rover","log base","log corr","monitor" - }; + const char *inch[]={"input rover","input base"}; + const char *logch[]={"log rover","log base"}; const char *type[]={ "-","serial","file","tcpsvr","tcpcli","ntrips","ntripc","ftp", "http","ntripcas","udpsvr","udpcli","membuf" @@ -1031,25 +1066,32 @@ static void prstream(vt_t *vt) const char *fmt[]={"rtcm2","rtcm3","oem4","","ubx","swift","hemis","skytreq", "javad","nvs","binex","rt17","sbf","","unicore","sp3",""}; const char *sol[]={"llh","xyz","enu","nmea","stat","-"}; - stream_t stream[9]; - int i,format[9]={0}; + stream_t stream[MAXSTRRTK+1]; + int i,format[MAXSTRRTK+1]={0}; trace(4,"prstream:\n"); rtksvrlock(&svr); - for (i=0;i<8;i++) stream[i]=svr.stream[i]; - for (i=0;i<3;i++) format[i]=svr.format[i]; - for (i=3;i<5;i++) format[i]=svr.solopt[i-3].posf; - stream[8]=moni; - format[8]=SOLF_LLH; + for (i=0;i=RTKSVRNIN*2?sol[format[i]]:"-"), stream[i].state<0?"E":(stream[i].state?"C":"-"), stream[i].inb,stream[i].inr,stream[i].outb,stream[i].outr, stream[i].path,stream[i].msg); @@ -1067,7 +1109,7 @@ static void prssr(vt_t *vt, int ri, int cbias, int pbias) rtksvrlock(&svr); time=svr.rtk.sol.time; for (i=0;i 3) + if (ri <= 0 || ri > RTKSVRNIN) ssr[i] = svr.nav.ssr[i]; else ssr[i] = svr.rtcm[ri - 1].ssr[i]; @@ -1355,7 +1397,7 @@ static void cmd_set(char **args, int narg, vt_t *vt) return; } getsysopts(&prcopt,solopt,&filopt); - solopt[1]=solopt[0]; + for (int i = 1; i < RTKSVRNSOL; i++) solopt[i] = solopt[0]; vt_printf(vt,"option %s changed.",opt->name); if (strncmp(opt->name,"console",7)) { @@ -1460,7 +1502,7 @@ static void cmd_load(char **args, int narg, vt_t *vt) return; } getsysopts(&prcopt,solopt,&filopt); - solopt[1]=solopt[0]; + for (int i = 1; i < RTKSVRNSOL; i++) solopt[i] = solopt[0]; if (!loadopts(file,rcvopts)) { vt_printf(vt,"no options file: %s\n",file); @@ -1819,8 +1861,8 @@ static void daemonise(void) * stream [cycle] * Show stream status. Use option cycle for cyclic display. * -* ssr [-[1,2,3]] [-c] [-p] [cycle] -* Show the RTCM SSR state. Option -1 -2 or -3 selects the respective +* ssr [-n] [-c] [-p] [cycle] +* Show the RTCM SSR state. Option -n selects the nth respective * input, output, or correction RTCM stream index otherwise the combined * ssr state is used. Option -c includes code biases and option -p * includes phase biases. Use option cycle for cyclic display. @@ -1910,6 +1952,21 @@ int main(int argc, char **argv) traceopen(TRACEFILE); tracelevel(trace); } + + // Default input streams. + for (int i = 0; i < RTKSVRNIN; i++) { + strtype[i] = STR_NONE; + strpath[i][0] = '\0'; + strfmt[i] = STRFMT_RTCM3; + rcvopt[i][0] = rcvcmds[i][0] = '\0'; + } + // Default output streams. + for (int i = 0; i < RTKSVRNSOL; i++) { + strtype[RTKSVRNIN * 2 + i] = STR_NONE; + strcpy(strpath[RTKSVRNIN * 2 + i], ""); + ostrfmt[i] = i == 0 ? SOLF_LLH : SOLF_NMEA; + } + /* initialize rtk server and monitor port */ rtksvrinit(&svr); strinit(&moni); @@ -1922,8 +1979,8 @@ int main(int argc, char **argv) fprintf(stderr,"no options file: %s. defaults used\n",file); } getsysopts(&prcopt,solopt,&filopt); - /* Copy the system options for the second output solution stream */ - solopt[1]=solopt[0]; + /* Copy the system options for the other output solution streams */ + for (int i = 1; i < RTKSVRNSOL; i++) solopt[i] = solopt[0]; /* read navigation data */ if (!readnav(NAVIFILE,&svr.nav)) { diff --git a/app/qtapp/rtknavi_qt/instrdlg.cpp b/app/qtapp/rtknavi_qt/instrdlg.cpp index 79c62b1a5..32cbc59c5 100644 --- a/app/qtapp/rtknavi_qt/instrdlg.cpp +++ b/app/qtapp/rtknavi_qt/instrdlg.cpp @@ -33,6 +33,7 @@ InputStrDialog::InputStrDialog(QWidget *parent) ui->cBFormat1->addItem(formatstrs[i]); ui->cBFormat2->addItem(formatstrs[i]); ui->cBFormat3->addItem(formatstrs[i]); + ui->cBFormat4->addItem(formatstrs[i]); noFormats++; } ui->cBFormat3->addItem(tr("SP3")); @@ -51,6 +52,7 @@ InputStrDialog::InputStrDialog(QWidget *parent) ui->lEFilePath1->setCompleter(new QCompleter(fileModel, this)); ui->lEFilePath2->setCompleter(new QCompleter(fileModel, this)); ui->lEFilePath3->setCompleter(new QCompleter(fileModel, this)); + ui->lEFilePath4->setCompleter(new QCompleter(fileModel, this)); // line edit actions QAction *aclEFilePath1Select = ui->lEFilePath1->addAction(QIcon(":/buttons/folder"), QLineEdit::TrailingPosition); @@ -59,6 +61,8 @@ InputStrDialog::InputStrDialog(QWidget *parent) aclEFilePath2Select->setToolTip(tr("Select File")); QAction *aclEFilePath3Select = ui->lEFilePath3->addAction(QIcon(":/buttons/folder"), QLineEdit::TrailingPosition); aclEFilePath3Select->setToolTip(tr("Select File")); + QAction *aclEFilePath4Select = ui->lEFilePath4->addAction(QIcon(":/buttons/folder"), QLineEdit::TrailingPosition); + aclEFilePath4Select->setToolTip(tr("Select File")); connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &InputStrDialog::accept); connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &InputStrDialog::reject); @@ -66,59 +70,65 @@ InputStrDialog::InputStrDialog(QWidget *parent) connect(ui->btnCmd1, &QPushButton::clicked, this, &InputStrDialog::showCommandDialog1); connect(ui->btnCmd2, &QPushButton::clicked, this, &InputStrDialog::showCommandDialog2); connect(ui->btnCmd3, &QPushButton::clicked, this, &InputStrDialog::showCommandDialog3); + connect(ui->btnCmd4, &QPushButton::clicked, this, &InputStrDialog::showCommandDialog4); connect(aclEFilePath1Select, &QAction::triggered, this, &InputStrDialog::selectFile1); connect(aclEFilePath2Select, &QAction::triggered, this, &InputStrDialog::selectFile2); connect(aclEFilePath3Select, &QAction::triggered, this, &InputStrDialog::selectFile3); + connect(aclEFilePath4Select, &QAction::triggered, this, &InputStrDialog::selectFile4); connect(ui->btnReceiverOptions1, &QPushButton::clicked, this, &InputStrDialog::showReceiverOptions1); connect(ui->btnReceiverOptions2, &QPushButton::clicked, this, &InputStrDialog::showReceiverOptions2); connect(ui->btnReceiverOptions3, &QPushButton::clicked, this, &InputStrDialog::showReceiverOptions3); + connect(ui->btnReceiverOptions4, &QPushButton::clicked, this, &InputStrDialog::showReceiverOptions4); connect(ui->btnStream1, &QPushButton::clicked, this, &InputStrDialog::showStreamOptions1); connect(ui->btnStream2, &QPushButton::clicked, this, &InputStrDialog::showStreamOptions2); connect(ui->btnStream3, &QPushButton::clicked, this, &InputStrDialog::showStreamOptions3); + connect(ui->btnStream4, &QPushButton::clicked, this, &InputStrDialog::showStreamOptions4); connect(ui->cBStreamC1, &QCheckBox::clicked, this, &InputStrDialog::updateEnable); connect(ui->cBStreamC2, &QCheckBox::clicked, this, &InputStrDialog::updateEnable); connect(ui->cBStreamC3, &QCheckBox::clicked, this, &InputStrDialog::updateEnable); + connect(ui->cBStreamC4, &QCheckBox::clicked, this, &InputStrDialog::updateEnable); connect(ui->cBStream1, static_cast(&QComboBox::currentIndexChanged), this, &InputStrDialog::updateEnable); connect(ui->cBStream2, static_cast(&QComboBox::currentIndexChanged), this, &InputStrDialog::updateEnable); connect(ui->cBStream3, static_cast(&QComboBox::currentIndexChanged), this, &InputStrDialog::updateEnable); + connect(ui->cBStream4, static_cast(&QComboBox::currentIndexChanged), this, &InputStrDialog::updateEnable); connect(ui->cBNmeaRequestType, static_cast(&QComboBox::currentIndexChanged), this, &InputStrDialog::updateEnable); connect(ui->cBTimeTag, &QCheckBox::clicked, this, &InputStrDialog::updateEnable); } //--------------------------------------------------------------------------- void InputStrDialog::setStreamEnabled(int stream, int enabled) { - QCheckBox *cBStreamC[] = {ui->cBStreamC1, ui->cBStreamC2, ui->cBStreamC3}; - if ((stream < 0 ) || (stream > 2)) return; + QCheckBox *cBStreamC[] = {ui->cBStreamC1, ui->cBStreamC2, ui->cBStreamC3, ui->cBStreamC4}; + if ((stream < 0 ) || (stream >= RTKSVRNIN)) return; cBStreamC[stream]->setChecked(enabled); updateEnable(); } //--------------------------------------------------------------------------- int InputStrDialog::getStreamEnabled(int stream) { - QCheckBox *cBStreamC[] = {ui->cBStreamC1, ui->cBStreamC2, ui->cBStreamC3}; - if ((stream < 0 ) || (stream > 2)) return false; + QCheckBox *cBStreamC[] = {ui->cBStreamC1, ui->cBStreamC2, ui->cBStreamC3, ui->cBStreamC4}; + if ((stream < 0 ) || (stream >= RTKSVRNIN)) return false; return cBStreamC[stream]->isChecked(); } //--------------------------------------------------------------------------- void InputStrDialog::setStreamType(int stream, int type) { - QComboBox *cBStream[] = {ui->cBStream1, ui->cBStream2, ui->cBStream3}; - if ((stream < 0 ) || (stream > 2)) return; + QComboBox *cBStream[] = {ui->cBStream1, ui->cBStream2, ui->cBStream3, ui->cBStream4}; + if ((stream < 0 ) || (stream >= RTKSVRNIN)) return; cBStream[stream]->setCurrentIndex(type); updateEnable(); } //--------------------------------------------------------------------------- int InputStrDialog::getStreamType(int stream) { - QComboBox *cBStream[] = {ui->cBStream1, ui->cBStream2, ui->cBStream3}; - if ((stream < 0 ) || (stream > 2)) return STR_NONE; + QComboBox *cBStream[] = {ui->cBStream1, ui->cBStream2, ui->cBStream3, ui->cBStream4}; + if ((stream < 0 ) || (stream >= RTKSVRNIN)) return STR_NONE; return cBStream[stream]->currentIndex(); } //--------------------------------------------------------------------------- void InputStrDialog::setStreamFormat(int stream, int format) { - QComboBox *cBFormat[] = {ui->cBFormat1, ui->cBFormat2, ui->cBFormat3}; - if ((stream < 0 ) || (stream > 2)) return; + QComboBox *cBFormat[] = {ui->cBFormat1, ui->cBFormat2, ui->cBFormat3, ui->cBFormat4}; + if ((stream < 0 ) || (stream >= RTKSVRNIN)) return; if (stream == 0) cBFormat[stream]->setCurrentIndex(format); else @@ -129,8 +139,8 @@ void InputStrDialog::setStreamFormat(int stream, int format) //--------------------------------------------------------------------------- int InputStrDialog::getStreamFormat(int stream) { - QComboBox *cBFormat[] = {ui->cBFormat1, ui->cBFormat2, ui->cBFormat3}; - if ((stream < 0 ) || (stream > 2)) return STRFMT_RTCM2; // should never happen + QComboBox *cBFormat[] = {ui->cBFormat1, ui->cBFormat2, ui->cBFormat3, ui->cBFormat4}; + if ((stream < 0 ) || (stream >= RTKSVRNIN)) return STRFMT_RTCM2; // should never happen if (stream == 0) return cBFormat[stream]->currentIndex(); else @@ -139,13 +149,13 @@ int InputStrDialog::getStreamFormat(int stream) //--------------------------------------------------------------------------- void InputStrDialog::setReceiverOptions(int stream, const QString & options) { - if ((stream < 0 ) || (stream > 2)) return; + if ((stream < 0 ) || (stream >= RTKSVRNIN)) return; receiverOptions[stream] = options; } //--------------------------------------------------------------------------- QString InputStrDialog::getReceiverOptions(int stream) { - if ((stream < 0 ) || (stream > 2)) return ""; + if ((stream < 0 ) || (stream >= RTKSVRNIN)) return ""; return receiverOptions[stream]; } //--------------------------------------------------------------------------- @@ -260,7 +270,7 @@ QString InputStrDialog::getStationPositionFile() //--------------------------------------------------------------------------- void InputStrDialog::setCommands(int stream, int type, const QString &cmd) { - if ((stream < 0) || (stream > 2)) return; + if ((stream < 0) || (stream >= RTKSVRNIN)) return; if ((type < 0) || (type > 2)) return; commands[stream][type]= cmd; @@ -268,7 +278,7 @@ void InputStrDialog::setCommands(int stream, int type, const QString &cmd) //--------------------------------------------------------------------------- QString InputStrDialog::getCommands(int stream, int type) { - if ((stream < 0) || (stream > 2)) return QString(); + if ((stream < 0) || (stream >= RTKSVRNIN)) return QString(); if ((type < 0) || (type > 2)) return QString(); return commands[stream][type]; @@ -276,7 +286,7 @@ QString InputStrDialog::getCommands(int stream, int type) //--------------------------------------------------------------------------- void InputStrDialog::setCommandsEnabled(int stream, int type, bool ena) { - if ((stream < 0) || (stream > 2)) return; + if ((stream < 0) || (stream >= RTKSVRNIN)) return; if ((type < 0) || (type > 2)) return; commandEnable[stream][type] = ena; @@ -284,7 +294,7 @@ void InputStrDialog::setCommandsEnabled(int stream, int type, bool ena) //--------------------------------------------------------------------------- bool InputStrDialog::getCommandsEnabled(int stream, int type) { - if ((stream < 0) || (stream > 2)) return false; + if ((stream < 0) || (stream >= RTKSVRNIN)) return false; if ((type < 0) || (type > 2)) return false; return commandEnable[stream][type]; @@ -292,7 +302,7 @@ bool InputStrDialog::getCommandsEnabled(int stream, int type) //--------------------------------------------------------------------------- void InputStrDialog::setCommandsTcp(int stream, int type, const QString &cmd) { - if ((stream < 0) || (stream > 2)) return; + if ((stream < 0) || (stream >= RTKSVRNIN)) return; if ((type < 0) || (type > 2)) return; commandsTcp[stream][type] = cmd; @@ -300,7 +310,7 @@ void InputStrDialog::setCommandsTcp(int stream, int type, const QString &cmd) //--------------------------------------------------------------------------- QString InputStrDialog::getCommandsTcp(int stream, int type) { - if ((stream < 0) || (stream > 2)) return QString(); + if ((stream < 0) || (stream >= RTKSVRNIN)) return QString(); if ((type < 0) || (type > 2)) return QString(); return commandsTcp[stream][type]; @@ -308,7 +318,7 @@ QString InputStrDialog::getCommandsTcp(int stream, int type) //--------------------------------------------------------------------------- void InputStrDialog::setCommandsTcpEnabled(int stream, int type, bool ena) { - if ((stream < 0) || (stream > 2)) return; + if ((stream < 0) || (stream >= RTKSVRNIN)) return; if ((type < 0) || (type > 2)) return; commandEnableTcp[stream][type] = ena; @@ -316,7 +326,7 @@ void InputStrDialog::setCommandsTcpEnabled(int stream, int type, bool ena) //--------------------------------------------------------------------------- bool InputStrDialog::getCommandsTcpEnabled(int stream, int type) { - if ((stream < 0) || (stream > 2)) return false; + if ((stream < 0) || (stream >= RTKSVRNIN)) return false; if ((type < 0) || (type > 2)) return false; return commandEnableTcp[stream][type]; @@ -324,9 +334,9 @@ bool InputStrDialog::getCommandsTcpEnabled(int stream, int type) //--------------------------------------------------------------------------- void InputStrDialog::setPath(int stream, int type, const QString & path) { - QLineEdit *edits[] = {ui->lEFilePath1, ui->lEFilePath2, ui->lEFilePath3}; + QLineEdit *edits[] = {ui->lEFilePath1, ui->lEFilePath2, ui->lEFilePath3, ui->lEFilePath4}; - if ((stream < 0) || (stream > 2)) return; + if ((stream < 0) || (stream >= RTKSVRNIN)) return; if ((type < 0) || (type > 3)) return; paths[stream][type] = path; @@ -352,8 +362,8 @@ void InputStrDialog::setPath(int stream, int type, const QString & path) //--------------------------------------------------------------------------- QString InputStrDialog::getPath(int stream, int type) { - QLineEdit *edits[] = {ui->lEFilePath1, ui->lEFilePath2, ui->lEFilePath3}; - if ((stream < 0) || (stream > 2)) return QString(); + QLineEdit *edits[] = {ui->lEFilePath1, ui->lEFilePath2, ui->lEFilePath3, ui->lEFilePath4}; + if ((stream < 0) || (stream >= RTKSVRNIN)) return QString(); if ((type < 0) || (type > 3)) return QString(); if (type == 2) @@ -412,9 +422,21 @@ void InputStrDialog::showStreamOptions3() } } //--------------------------------------------------------------------------- +void InputStrDialog::showStreamOptions4() +{ + switch (ui->cBStream3->currentIndex()) { + case 0: showSerialOptionsDialog(3, 0); break; + case 1: showTcpOptionsDialog(3, TcpOptDialog::OPT_TCP_CLIENT); break; + case 2: showTcpOptionsDialog(3, TcpOptDialog::OPT_TCP_SERVER); break; + case 3: showTcpOptionsDialog(3, TcpOptDialog::OPT_NTRIP_CLIENT); break; + case 5: showFtpOptionsDialog(3, 0); break; + case 6: showFtpOptionsDialog(3, 1); break; + } +} +//--------------------------------------------------------------------------- void InputStrDialog::showCommandDialog(int streamNo) { - if ((streamNo < 0) || (streamNo > 2)) return; + if ((streamNo < 0) || (streamNo >= RTKSVRNIN)) return; for (int i = 0; i < 3; i++) { if (ui->cBStream1->currentIndex() == 0) { @@ -457,9 +479,14 @@ void InputStrDialog::showCommandDialog3() this->showCommandDialog(2); } //--------------------------------------------------------------------------- +void InputStrDialog::showCommandDialog4() +{ + this->showCommandDialog(3); +} +//--------------------------------------------------------------------------- void InputStrDialog::showReceiverOptionDialog(int streamNo) { - if ((streamNo < 0) || (streamNo > 2)) return; + if ((streamNo < 0) || (streamNo >= RTKSVRNIN)) return; rcvOptDialog->setOptions(receiverOptions[streamNo]); @@ -484,6 +511,11 @@ void InputStrDialog::showReceiverOptions3() this->showReceiverOptionDialog(2); } //--------------------------------------------------------------------------- +void InputStrDialog::showReceiverOptions4() +{ + this->showReceiverOptionDialog(3); +} +//--------------------------------------------------------------------------- void InputStrDialog::selectPosition() { refDialog->setRoverPosition(ui->sBNmeaPosition1->value(), ui->sBNmeaPosition2->value(), ui->sBNmeaPosition3->value()); @@ -517,6 +549,13 @@ void InputStrDialog::selectFile3() ui->lEFilePath3->setText(QDir::toNativeSeparators(dir)); } //--------------------------------------------------------------------------- +void InputStrDialog::selectFile4() +{ + QString dir = QFileDialog::getOpenFileName(this, tr("Open..."), ui->lEFilePath4->text()); + if (dir.isEmpty()) return; + ui->lEFilePath4->setText(QDir::toNativeSeparators(dir)); +} +//--------------------------------------------------------------------------- void InputStrDialog::showSerialOptionsDialog(int index, int opt) { serialOptDialog->setOptions(opt); @@ -559,24 +598,30 @@ void InputStrDialog::updateEnable() // (cBStream->currentIndex() == 4) -> File stream int enaFile = (ui->cBStreamC1->isChecked() && (ui->cBStream1->currentIndex() == 4)) || (ui->cBStreamC2->isChecked() && (ui->cBStream2->currentIndex() == 4)) || - (ui->cBStreamC3->isChecked() && (ui->cBStream3->currentIndex() == 4)); + (ui->cBStreamC3->isChecked() && (ui->cBStream3->currentIndex() == 4)) || + (ui->cBStreamC4->isChecked() && (ui->cBStream4->currentIndex() == 4)); int enaNmea = ui->cBStreamC2->isChecked() && (ui->cBStream2->currentIndex() <= 3); ui->cBStream1->setEnabled(ui->cBStreamC1->isChecked()); ui->cBStream2->setEnabled(ui->cBStreamC2->isChecked()); ui->cBStream3->setEnabled(ui->cBStreamC3->isChecked()); + ui->cBStream4->setEnabled(ui->cBStreamC4->isChecked()); ui->btnStream1->setEnabled(ui->cBStreamC1->isChecked() && ui->cBStream1->currentIndex() != 4); ui->btnStream2->setEnabled(ui->cBStreamC2->isChecked() && ui->cBStream2->currentIndex() != 4); ui->btnStream3->setEnabled(ui->cBStreamC3->isChecked() && ui->cBStream3->currentIndex() != 4); + ui->btnStream4->setEnabled(ui->cBStreamC4->isChecked() && ui->cBStream4->currentIndex() != 4); ui->btnCmd1->setEnabled(ui->cBStreamC1->isChecked() && ui->cBStream1->currentIndex() != 4); ui->btnCmd2->setEnabled(ui->cBStreamC2->isChecked() && ui->cBStream2->currentIndex() != 4); ui->btnCmd3->setEnabled(ui->cBStreamC3->isChecked() && ui->cBStream3->currentIndex() != 4); + ui->btnCmd4->setEnabled(ui->cBStreamC4->isChecked() && ui->cBStream4->currentIndex() != 4); ui->cBFormat1->setEnabled(ui->cBStreamC1->isChecked()); ui->cBFormat2->setEnabled(ui->cBStreamC2->isChecked()); ui->cBFormat3->setEnabled(ui->cBStreamC3->isChecked()); + ui->cBFormat4->setEnabled(ui->cBStreamC4->isChecked()); ui->btnReceiverOptions1->setEnabled(ui->cBStreamC1->isChecked()); ui->btnReceiverOptions2->setEnabled(ui->cBStreamC2->isChecked()); ui->btnReceiverOptions3->setEnabled(ui->cBStreamC3->isChecked()); + ui->btnReceiverOptions4->setEnabled(ui->cBStreamC4->isChecked()); ui->lblNmea->setEnabled(enaNmea); ui->cBNmeaRequestType->setEnabled(enaNmea); @@ -594,6 +639,7 @@ void InputStrDialog::updateEnable() ui->lEFilePath1->setEnabled(ui->cBStreamC1->isChecked() && ui->cBStream1->currentIndex() == 4); ui->lEFilePath2->setEnabled(ui->cBStreamC2->isChecked() && ui->cBStream2->currentIndex() == 4); ui->lEFilePath3->setEnabled(ui->cBStreamC3->isChecked() && ui->cBStream3->currentIndex() == 4); + ui->lEFilePath4->setEnabled(ui->cBStreamC4->isChecked() && ui->cBStream4->currentIndex() == 4); ui->cBTimeTag->setEnabled(enaFile); ui->sBTimeStart->setEnabled(enaFile && ui->cBTimeTag->isChecked()); ui->cBTimeSpeed->setEnabled(enaFile && ui->cBTimeTag->isChecked()); diff --git a/app/qtapp/rtknavi_qt/instrdlg.h b/app/qtapp/rtknavi_qt/instrdlg.h index b64f26112..1c97ede78 100644 --- a/app/qtapp/rtknavi_qt/instrdlg.h +++ b/app/qtapp/rtknavi_qt/instrdlg.h @@ -5,6 +5,8 @@ #include +#include "rtklib.h" + namespace Ui { class InputStrDialog; } @@ -88,15 +90,19 @@ public slots: void showStreamOptions1(); void showStreamOptions2(); void showStreamOptions3(); + void showStreamOptions4(); void showCommandDialog1(); void showCommandDialog2(); void showCommandDialog3(); + void showCommandDialog4(); void selectFile1(); void selectFile2(); void selectFile3(); + void selectFile4(); void showReceiverOptions1(); void showReceiverOptions2(); void showReceiverOptions3(); + void showReceiverOptions4(); void selectPosition(); void updateEnable(); @@ -116,12 +122,12 @@ public slots: TcpOptDialog *tcpOptDialog; FtpOptDialog *ftpOptDialog; - int commandEnable[3][3], commandEnableTcp[3][3]; - QString commands[3][3], commandsTcp[3][3]; - QString paths[3][4]; + int commandEnable[RTKSVRNIN][3], commandEnableTcp[RTKSVRNIN][3]; + QString commands[RTKSVRNIN][3], commandsTcp[RTKSVRNIN][3]; + QString paths[RTKSVRNIN][4]; - QString receiverOptions[3]; + QString receiverOptions[RTKSVRNIN]; QString history[10]; int noFormats; QString stationPositionFile; diff --git a/app/qtapp/rtknavi_qt/instrdlg.ui b/app/qtapp/rtknavi_qt/instrdlg.ui index 44374333d..9ce3ab7ad 100644 --- a/app/qtapp/rtknavi_qt/instrdlg.ui +++ b/app/qtapp/rtknavi_qt/instrdlg.ui @@ -169,6 +169,13 @@ + + + + (4) + + + @@ -189,6 +196,13 @@ + + + + Specify file name for correction data + + + @@ -724,7 +738,96 @@ - + + + + Activate data input stream for additional corrections + + + (4) Correction + + + + + + + Select input stream type for corrections + + + + Serial + + + + + TCP Client + + + + + TCP Server + + + + + NTRIP Client + + + + + File + + + + + FTP + + + + + HTTP + + + + + + + + Select options for the correction data stream + + + ... + + + + + + + Specify additional commands for the correction data stream + + + ... + + + + + + + Select correction data stream format + + + + + + + Define additional options for the receiver + + + ... + + + + @@ -748,6 +851,12 @@ btnCmd3 cBFormat3 btnReceiverOptions3 + cBStreamC4 + cBStream4 + btnStream4 + btnCmd4 + cBFormat4 + btnReceiverOptions4 cBNmeaRequestType sBNmeaPosition1 sBNmeaPosition2 @@ -758,6 +867,7 @@ lEFilePath1 lEFilePath2 lEFilePath3 + lEFilePath4 cBTimeTag cBTimeSpeed cB64Bit diff --git a/app/qtapp/rtknavi_qt/logstrdlg.cpp b/app/qtapp/rtknavi_qt/logstrdlg.cpp index 387ea77ed..83fe36be0 100644 --- a/app/qtapp/rtknavi_qt/logstrdlg.cpp +++ b/app/qtapp/rtknavi_qt/logstrdlg.cpp @@ -32,6 +32,7 @@ LogStrDialog::LogStrDialog(QWidget *parent) ui->lEFilePath1->setCompleter(new QCompleter(fileModel, this)); ui->lEFilePath2->setCompleter(new QCompleter(fileModel, this)); ui->lEFilePath3->setCompleter(new QCompleter(fileModel, this)); + ui->lEFilePath4->setCompleter(new QCompleter(fileModel, this)); // line edit actions QAction *aclEFilePath1Select = ui->lEFilePath1->addAction(QIcon(":/buttons/folder"), QLineEdit::TrailingPosition); @@ -40,6 +41,8 @@ LogStrDialog::LogStrDialog(QWidget *parent) aclEFilePath2Select->setToolTip(tr("Select File")); QAction *aclEFilePath3Select = ui->lEFilePath3->addAction(QIcon(":/buttons/folder"), QLineEdit::TrailingPosition); aclEFilePath3Select->setToolTip(tr("Select File")); + QAction *aclEFilePath4Select = ui->lEFilePath4->addAction(QIcon(":/buttons/folder"), QLineEdit::TrailingPosition); + aclEFilePath4Select->setToolTip(tr("Select File")); connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &LogStrDialog::accept); connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &LogStrDialog::reject); @@ -47,15 +50,19 @@ LogStrDialog::LogStrDialog(QWidget *parent) connect(aclEFilePath1Select, &QAction::triggered, this, &LogStrDialog::selectFile1); connect(aclEFilePath2Select, &QAction::triggered, this, &LogStrDialog::selectFile2); connect(aclEFilePath3Select, &QAction::triggered, this, &LogStrDialog::selectFile3); + connect(aclEFilePath4Select, &QAction::triggered, this, &LogStrDialog::selectFile4); connect(ui->btnStream1, &QPushButton::clicked, this, &LogStrDialog::showStreamOptions1); connect(ui->btnStream2, &QPushButton::clicked, this, &LogStrDialog::showStreamOptions2); connect(ui->btnStream3, &QPushButton::clicked, this, &LogStrDialog::showStreamOptions3); + connect(ui->btnStream4, &QPushButton::clicked, this, &LogStrDialog::showStreamOptions4); connect(ui->cBStream1, static_cast(&QComboBox::currentIndexChanged), this, &LogStrDialog::updateEnable); connect(ui->cBStream2, static_cast(&QComboBox::currentIndexChanged), this, &LogStrDialog::updateEnable); connect(ui->cBStream3, static_cast(&QComboBox::currentIndexChanged), this, &LogStrDialog::updateEnable); + connect(ui->cBStream4, static_cast(&QComboBox::currentIndexChanged), this, &LogStrDialog::updateEnable); connect(ui->cBStream1C, &QCheckBox::clicked, this, &LogStrDialog::updateEnable); connect(ui->cBStream2C, &QCheckBox::clicked, this, &LogStrDialog::updateEnable); connect(ui->cBStream3C, &QCheckBox::clicked, this, &LogStrDialog::updateEnable); + connect(ui->cBStream4C, &QCheckBox::clicked, this, &LogStrDialog::updateEnable); ui->cBSwapInterval->setValidator(new QDoubleValidator(this)); } @@ -75,6 +82,11 @@ void LogStrDialog::selectFile3() ui->lEFilePath3->setText(QDir::toNativeSeparators(QFileDialog::getSaveFileName(this, tr("Open..."), ui->lEFilePath3->text()))); } //--------------------------------------------------------------------------- +void LogStrDialog::selectFile4() +{ + ui->lEFilePath4->setText(QDir::toNativeSeparators(QFileDialog::getSaveFileName(this, tr("Open..."), ui->lEFilePath4->text()))); +} +//--------------------------------------------------------------------------- void LogStrDialog::showKeyDialog() { keyDialog->show(); @@ -98,7 +110,7 @@ void LogStrDialog::showStreamOptions2() case 1: showTcpOptions(1, 1); break; case 2: showTcpOptions(1, 0); break; case 3: showTcpOptions(1, 2); break; - case 4: showTcpOptions(0, 4); break; + case 4: showTcpOptions(1, 4); break; } } //--------------------------------------------------------------------------- @@ -109,7 +121,18 @@ void LogStrDialog::showStreamOptions3() case 1: showTcpOptions(2, 1); break; case 2: showTcpOptions(2, 0); break; case 3: showTcpOptions(2, 2); break; - case 4: showTcpOptions(0, 4); break; + case 4: showTcpOptions(2, 4); break; + } +} +//--------------------------------------------------------------------------- +void LogStrDialog::showStreamOptions4() +{ + switch (ui->cBStream4->currentIndex()) { + case 0: showSerialOptions(3, 0); break; + case 1: showTcpOptions(3, 1); break; + case 2: showTcpOptions(3, 0); break; + case 3: showTcpOptions(3, 2); break; + case 4: showTcpOptions(3, 4); break; } } //--------------------------------------------------------------------------- @@ -133,7 +156,7 @@ QString LogStrDialog::setFilePath(const QString &p) //--------------------------------------------------------------------------- void LogStrDialog::showSerialOptions(int index, int opt) { - if ((index < 0) || (index > 2)) return; + if ((index < 0) || (index >= RTKSVRNIN)) return; serialOptDialog->setOptions(opt); serialOptDialog->setPath(paths[index][0]); @@ -146,7 +169,7 @@ void LogStrDialog::showSerialOptions(int index, int opt) //--------------------------------------------------------------------------- void LogStrDialog::showTcpOptions(int index, int opt) { - if ((index < 0) || (index > 2)) return; + if ((index < 0) || (index >= RTKSVRNIN)) return; tcpOptDialog->setOptions(opt); tcpOptDialog->setHistory(history, 10); @@ -165,17 +188,21 @@ void LogStrDialog::updateEnable() { int ena = (ui->cBStream1C->isChecked() && ui->cBStream1->currentIndex() == 5) || (ui->cBStream2C->isChecked() && ui->cBStream2->currentIndex() == 5) || - (ui->cBStream3C->isChecked() && ui->cBStream3->currentIndex() == 5); + (ui->cBStream3C->isChecked() && ui->cBStream3->currentIndex() == 5) || + (ui->cBStream4C->isChecked() && ui->cBStream4->currentIndex() == 5); ui->cBStream1->setEnabled(ui->cBStream1C->isChecked()); ui->cBStream2->setEnabled(ui->cBStream2C->isChecked()); ui->cBStream3->setEnabled(ui->cBStream3C->isChecked()); + ui->cBStream4->setEnabled(ui->cBStream4C->isChecked()); ui->btnStream1->setEnabled(ui->cBStream1C->isChecked() && ui->cBStream1->currentIndex() <= 4); ui->btnStream2->setEnabled(ui->cBStream2C->isChecked() && ui->cBStream2->currentIndex() <= 4); ui->btnStream3->setEnabled(ui->cBStream3C->isChecked() && ui->cBStream3->currentIndex() <= 4); + ui->btnStream4->setEnabled(ui->cBStream4C->isChecked() && ui->cBStream4->currentIndex() <= 4); ui->lEFilePath1->setEnabled(ui->cBStream1C->isChecked() && ui->cBStream1->currentIndex() == 5); ui->lEFilePath2->setEnabled(ui->cBStream2C->isChecked() && ui->cBStream2->currentIndex() == 5); ui->lEFilePath3->setEnabled(ui->cBStream3C->isChecked() && ui->cBStream3->currentIndex() == 5); + ui->lEFilePath4->setEnabled(ui->cBStream4C->isChecked() && ui->cBStream4->currentIndex() == 5); ui->lblSwapInterval->setEnabled(ena); ui->lblF1->setEnabled(ena); ui->cBTimeTag->setEnabled(ena); @@ -185,8 +212,8 @@ void LogStrDialog::updateEnable() //--------------------------------------------------------------------------- void LogStrDialog::setStreamEnabled(int stream, int enabled) { - QCheckBox *cBStreamC[] = {ui->cBStream1C, ui->cBStream2C, ui->cBStream3C}; - if ((stream < 0 ) || (stream > 2)) return; + QCheckBox *cBStreamC[] = {ui->cBStream1C, ui->cBStream2C, ui->cBStream3C, ui->cBStream4C}; + if ((stream < 0 ) || (stream >= RTKSVRNIN)) return; cBStreamC[stream]->setChecked(enabled); updateEnable(); @@ -194,16 +221,16 @@ void LogStrDialog::setStreamEnabled(int stream, int enabled) //--------------------------------------------------------------------------- int LogStrDialog::getStreamEnabled(int stream) { - QCheckBox *cBStreamC[] = {ui->cBStream1C, ui->cBStream2C, ui->cBStream3C}; - if ((stream < 0 ) || (stream > 2)) return false; + QCheckBox *cBStreamC[] = {ui->cBStream1C, ui->cBStream2C, ui->cBStream3C, ui->cBStream4C}; + if ((stream < 0 ) || (stream >= RTKSVRNIN)) return false; return cBStreamC[stream]->isChecked(); } //--------------------------------------------------------------------------- void LogStrDialog::setStreamType(int stream, int type) { - QComboBox *cBStream[] = {ui->cBStream1, ui->cBStream2, ui->cBStream3}; - if ((stream < 0 ) || (stream > 2)) return; + QComboBox *cBStream[] = {ui->cBStream1, ui->cBStream2, ui->cBStream3, ui->cBStream4}; + if ((stream < 0 ) || (stream >= RTKSVRNIN)) return; cBStream[stream]->setCurrentIndex(type); @@ -212,16 +239,16 @@ void LogStrDialog::setStreamType(int stream, int type) //--------------------------------------------------------------------------- int LogStrDialog::getStreamType(int stream) { - QComboBox *cBStream[] = {ui->cBStream1, ui->cBStream2, ui->cBStream3}; - if ((stream < 0 ) || (stream > 2)) return STR_NONE; + QComboBox *cBStream[] = {ui->cBStream1, ui->cBStream2, ui->cBStream3, ui->cBStream4}; + if ((stream < 0 ) || (stream >= RTKSVRNIN)) return STR_NONE; return cBStream[stream]->currentIndex(); }; //--------------------------------------------------------------------------- void LogStrDialog::setPath(int stream, int type, const QString &path) { - QLineEdit *edits[] = {ui->lEFilePath1, ui->lEFilePath2, ui->lEFilePath3}; - if ((stream < 0 ) || (stream > 2)) return; + QLineEdit *edits[] = {ui->lEFilePath1, ui->lEFilePath2, ui->lEFilePath3, ui->lEFilePath4}; + if ((stream < 0 ) || (stream >= RTKSVRNIN)) return; if ((type < 0 ) || (type > 3)) return; paths[stream][type] = path; @@ -240,8 +267,8 @@ void LogStrDialog::setPath(int stream, int type, const QString &path) //--------------------------------------------------------------------------- QString LogStrDialog::getPath(int stream, int type) { - QLineEdit *edits[] = {ui->lEFilePath1, ui->lEFilePath2, ui->lEFilePath3}; - if ((stream < 0 ) || (stream > 2)) return ""; + QLineEdit *edits[] = {ui->lEFilePath1, ui->lEFilePath2, ui->lEFilePath3, ui->lEFilePath4}; + if ((stream < 0 ) || (stream >= RTKSVRNIN)) return ""; if ((type < 0 ) || (type > 3)) return ""; if (type == 2) diff --git a/app/qtapp/rtknavi_qt/logstrdlg.h b/app/qtapp/rtknavi_qt/logstrdlg.h index 2efdebf3f..0d9d99ebf 100644 --- a/app/qtapp/rtknavi_qt/logstrdlg.h +++ b/app/qtapp/rtknavi_qt/logstrdlg.h @@ -4,6 +4,8 @@ //--------------------------------------------------------------------------- #include +#include "rtklib.h" + namespace Ui { class LogStrDialog; } @@ -44,16 +46,18 @@ class LogStrDialog : public QDialog SerialOptDialog *serialOptDialog; TcpOptDialog *tcpOptDialog; - QString paths[3][4]; + QString paths[RTKSVRNIN][4]; QString history[10]; public slots: void showStreamOptions1(); void showStreamOptions2(); void showStreamOptions3(); + void showStreamOptions4(); void selectFile1(); void selectFile2(); void selectFile3(); + void selectFile4(); void showKeyDialog(); void updateEnable(); diff --git a/app/qtapp/rtknavi_qt/logstrdlg.ui b/app/qtapp/rtknavi_qt/logstrdlg.ui index d3490d750..56b82e077 100644 --- a/app/qtapp/rtknavi_qt/logstrdlg.ui +++ b/app/qtapp/rtknavi_qt/logstrdlg.ui @@ -162,6 +162,13 @@ + + + + Specify file name for correction log data + + + @@ -193,7 +200,7 @@ Enable rover data stream logging - (6) Rover + (5) Rover @@ -223,7 +230,7 @@ Enable base station data stream logging - (7) Base Station + (6) Base Station @@ -243,7 +250,7 @@ Enable correction data stream logging - (8) Correction + (7) Correction @@ -388,7 +395,64 @@ - + + + + Enable correction data stream logging + + + (8) Correction + + + + + + + Select log stream type for correction data + + + + Serial + + + + + TCP Client + + + + + TCP Server + + + + + NTRIP Server + + + + + NTRIP Caster + + + + + File + + + + + + + + Select options for the correction log data stream + + + ... + + + + @@ -403,10 +467,14 @@ cBStream3C cBStream3 btnStream3 + cBStream4C + cBStream4 + btnStream4 btnKey lEFilePath1 lEFilePath2 lEFilePath3 + lEFilePath4 cBTimeTag cBSwapInterval diff --git a/app/qtapp/rtknavi_qt/mondlg.cpp b/app/qtapp/rtknavi_qt/mondlg.cpp index b8829d02b..8f130a4ba 100644 --- a/app/qtapp/rtknavi_qt/mondlg.cpp +++ b/app/qtapp/rtknavi_qt/mondlg.cpp @@ -18,7 +18,6 @@ #define SQRT(x) ((x)<0.0||(x)!=(x)?0.0:sqrt(x)) #define MAXLINE 128 #define MAXLEN 256 -#define NMONITEM 17 static const int sys_tbl[] = { @@ -84,15 +83,18 @@ void MonitorDialog::closeEvent(QCloseEvent *event) //--------------------------------------------------------------------------- void MonitorDialog::displayTypeChanged() { - int index = getDisplayType() - NMONITEM; + int index = getDisplayType(); - if (0 <= index) { + if (index >= 16) { + // Clear the peek buffers. rtksvrlock(rtksvr); - if (index < 2) rtksvr->npb[index] = 0; - else if (index < 4) rtksvr->nsb[index - 2] = 0; - else rtksvr->rtk.neb = 0; + if (index == 16) { + for (int i = 0; i < RTKSVRNIN; i++) rtksvr->npb[i] = 0; + } else if (index == 17) { + for (int i = 0; i < RTKSVRNSOL; i++) rtksvr->nsb[i] = 0; + } else rtksvr->rtk.neb = 0; rtksvrunlock(rtksvr); - } + } ui->lblInformation->setText(""); consoleBuffer.clear(); ui->tWConsole->clear(); @@ -243,13 +245,13 @@ void MonitorDialog::showBuffers() rtksvrlock(rtksvr); if (displayType == 16) { // input buffer - if (inputStream >= 3) { + if (inputStream >= RTKSVRNIN) { // Combined len = 0; - for (int i = 0; i < 3; i++) + for (int i = 0; i < RTKSVRNIN; i++) len += rtksvr->npb[i]; if (len > 0 && (msg = (uint8_t *)malloc(size_t(len)))) { - for (int i = 0, j = 0; i < 3; i++) { + for (int i = 0, j = 0; i < RTKSVRNIN; i++) { int ilen = rtksvr->npb[i]; if (ilen > 0) { memcpy(msg + j, rtksvr->pbuf[i], size_t(ilen)); @@ -390,10 +392,10 @@ void MonitorDialog::observationModeChanged() void MonitorDialog::setRtk() { header << tr("Parameter") << tr("Value"); - int width[] = {500, 500}; + int width[] = {500, 640}; ui->tWConsole->setColumnCount(2); - ui->tWConsole->setRowCount(53 + NFREQ*2); + ui->tWConsole->setRowCount(54 + NFREQ*2); ui->tWConsole->setHorizontalHeaderLabels(header); for (int i = 0; (i < ui->tWConsole->columnCount()) && (i < 2); i++) @@ -417,8 +419,8 @@ void MonitorDialog::showRtk() double *del, *off, rt[3] = {0}, dop[4] = {0}; double azel[MAXSAT * 2], pos[3], vel[3], rr[3] = {0}, enu[3] = {0}; int row, j, k, cycle, state, rtkstat, nsat0, nsat1, prcout, nave; - int cputime, nb[3] = {0}, ne; - unsigned int nmsg[3][10] = {{0}}; + int cputime, nb[RTKSVRNIN] = {0}, ne; + unsigned int nmsg[RTKSVRNIN][10] = {{0}}; char tstr[40], id[8], s1[40] = "-", s2[40] = "-", s3[40] = "-"; char file[1024] = ""; const QString ionoopt[] = {tr("OFF"), tr("Broadcast"), tr("SBAS"), tr("Dual-Frequency"), tr("Estimate STEC"), tr("IONEX TEC"), tr("QZSS LEX")}; @@ -440,9 +442,9 @@ void MonitorDialog::showRtk() prcout = rtksvr->prcout; nave = rtksvr->nave; - for (row = 0; row < 3; row++) nb[row] = rtksvr->nb[row]; + for (row = 0; row < RTKSVRNIN; row++) nb[row] = rtksvr->nb[row]; - for (row = 0; row < 3; row++) + for (row = 0; row < RTKSVRNIN; row++) { for (j = 0; j < 10; j++) nmsg[row][j] = rtksvr->nmsg[row][j]; @@ -486,7 +488,7 @@ void MonitorDialog::showRtk() if (rtk->opt.navsys & SYS_IRN) navsys = navsys + tr("NavIC "); if (rtk->opt.navsys & SYS_SBS) navsys = navsys + tr("SBAS "); - if (ui->tWConsole->rowCount() < 53 + NFREQ * 2) { + if (ui->tWConsole->rowCount() < 54 + NFREQ * 2) { free(rtk); return; } @@ -582,11 +584,16 @@ void MonitorDialog::showRtk() .arg(nmsg[1][0]).arg(nmsg[1][1] + nmsg[1][6]).arg(nmsg[1][2]).arg(nmsg[1][3]) .arg(nmsg[1][4]).arg(nmsg[1][5]).arg(nmsg[1][7]).arg(nmsg[1][9])); - ui->tWConsole->item(row, 0)->setText(tr("# of Input Data Ephemeris")); + ui->tWConsole->item(row, 0)->setText(tr("# of Input Data Correction 1")); ui->tWConsole->item(row++, 1)->setText(tr("Obs(%1), Nav(%2), Ion(%3), Sbs (%4), Pos(%5), Dgps(%6), Ssr(%7), Err(%8)") .arg(nmsg[2][0]).arg(nmsg[2][1] + nmsg[2][6]).arg(nmsg[2][2]).arg(nmsg[2][3]) .arg(nmsg[2][4]).arg(nmsg[2][5]).arg(nmsg[2][7]).arg(nmsg[2][9])); + ui->tWConsole->item(row, 0)->setText(tr("# of Input Data Correction 2")); + ui->tWConsole->item(row++, 1)->setText(tr("Obs(%1), Nav(%2), Ion(%3), Sbs (%4), Pos(%5), Dgps(%6), Ssr(%7), Err(%8)") + .arg(nmsg[3][0]).arg(nmsg[3][1] + nmsg[3][6]).arg(nmsg[3][2]).arg(nmsg[3][3]) + .arg(nmsg[3][4]).arg(nmsg[3][5]).arg(nmsg[3][7]).arg(nmsg[3][9])); + ui->tWConsole->item(row, 0)->setText(tr("Solution Status")); ui->tWConsole->item(row++, 1)->setText(sol[rtkstat]); @@ -1592,10 +1599,10 @@ void MonitorDialog::setStream() header << tr("STR") << tr("Stream") << tr("Type") << tr("Format") << tr("Mode") << tr("State") << tr("Input (bytes)") << tr("Input (bps)") << tr("Output (bytes)") << tr("Output (bps)") << tr("Path") << tr("Message"); - int i, width[] = {40, 150, 120, 110, 50, 50, 140, 140, 140, 140, 220, 220}; + int i, width[] = {45, 180, 120, 150, 60, 55, 120, 110, 135, 120, 220, 220}; ui->tWConsole->setColumnCount(12); - ui->tWConsole->setRowCount(9); + ui->tWConsole->setRowCount(MAXSTRRTK + 1); ui->tWConsole->setHorizontalHeaderLabels(header); for (i = 0; i < ui->tWConsole->columnCount(); i++) @@ -1610,11 +1617,8 @@ void MonitorDialog::setStream() //--------------------------------------------------------------------------- void MonitorDialog::showStream() { - const QString ch[] = { - tr("Input Rover"), tr("Input Base"), tr("Input Correction"), tr("Output Solution 1"), - tr("Output Solution 2"), tr("Log Rover"), tr("Log Base"), tr("Log Correction"), - tr("Monitor") - }; + const QString inch[] = {tr("Input Rover"), tr("Input Base")}; + const QString logch[] = {tr("Log Rover"), tr("Log Base")}; const QString type[] = { tr("-"), tr("Serial"), tr("File"), tr("TCP Server"), tr("TCP Client"), tr("NTRIP Server"), tr("NTRIP Client"), tr("FTP"), tr("HTTP"), tr("NTRIP Caster"), tr("UDP Server"), @@ -1624,27 +1628,33 @@ void MonitorDialog::showStream() tr("Lat/Lon/Height"), tr("X/Y/Z-ECEF"), tr("E/N/U-Baseline"), tr("NMEA-0183"), tr("Solution stats"), tr("GSI F1/F2")}; const QString state[] = {tr("Error"), tr("-"), tr("OK")}; - QString mode, form; - stream_t stream[9]; - int i, format[9] = {0}; + QString mode, form, ch; + stream_t stream[MAXSTRRTK + 1]; + int i, format[MAXSTRRTK + 1] = {0}; char path[MAXSTRPATH] = "", *p, *q; rtksvrlock(rtksvr); // lock - for (i = 0; i < 8; i++) stream[i] = rtksvr->stream[i]; - for (i = 0; i < 3; i++) format[i] = rtksvr->format[i]; - for (i = 3; i < 5; i++) format[i] = rtksvr->solopt[i - 3].posf; - stream[8] = *monistr; - format[8] = SOLF_LLH; + for (i = 0; i < MAXSTRRTK; i++) stream[i] = rtksvr->stream[i]; + for (i = 0; i < RTKSVRNIN; i++) format[i] = rtksvr->format[i]; + for (i = 0; i < RTKSVRNSOL; i++) format[RTKSVRNIN*2+i] = rtksvr->solopt[i].posf; + stream[MAXSTRRTK] = *monistr; + format[MAXSTRRTK] = SOLF_LLH; rtksvrunlock(rtksvr); // unlock - for (i = 0; i < 9; i++) { + for (i = 0; i < MAXSTRRTK + 1; i++) { int j = 0; ui->tWConsole->item(i, j++)->setText(QString("(%1)").arg(i+1)); - ui->tWConsole->item(i, j++)->setText(ch[i]); + if (i < 2) ch = inch[i]; + else if (i < RTKSVRNIN) ch = QString("Input Correction %1").arg(i - 2 + 1); + else if (i < RTKSVRNIN + 2) ch = logch[i - RTKSVRNIN]; + else if (i < RTKSVRNIN * 2) ch = QString("Log Correction %1").arg(i - RTKSVRNIN - 2 + 1); + else if (i < MAXSTRRTK) ch = QString("Output Solution %1").arg(i - RTKSVRNIN * 2 + 1); + else ch = "Monitor"; + ui->tWConsole->item(i, j++)->setText(ch); ui->tWConsole->item(i, j++)->setText(type[stream[i].type]); if (!stream[i].type) form = "-"; - else if (i < 3) form = formatstrs[format[i]]; - else if (i < 5 || i == 8) form = outformat[format[i]]; + else if (i < RTKSVRNIN) form = formatstrs[format[i]]; + else if (i >= RTKSVRNIN * 2) form = outformat[format[i]]; else form = "-"; ui->tWConsole->item(i, j++)->setText(form); if (stream[i].mode & STR_MODE_R) mode = tr("R"); else mode = ""; @@ -1952,7 +1962,7 @@ void MonitorDialog::showRtcm() QString mstr1, mstr2; char tstr[40] = "-"; - int effectiveStream = (inputStream < 0 || inputStream > 2) ? 0 : inputStream; + int effectiveStream = (inputStream < 0 || inputStream >= RTKSVRNIN) ? 0 : inputStream; rtcm_t *rtcm = (rtcm_t *)malloc(sizeof(rtcm_t)); if (rtcm == NULL) return; @@ -2104,15 +2114,17 @@ void MonitorDialog::showRtcmSsr() char tstr[40], id[8]; QString s; - int effectiveStream = (inputStream < 0 || inputStream > 2) ? 0 : inputStream; + int effectiveStream = (inputStream < 0 || inputStream >= RTKSVRNIN) ? 0 : inputStream; rtksvrlock(rtksvr); time = rtksvr->rtk.sol.time; for (i = n = 0; i < MAXSAT; i++) { if (!(satsys(i + 1, NULL) & sys)) continue; - bool valid = rtksvr->rtcm[effectiveStream].ssr[i].t0[0].time && - fabs(timediff(time, rtksvr->rtcm[effectiveStream].ssr[i].t0[0])) <= 1800.0 && - rtksvr->rtcm[effectiveStream].ssr[i].iode >= 0; + if (inputStream == RTKSVRNIN) + ssr[n] = rtksvr->nav.ssr[i]; + else + ssr[n] = rtksvr->rtcm[effectiveStream].ssr[i]; + bool valid = ssr[n].t0[0].time && fabs(timediff(time, ssr[n].t0[0])) <= 1800.0 && ssr[n].iode >= 0; if (ui->cBSelectSatellites->currentIndex() && !valid) continue; ssr[n] = rtksvr->rtcm[effectiveStream].ssr[i]; sat[n++] = i + 1; @@ -2171,7 +2183,7 @@ void MonitorDialog::showRtcmSsr() void MonitorDialog::setReferenceStation() { header << tr("Parameter") << tr("Value"); - int width[] = {400, 520}; + int width[] = {400, 640}; int i; ui->tWConsole->setColumnCount(2); @@ -2195,7 +2207,7 @@ void MonitorDialog::showReferenceStation() int i = 0, format; char tstr[40] = "-"; - int effectiveStream = (inputStream < 0 || inputStream > 2) ? 0 : inputStream; + int effectiveStream = (inputStream < 0 || inputStream >= RTKSVRNIN) ? 0 : inputStream; rtksvrlock(rtksvr); format = rtksvr->format[effectiveStream]; diff --git a/app/qtapp/rtknavi_qt/mondlg.ui b/app/qtapp/rtknavi_qt/mondlg.ui index afd2217e7..30b88fc0b 100644 --- a/app/qtapp/rtknavi_qt/mondlg.ui +++ b/app/qtapp/rtknavi_qt/mondlg.ui @@ -280,7 +280,12 @@ - 3 Correction + 3 Correction 1 + + + + + 4 Correction 2 @@ -297,12 +302,17 @@ - (4) Solution 1 + (9) Solution 1 + + + + + (10) Solution 2 - (5) Solution 2 + (11) Solution 3 diff --git a/app/qtapp/rtknavi_qt/navimain.cpp b/app/qtapp/rtknavi_qt/navimain.cpp index 673fd6443..5994cc510 100644 --- a/app/qtapp/rtknavi_qt/navimain.cpp +++ b/app/qtapp/rtknavi_qt/navimain.cpp @@ -81,13 +81,9 @@ MainWindow *mainForm; #define SQRT(x) ((x)<0.0||(x)!=(x)?0.0:sqrt(x)) // receiver options table --------------------------------------------------- -static int strtype[] = { /* stream types */ - STR_NONE, STR_NONE, STR_NONE, STR_NONE, STR_NONE, STR_NONE, STR_NONE, STR_NONE -}; -static char strpath[8][MAXSTR] = { "" }; /* stream paths */ -static int strfmt[] = { /* stream formats */ - STRFMT_RTCM3, STRFMT_RTCM3, STRFMT_SP3, SOLF_LLH, SOLF_NMEA, 0, 0, 0 -}; +static int strtype[MAXSTRRTK]; /* stream types */ +static char strpath[MAXSTRRTK][MAXSTR]; /* stream paths */ +static int strfmt[MAXSTRRTK]; /* stream formats */ #define TIMOPT "0:gpst,1:utc,2:jst,3:tow" #define CONOPT "0:dms,1:deg,2:xyz,3:enu,4:pyl" @@ -118,6 +114,11 @@ MainWindow::MainWindow(QWidget *parent) setlocale(LC_NUMERIC, "C"); for (int i = 0; i < MAXSTRRTK; i++) { + strtype[i] = STR_NONE; + strpath[i][0] = '\0'; + if (i < RTKSVRNIN) strfmt[i] = STRFMT_RTCM3; + else if (i >= RTKSVRNIN*2) strfmt[i] = i == RTKSVRNIN*2 ? SOLF_LLH : SOLF_NMEA; + else strfmt[i] = 0; streamEnabled[i] = streamType[i] = inputFormat[i] = 0; } for (int i = 0; i < 3; i++) @@ -148,29 +149,37 @@ MainWindow::MainWindow(QWidget *parent) static opt_t rcvopts[] = { { "inpstr1-type", 3, (void *)&strtype[0], ISTOPT }, - { "inpstr2-type", 3, (void *)&strtype[1], ISTOPT }, - { "inpstr3-type", 3, (void *)&strtype[2], ISTOPT }, { "inpstr1-path", 2, (void *)strpath [0], "" }, - { "inpstr2-path", 2, (void *)strpath [1], "" }, - { "inpstr3-path", 2, (void *)strpath [2], "" }, { "inpstr1-format", 3, (void *)&strfmt [0], FMTOPT }, + { "inpstr2-type", 3, (void *)&strtype[1], ISTOPT }, + { "inpstr2-path", 2, (void *)strpath [1], "" }, { "inpstr2-format", 3, (void *)&strfmt [1], FMTOPT }, + { "inpstr2-nmeareq", 3, (void *)&nmeaRequestType, NMEOPT}, + { "inpstr2-nmealat", 1, (void *)&nmeaPosition[0], "deg"}, + { "inpstr2-nmealon", 1, (void *)&nmeaPosition[1], "deg"}, + { "inpstr3-type", 3, (void *)&strtype[2], ISTOPT }, + { "inpstr3-path", 2, (void *)strpath [2], "" }, { "inpstr3-format", 3, (void *)&strfmt [2], FMTOPT }, - { "inpstr2-nmeareq", 3, (void *)&nmeaRequestType, NMEOPT }, - { "inpstr2-nmealat", 1, (void *)&nmeaPosition[0], "deg" }, - { "inpstr2-nmealon", 1, (void *)&nmeaPosition[1], "deg" }, - { "outstr1-type", 3, (void *)&strtype[3], OSTOPT }, - { "outstr2-type", 3, (void *)&strtype[4], OSTOPT }, - { "outstr1-path", 2, (void *)strpath [3], "" }, - { "outstr2-path", 2, (void *)strpath [4], "" }, - { "outstr1-format", 3, (void *)&strfmt [3], SOLOPT }, - { "outstr2-format", 3, (void *)&strfmt [4], SOLOPT }, - { "logstr1-type", 3, (void *)&strtype[5], OSTOPT }, - { "logstr2-type", 3, (void *)&strtype[6], OSTOPT }, - { "logstr3-type", 3, (void *)&strtype[7], OSTOPT }, - { "logstr1-path", 2, (void *)strpath [5], "" }, - { "logstr2-path", 2, (void *)strpath [6], "" }, - { "logstr3-path", 2, (void *)strpath [7], "" }, + { "inpstr4-type", 3, (void *)&strtype[3], ISTOPT }, + { "inpstr4-path", 2, (void *)strpath [3], "" }, + { "inpstr4-format", 3, (void *)&strfmt [3], FMTOPT }, + { "logstr1-type", 3, (void *)&strtype[RTKSVRNIN], OSTOPT}, + { "logstr1-path", 2, (void *)strpath [RTKSVRNIN], ""}, + { "logstr2-type", 3, (void *)&strtype[RTKSVRNIN + 1], OSTOPT}, + { "logstr2-path", 2, (void *)strpath [RTKSVRNIN + 1], ""}, + { "logstr3-type", 3, (void *)&strtype[RTKSVRNIN + 2], OSTOPT}, + { "logstr3-path", 2, (void *)strpath [RTKSVRNIN + 2], ""}, + { "logstr4-type", 3, (void *)&strtype[RTKSVRNIN + 3], OSTOPT}, + { "logstr4-path", 2, (void *)strpath [RTKSVRNIN + 3], ""}, + { "outstr1-type", 3, (void *)&strtype[RTKSVRNIN*2], OSTOPT}, + { "outstr1-path", 2, (void *)strpath [RTKSVRNIN*2], "" }, + { "outstr1-format", 3, (void *)&strfmt [RTKSVRNIN*2], SOLOPT}, + { "outstr2-type", 3, (void *)&strtype[RTKSVRNIN*2 + 1], OSTOPT}, + { "outstr2-path", 2, (void *)strpath [RTKSVRNIN*2 + 1], "" }, + { "outstr2-format", 3, (void *)&strfmt [RTKSVRNIN*2 + 1], SOLOPT}, + { "outstr3-type", 3, (void *)&strtype[RTKSVRNIN*2 + 2], OSTOPT}, + { "outstr3-path", 2, (void *)strpath [RTKSVRNIN*2 + 2], "" }, + { "outstr3-format", 3, (void *)&strfmt [RTKSVRNIN*2 + 2], SOLOPT}, { "", 0, NULL, "" } }; @@ -498,9 +507,9 @@ void MainWindow::showOptionsDialog() trace(3, "showOptionsDialog\n"); - for (int i = 0; i < 8; i++) { + for (int i = 0; i < MAXSTRRTK; i++) { int stype = streamType[i]; - if (i < 3) { + if (i < RTKSVRNIN) { if (stype >= 0 && stype < (int)(sizeof(itype) / sizeof(int))) strtype[i] = itype[stype]; else @@ -579,10 +588,10 @@ void MainWindow::showOptionsDialog() if (optDialog->result() != QDialog::Accepted) return; - for (int i = 0; i < 8; i++) { + for (int i = 0; i < MAXSTRRTK; i++) { streamType[i] = 0; // Default to serial bool found = false; - if (i < 3) { + if (i < RTKSVRNIN) { // Input for (int j = 0; j < (int)(sizeof(itype) / sizeof(int)); j++) { if (strtype[i] != itype[j]) continue; @@ -601,7 +610,7 @@ void MainWindow::showOptionsDialog() } // Disable if the stream type is not found. if (found == false) streamEnabled[i] = false; - if (i < 5) inputFormat[i] = strfmt[i]; + if (i < RTKSVRNIN || i >= RTKSVRNIN * 2) inputFormat[i] = strfmt[i]; if (strtype[i] == STR_SERIAL) paths[i][0] = strpath[i]; @@ -641,7 +650,7 @@ void MainWindow::showInputStreamDialog() trace(3, "showInputStreamDialog\n"); - for (i = 0; i < 3; i++) { + for (i = 0; i < RTKSVRNIN; i++) { inputStrDialog->setStreamEnabled(i, streamEnabled[i]); inputStrDialog->setStreamType(i, streamType[i]); inputStrDialog->setStreamFormat(i, inputFormat[i]); @@ -650,7 +659,7 @@ void MainWindow::showInputStreamDialog() /* Paths -> [0]:serial, [1]:tcp, [2]:file, [3]:ftp */ for (j = 0; j < 4; j++) inputStrDialog->setPath(i, j, paths[i][j]); } - for (i = 0; i < 3; i++) + for (i = 0; i < RTKSVRNIN; i++) for (j = 0; j < 3; j++) { inputStrDialog->setCommandsEnabled(i, j, commandEnabled[i][j]); inputStrDialog->setCommands(i, j, commands[i][j]); @@ -676,7 +685,7 @@ void MainWindow::showInputStreamDialog() if (inputStrDialog->result() != QDialog::Accepted) return; - for (i = 0; i < 3; i++) { + for (i = 0; i < RTKSVRNIN; i++) { streamEnabled[i] = inputStrDialog->getStreamEnabled(i); streamType[i] = inputStrDialog->getStreamType(i); inputFormat [i] = inputStrDialog->getStreamFormat(i); @@ -684,7 +693,7 @@ void MainWindow::showInputStreamDialog() for (j = 0; j < 4; j++) paths[i][j] = inputStrDialog->getPath(i, j); } - for (i = 0; i < 3; i++) + for (i = 0; i < RTKSVRNIN; i++) for (j = 0; j < 3; j++) { commandEnabled[i][j] = inputStrDialog->getCommandsEnabled(i, j); commands[i][j] = inputStrDialog->getCommands(i, j); @@ -719,7 +728,7 @@ int MainWindow::confirmOverwrite(const QString &path) if (!QFile::exists(filename)) return 1; // file not exists // check overwrite input files - for (i = 0; i < 3; i++) { + for (i = 0; i < RTKSVRNIN; i++) { if (!streamEnabled[i] || itype[streamType[i]] != STR_FILE) continue; streamFilename = paths[i][2]; @@ -737,17 +746,17 @@ int MainWindow::confirmOverwrite(const QString &path) void MainWindow::showOutputStreamDialog() { int otype[] = {STR_SERIAL, STR_TCPCLI, STR_TCPSVR, STR_NTRIPSVR, STR_NTRIPCAS, STR_FILE}; - int i, j, str, update[2] = { 0 }; + int i, j, str, update[RTKSVRNSOL] = { 0 }; QString path; trace(3, "showOutputStreamDialog\n"); - for (i = 3; i < 5; i++) { - outputStrDialog->setStreamEnabled(i - 3, streamEnabled[i]); - outputStrDialog->setStreamType(i - 3, streamType[i]); - outputStrDialog->setStreamFormat(i - 3, inputFormat[i]); + for (i = RTKSVRNIN * 2; i < MAXSTRRTK; i++) { + outputStrDialog->setStreamEnabled(i - RTKSVRNIN * 2, streamEnabled[i]); + outputStrDialog->setStreamType(i - RTKSVRNIN * 2, streamType[i]); + outputStrDialog->setStreamFormat(i - RTKSVRNIN * 2, inputFormat[i]); for (j = 0; j < 4; j++) - outputStrDialog->setPath(i - 3, j, paths[i][j]); + outputStrDialog->setPath(i - RTKSVRNIN * 2, j, paths[i][j]); } for (i = 0; i < 10; i++) { outputStrDialog->setHistory(i, history[i]); @@ -758,21 +767,21 @@ void MainWindow::showOutputStreamDialog() if (outputStrDialog->result() != QDialog::Accepted) return; - for (i = 3; i < 5; i++) { - if (streamEnabled[i] != outputStrDialog->getStreamEnabled(i - 3) || - streamType[i] != outputStrDialog->getStreamType(i - 3) || - inputFormat[i] != outputStrDialog->getStreamFormat(i - 3) || - paths[i][0] != outputStrDialog->getPath(i - 3, 0) || - paths[i][1] != outputStrDialog->getPath(i - 3, 1) || - paths[i][2] != outputStrDialog->getPath(i - 3, 2) || - paths[i][3] != outputStrDialog->getPath(i - 3, 3)) - update[i - 3] = 1; - - streamEnabled[i] = outputStrDialog->getStreamEnabled(i - 3); - streamType[i] = outputStrDialog->getStreamType(i - 3); - inputFormat[i] = outputStrDialog->getStreamFormat(i - 3); + for (i = RTKSVRNIN * 2; i < MAXSTRRTK; i++) { + if (streamEnabled[i] != outputStrDialog->getStreamEnabled(i - RTKSVRNIN * 2) || + streamType[i] != outputStrDialog->getStreamType(i - RTKSVRNIN * 2) || + inputFormat[i] != outputStrDialog->getStreamFormat(i - RTKSVRNIN * 2) || + paths[i][0] != outputStrDialog->getPath(i - RTKSVRNIN * 2, 0) || + paths[i][1] != outputStrDialog->getPath(i - RTKSVRNIN * 2, 1) || + paths[i][2] != outputStrDialog->getPath(i - RTKSVRNIN * 2, 2) || + paths[i][3] != outputStrDialog->getPath(i - RTKSVRNIN * 2, 3)) + update[i - RTKSVRNIN * 2] = 1; + + streamEnabled[i] = outputStrDialog->getStreamEnabled(i - RTKSVRNIN * 2); + streamType[i] = outputStrDialog->getStreamType(i - RTKSVRNIN * 2); + inputFormat[i] = outputStrDialog->getStreamFormat(i - RTKSVRNIN * 2); for (j = 0; j < 4; j++) - paths[i][j] = outputStrDialog->getPath(i - 3, j); + paths[i][j] = outputStrDialog->getPath(i - RTKSVRNIN * 2, j); } for (i = 0; i < 10; i++) { history[i] = outputStrDialog->getHistory(i); @@ -782,8 +791,8 @@ void MainWindow::showOutputStreamDialog() if (ui->btnStart->isEnabled()) return; - for (i = 3; i < 5; i++) { - if (!update[i - 3]) continue; + for (i = RTKSVRNIN * 2; i < MAXSTRRTK; i++) { + if (!update[i - RTKSVRNIN * 2]) continue; rtksvrclosestr(rtksvr, i); @@ -806,16 +815,16 @@ void MainWindow::showOutputStreamDialog() void MainWindow::showLogStreamDialog() { int otype[] = {STR_SERIAL, STR_TCPCLI, STR_TCPSVR, STR_NTRIPSVR, STR_NTRIPCAS, STR_FILE}; - int i, j, str, update[3] = {0}; + int i, j, str, update[RTKSVRNIN] = {0}; QString path; trace(3, "showLogStreamDialog\n"); - for (i = 5; i < 8; i++) { - logStrDialog->setStreamEnabled(i - 5, streamEnabled[i]); - logStrDialog->setStreamType(i - 5, streamType [i]); + for (i = RTKSVRNIN; i < RTKSVRNIN * 2; i++) { + logStrDialog->setStreamEnabled(i - RTKSVRNIN, streamEnabled[i]); + logStrDialog->setStreamType(i - RTKSVRNIN, streamType [i]); for (j = 0; j < 4; j++) - logStrDialog->setPath(i - 5, j, paths[i][j]); + logStrDialog->setPath(i - RTKSVRNIN, j, paths[i][j]); } for (i = 0; i < 10; i++) { logStrDialog->setHistory(i, history[i]); @@ -827,20 +836,20 @@ void MainWindow::showLogStreamDialog() if (logStrDialog->result() != QDialog::Accepted) return; - for (i = 5; i < 8; i++) { - if (streamEnabled[i] != outputStrDialog->getStreamEnabled((i - 5) % 2) || - streamType[i] != outputStrDialog->getStreamType((i - 5) % 2) || - paths[i][0] != outputStrDialog->getPath((i - 3) % 2, 0) || - paths[i][1] != outputStrDialog->getPath((i - 3) % 2, 1) || - paths[i][2] != outputStrDialog->getPath((i - 3) % 2, 2) || - paths[i][3] != outputStrDialog->getPath((i - 3) % 2, 3)) - update[i - 5] = 1; + for (i = RTKSVRNIN; i < RTKSVRNIN * 2; i++) { + if (streamEnabled[i] != logStrDialog->getStreamEnabled(i - RTKSVRNIN) || + streamType[i] != logStrDialog->getStreamType(i - RTKSVRNIN) || + paths[i][0] != logStrDialog->getPath(i - RTKSVRNIN, 0) || + paths[i][1] != logStrDialog->getPath(i - RTKSVRNIN, 1) || + paths[i][2] != logStrDialog->getPath(i - RTKSVRNIN, 2) || + paths[i][3] != logStrDialog->getPath(i - RTKSVRNIN, 3)) + update[i - RTKSVRNIN] = 1; - streamEnabled[i] = logStrDialog->getStreamEnabled(i - 5); - streamType[i] = logStrDialog->getStreamType(i - 5); + streamEnabled[i] = logStrDialog->getStreamEnabled(i - RTKSVRNIN); + streamType[i] = logStrDialog->getStreamType(i - RTKSVRNIN); for (j = 0; j < 4; j++) - paths[i][j] = logStrDialog->getPath(i - 5, j); + paths[i][j] = logStrDialog->getPath(i - RTKSVRNIN, j); } for (i = 0; i < 10; i++) { history[i] = logStrDialog->getHistory(i); @@ -851,8 +860,8 @@ void MainWindow::showLogStreamDialog() if (ui->btnStart->isEnabled()) return; - for (i = 5; i < 8; i++) { - if (!update[i - 5]) continue; + for (i = RTKSVRNIN; i < RTKSVRNIN * 2; i++) { + if (!update[i - RTKSVRNIN]) continue; rtksvrclosestr(rtksvr, i); @@ -1109,12 +1118,12 @@ void MainWindow::expandFromTray() // start rtk server --------------------------------------------------------- void MainWindow::serverStart() { - solopt_t solopt[2]; + solopt_t solopt[RTKSVRNSOL]; double pos[3], nmeapos[3]; int itype[] = {STR_SERIAL, STR_TCPCLI, STR_TCPSVR, STR_NTRIPCLI, STR_FILE, STR_FTP, STR_HTTP}; int otype[] = {STR_SERIAL, STR_TCPCLI, STR_TCPSVR, STR_NTRIPSVR, STR_NTRIPCAS, STR_FILE}; int i, j, streamTypes[MAXSTRRTK] = {0}, stropt[8] = {0}; - char *serverPaths[8], *cmds[3] = {0}, *cmds_periodic[3] = {0}, *rcvopts[3] = {0}; + char *serverPaths[MAXSTRRTK], *cmds[RTKSVRNIN] = {0}, *cmds_periodic[RTKSVRNIN] = {0}, *rcvopts[RTKSVRNIN] = {0}; char errmsg[20148]; gtime_t time = timeget(); pcvs_t pcvs; @@ -1154,11 +1163,11 @@ void MainWindow::serverStart() free_pcvs(&pcvs); } - for (i = 0; i < 3; i++) streamTypes[i] = streamEnabled[i] ? itype[streamType[i]] : STR_NONE; // input stream - for (i = 3; i < 5; i++) streamTypes[i] = streamEnabled[i] ? otype[streamType[i]] : STR_NONE; // output stream - for (i = 5; i < 8; i++) streamTypes[i] = streamEnabled[i] ? otype[streamType[i]] : STR_NONE; // log streams + for (i = 0; i < RTKSVRNIN; i++) streamTypes[i] = streamEnabled[i] ? itype[streamType[i]] : STR_NONE; // input stream + for (i = RTKSVRNIN; i < RTKSVRNIN * 2; i++) streamTypes[i] = streamEnabled[i] ? otype[streamType[i]] : STR_NONE; // log streams + for (i = RTKSVRNIN * 2; i < MAXSTRRTK; i++) streamTypes[i] = streamEnabled[i] ? otype[streamType[i]] : STR_NONE; // output stream - for (i = 0; i < 8; i++) { + for (i = 0; i < MAXSTRRTK; i++) { serverPaths[i] = new char[1024]; serverPaths[i][0] = '\0'; if (streamTypes[i] == STR_NONE) strncpy(serverPaths[i], "", 1023); @@ -1168,7 +1177,7 @@ void MainWindow::serverStart() else strncpy(serverPaths[i], qPrintable(paths[i][1]), 1023); } - for (i = 0; i < 3; i++) { + for (i = 0; i < RTKSVRNIN; i++) { rcvopts[i] = new char[1024]; cmds[i] = cmds_periodic[i] = NULL; @@ -1197,15 +1206,15 @@ void MainWindow::serverStart() strsetdir(optDialog->fileOptions.tempdir); strsetproxy(qPrintable(optDialog->proxyAddress)); - for (i = 3; i < 8; i++) + for (i = RTKSVRNIN; i < MAXSTRRTK; i++) if (streamTypes[i] == STR_FILE && !confirmOverwrite(serverPaths[i])) { if (optDialog->solutionOptions.trace > 0) traceclose(); free_pcvs(&rtksvr->pcvsr); - for (j = 0; j < 8; j++) delete[] serverPaths[j]; - for (j = 0; j < 3; j++) delete[] rcvopts[j]; - for (j = 0; j < 3; j++) + for (j = 0; j < MAXSTRRTK; j++) delete[] serverPaths[j]; + for (j = 0; j < RTKSVRNIN; j++) delete[] rcvopts[j]; + for (j = 0; j < RTKSVRNIN; j++) if (cmds[j]) delete[] cmds[j]; - for (j = 0; j < 3; j++) + for (j = 0; j < RTKSVRNIN; j++) if (cmds_periodic[j]) delete[] cmds_periodic[j]; return; } @@ -1217,9 +1226,9 @@ void MainWindow::serverStart() if (strlen(optDialog->fileOptions.dcb) > 0) readdcb(optDialog->fileOptions.dcb, &rtksvr->nav, NULL); - for (i = 0; i < 2; i++) { + for (i = 0; i < RTKSVRNSOL; i++) { solopt[i] = optDialog->solutionOptions; - solopt[i].posf = inputFormat[i + 3]; + solopt[i].posf = inputFormat[RTKSVRNIN*2 + i]; } stropt[0] = optDialog->timeoutTime; stropt[1] = optDialog->reconnectTime; @@ -1238,20 +1247,20 @@ void MainWindow::serverStart() trace(2, "rtksvrstart error %s\n", errmsg); if (optDialog->solutionOptions.trace > 0) traceclose(); free_pcvs(&rtksvr->pcvsr); - for (i = 0; i < 8; i++) delete[] serverPaths[i]; - for (i = 0; i < 3; i++) delete[] rcvopts[i]; - for (i = 0; i < 3; i++) + for (i = 0; i < MAXSTRRTK; i++) delete[] serverPaths[i]; + for (i = 0; i < RTKSVRNIN; i++) delete[] rcvopts[i]; + for (i = 0; i < RTKSVRNIN; i++) if (cmds[i]) delete[] cmds[i]; - for (i = 0; i < 3; i++) + for (i = 0; i < RTKSVRNIN; i++) if (cmds_periodic[i]) delete[] cmds_periodic[i]; return; } - for (i = 0; i < 8; i++) delete[] serverPaths[i]; - for (i = 0; i < 3; i++) delete[] rcvopts[i]; - for (i = 0; i < 3; i++) + for (i = 0; i < MAXSTRRTK; i++) delete[] serverPaths[i]; + for (i = 0; i < RTKSVRNIN; i++) delete[] rcvopts[i]; + for (i = 0; i < RTKSVRNIN; i++) if (cmds[i]) delete[] cmds[i]; - for (i = 0; i < 3; i++) + for (i = 0; i < RTKSVRNIN; i++) if (cmds_periodic[i]) delete[] cmds_periodic[i]; solutionsCurrent = solutionsStart = solutionsEnd = 0; @@ -1284,12 +1293,12 @@ void MainWindow::serverStart() // stop rtk server --------------------------------------------------------- void MainWindow::serverStop() { - char *cmds[3] = { 0 }; + char *cmds[RTKSVRNIN] = { 0 }; int i, n, m, streamTypes; trace(3, "serverStop\n"); - for (i = 0; i < 3; i++) { + for (i = 0; i < RTKSVRNIN; i++) { cmds[i] = NULL; streamTypes = rtksvr->stream[i].type; @@ -1307,7 +1316,7 @@ void MainWindow::serverStop() free_pcvs(&rtksvr->pcvsr); - for (i = 0; i < 3; i++) delete[] cmds[i]; + for (i = 0; i < RTKSVRNIN; i++) delete[] cmds[i]; ui->btnStart->setVisible(true); ui->btnStart->setEnabled(true); @@ -1622,7 +1631,7 @@ void MainWindow::updatePosition() void MainWindow::updateStream() { static const QColor color[] = {QColor(Qt::red), QColor(Qt::white), Color::Orange, Qt::darkGreen, Color::Lime}; - QLabel *ind[MAXSTRRTK] = {ui->lblStream1, ui->lblStream2, ui->lblStream3, ui->lblStream4, ui->lblStream5, ui->lblStream6, ui->lblStream7, ui->lblStream8}; + QLabel *ind[MAXSTRRTK] = {ui->lblStream1, ui->lblStream2, ui->lblStream3, ui->lblStream4, ui->lblStream5, ui->lblStream6, ui->lblStream7, ui->lblStream8, ui->lblStream9, ui->lblStream10, ui->lblStream11}; int i, sstat[MAXSTRRTK] = {0}; char msg[MAXSTRMSG] = ""; @@ -2486,11 +2495,11 @@ void MainWindow::setTrayIcon(int index) void MainWindow::loadOptions() { QSettings settings(iniFile, QSettings::IniFormat); - int i, j, no, strno[] = { 0, 1, 6, 2, 3, 4, 5, 7 }; + int i, j, no, strno[MAXSTRRTK] = { 0, 1, 6, 9, 4, 5, 7, 10, 2, 3, 8 }; trace(3, "loadOptions\n"); - for (i = 0; i < 8; i++) { + for (i = 0; i < MAXSTRRTK; i++) { no = strno[i]; streamEnabled[i] = settings.value(QString("stream/streamc%1").arg(no), 0).toInt(); streamType[i] = settings.value(QString("stream/stream%1").arg(no), 0).toInt(); @@ -2499,17 +2508,17 @@ void MainWindow::loadOptions() paths[i][j] = settings.value(QString("stream/path_%1_%2").arg(no).arg(j), "").toString(); } - for (i = 0; i < 3; i++) + for (i = 0; i < RTKSVRNIN; i++) receiverOptions [i] = settings.value(QString("stream/rcvopt%1").arg(i + 1), "").toString(); - for (i = 0; i < 3; i++) + for (i = 0; i < RTKSVRNIN; i++) for (j = 0; j < 3; j++) { commands[i][j] = settings.value(QString("serial/cmd_%1_%2").arg(i).arg(j), "").toString(); commandEnabled[i][j] = settings.value(QString("serial/cmdena_%1_%2").arg(i).arg(j), 0).toInt(); commands[i][j].replace("@@", "\r\n"); } - for (i = 0; i < 3; i++) + for (i = 0; i < RTKSVRNIN; i++) for (j = 0; j < 3; j++) { commandsTcp[i][j] = settings.value(QString("tcpip/cmd_%1_%2").arg(i).arg(j), "").toString(); commandEnableTcp[i][j] = settings.value(QString("tcpip/cmdena_%1_%2").arg(i).arg(j), 0).toInt(); @@ -2584,13 +2593,13 @@ void MainWindow::loadOptions() void MainWindow::saveOptions() { QSettings settings(iniFile, QSettings::IniFormat); - int i, j, no, strno[] = { 0, 1, 6, 2, 3, 4, 5, 7 }; + int i, j, no, strno[MAXSTRRTK] = { 0, 1, 6, 9, 4, 5, 7, 10, 2, 3, 8 }; trace(3, "saveOptions\n"); optDialog->saveOptions(settings); - for (i = 0; i < 8; i++) { + for (i = 0; i < MAXSTRRTK; i++) { no = strno[i]; settings.setValue(QString("stream/streamc%1").arg(no), streamEnabled[i]); settings.setValue(QString("stream/stream%1").arg(no), streamType[i]); @@ -2598,16 +2607,16 @@ void MainWindow::saveOptions() for (j = 0; j < 4; j++) settings.setValue(QString("stream/path_%1_%2").arg(no).arg(j), paths[i][j]); } - for (i = 0; i < 3; i++) + for (i = 0; i < RTKSVRNIN; i++) settings.setValue(QString("stream/rcvopt%1").arg(i + 1), receiverOptions[i]); - for (i = 0; i < 3; i++) + for (i = 0; i < RTKSVRNIN; i++) for (j = 0; j < 3; j++) { commands[i][j].replace("\r\n", "@@"); settings.setValue(QString("serial/cmd_%1_%2").arg(i).arg(j), commands[i][j]); settings.setValue(QString("serial/cmdena_%1_%2").arg(i).arg(j), commandEnabled[i][j]); } - for (i = 0; i < 3; i++) + for (i = 0; i < RTKSVRNIN; i++) for (j = 0; j < 3; j++) { commandsTcp[i][j].replace("\r\n", "@@"); settings.setValue(QString("tcpip/cmd_%1_%2").arg(i).arg(j), commandsTcp[i][j]); diff --git a/app/qtapp/rtknavi_qt/navimain.h b/app/qtapp/rtknavi_qt/navimain.h index 3876e2a1c..513534205 100644 --- a/app/qtapp/rtknavi_qt/navimain.h +++ b/app/qtapp/rtknavi_qt/navimain.h @@ -151,7 +151,7 @@ public slots: int inputTimeTag, inputTimeTag64bit; int outputTimeTag, outputAppend, logTimeTag; int streamType[MAXSTRRTK], streamEnabled[MAXSTRRTK], inputFormat[MAXSTRRTK]; - int commandEnabled[3][3], commandEnableTcp[3][3]; + int commandEnabled[RTKSVRNIN][3], commandEnableTcp[RTKSVRNIN][3]; int timeSystem, solutionType; int plotType[4], frequencyType[4]; int trackType[4]; @@ -167,10 +167,10 @@ public slots: double *solutionRover, *solutionReference, *solutionQr, *velocityRover, *ages, *ratioAR; double trackOrigin[3], maxBaseLine; - QString paths[MAXSTRRTK][4], commands[3][3], commandsTcp[3][3]; + QString paths[MAXSTRRTK][4], commands[RTKSVRNIN][3], commandsTcp[RTKSVRNIN][3]; QString inputTimeSpeed; double inputTimeStart; - QString receiverOptions[3]; + QString receiverOptions[RTKSVRNIN]; QString outputSwapInterval, logSwapInterval, resetCommand; int nmeaRequestType; diff --git a/app/qtapp/rtknavi_qt/navimain.ui b/app/qtapp/rtknavi_qt/navimain.ui index 85a09e130..a29b7a825 100644 --- a/app/qtapp/rtknavi_qt/navimain.ui +++ b/app/qtapp/rtknavi_qt/navimain.ui @@ -184,7 +184,23 @@ - Correction data input stream + Correction 1 data input stream + + + QFrame::Shape::Box + + + + + + + + 0 + 0 + + + + Correction 2 data input stream QFrame::Shape::Box @@ -234,7 +250,7 @@ - + 0 @@ -242,7 +258,7 @@ - Solution stream 1 + Log stream rover QFrame::Shape::Box @@ -250,7 +266,7 @@ - + 0 @@ -258,7 +274,7 @@ - Solution stream 2 + Log stream base station QFrame::Shape::Box @@ -266,7 +282,7 @@ - + 0 @@ -274,7 +290,23 @@ - Log stream rover + Log stream corrections 1 + + + QFrame::Shape::Box + + + + + + + + 0 + 0 + + + + Log stream corrections 2 QFrame::Shape::Box @@ -285,7 +317,7 @@ - + 0 @@ -293,7 +325,7 @@ - Log stream base station + Solution stream 1 QFrame::Shape::Box @@ -301,7 +333,23 @@ - + + + + 0 + 0 + + + + Solution stream 2 + + + QFrame::Shape::Box + + + + + 0 @@ -309,7 +357,7 @@ - Log stream corrections + Solution stream 3 QFrame::Shape::Box @@ -320,7 +368,7 @@ - + 0 @@ -328,15 +376,15 @@ - Define output streams + Define log streams - O + L - + 0 @@ -344,10 +392,10 @@ - Define log streams + Define output streams - L + O diff --git a/app/qtapp/rtknavi_qt/outstrdlg.cpp b/app/qtapp/rtknavi_qt/outstrdlg.cpp index f9745b86d..0287ad338 100644 --- a/app/qtapp/rtknavi_qt/outstrdlg.cpp +++ b/app/qtapp/rtknavi_qt/outstrdlg.cpp @@ -34,6 +34,12 @@ OutputStrDialog::OutputStrDialog(QWidget *parent) ui->cBFormat2->setItemData(3, "NMEA GPRMC, GPGGA, GPGSA, GLGSA, GAGSA, GPGSV, GLGSV and GAGSV", Qt::ToolTipRole); ui->cBFormat2->setItemData(4, "Solution status", Qt::ToolTipRole); + ui->cBFormat3->setItemData(0, "Latitude, longitude and height", Qt::ToolTipRole); + ui->cBFormat3->setItemData(1, "X/Y/Z components of ECEF coordinates", Qt::ToolTipRole); + ui->cBFormat3->setItemData(2, "E/N/U components of baseline vector", Qt::ToolTipRole); + ui->cBFormat3->setItemData(3, "NMEA GPRMC, GPGGA, GPGSA, GLGSA, GAGSA, GPGSV, GLGSV and GAGSV", Qt::ToolTipRole); + ui->cBFormat3->setItemData(4, "Solution status", Qt::ToolTipRole); + keyDialog = new KeyDialog(this); serialOptDialog = new SerialOptDialog(this); tcpOptDialog = new TcpOptDialog(this); @@ -42,24 +48,31 @@ OutputStrDialog::OutputStrDialog(QWidget *parent) fileModel->setRootPath(""); ui->lEFilePath1->setCompleter(new QCompleter(fileModel, this)); ui->lEFilePath2->setCompleter(new QCompleter(fileModel, this)); + ui->lEFilePath3->setCompleter(new QCompleter(fileModel, this)); // line edit actions QAction *aclEFilePath1Select = ui->lEFilePath1->addAction(QIcon(":/buttons/folder"), QLineEdit::TrailingPosition); aclEFilePath1Select->setToolTip(tr("Select File")); QAction *aclEFilePath2Select = ui->lEFilePath2->addAction(QIcon(":/buttons/folder"), QLineEdit::TrailingPosition); aclEFilePath2Select->setToolTip(tr("Select File")); + QAction *aclEFilePath3Select = ui->lEFilePath3->addAction(QIcon(":/buttons/folder"), QLineEdit::TrailingPosition); + aclEFilePath3Select->setToolTip(tr("Select File")); connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &OutputStrDialog::accept); connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &OutputStrDialog::reject); connect(aclEFilePath1Select, &QAction::triggered, this, &OutputStrDialog::selectFile1); connect(aclEFilePath2Select, &QAction::triggered, this, &OutputStrDialog::selectFile2); + connect(aclEFilePath3Select, &QAction::triggered, this, &OutputStrDialog::selectFile3); connect(ui->btnKey, &QPushButton::clicked, this, &OutputStrDialog::showKeyDialog); connect(ui->btnStream1, &QPushButton::clicked, this, &OutputStrDialog::showStream1Options); connect(ui->btnStream2, &QPushButton::clicked, this, &OutputStrDialog::showStream2Options); + connect(ui->btnStream3, &QPushButton::clicked, this, &OutputStrDialog::showStream2Options); connect(ui->cBStream1, static_cast(&QComboBox::currentIndexChanged), this, &OutputStrDialog::updateEnable); connect(ui->cBStream2, static_cast(&QComboBox::currentIndexChanged), this, &OutputStrDialog::updateEnable); + connect(ui->cBStream3, static_cast(&QComboBox::currentIndexChanged), this, &OutputStrDialog::updateEnable); connect(ui->cBStream1C, &QCheckBox::clicked, this, &OutputStrDialog::updateEnable); connect(ui->cBStream2C, &QCheckBox::clicked, this, &OutputStrDialog::updateEnable); + connect(ui->cBStream3C, &QCheckBox::clicked, this, &OutputStrDialog::updateEnable); ui->cBSwapInterval->setValidator(new QDoubleValidator(this)); } @@ -79,6 +92,13 @@ void OutputStrDialog::selectFile2() ui->lEFilePath2->setText(QDir::toNativeSeparators(filename)); } //--------------------------------------------------------------------------- +void OutputStrDialog::selectFile3() +{ + QString filename = QFileDialog::getSaveFileName(this, tr("Load..."), ui->lEFilePath3->text()); + if (!filename.isEmpty()) + ui->lEFilePath3->setText(QDir::toNativeSeparators(filename)); +} +//--------------------------------------------------------------------------- void OutputStrDialog::showKeyDialog() { keyDialog->show(); @@ -106,6 +126,17 @@ void OutputStrDialog::showStream2Options() } } //--------------------------------------------------------------------------- +void OutputStrDialog::showStream3Options() +{ + switch (ui->cBStream3->currentIndex()) { + case 0: showSerialOptions(1, 0); break; + case 1: showTcpOptions(2, TcpOptDialog::OPT_TCP_CLIENT); break; + case 2: showTcpOptions(2, TcpOptDialog::OPT_TCP_SERVER); break; + case 3: showTcpOptions(2, TcpOptDialog::OPT_NTRIP_SERVER); break; + case 4: showTcpOptions(0, TcpOptDialog::OPT_NTRIP_CASTER_CLIENT); break; + } +} +//--------------------------------------------------------------------------- QString OutputStrDialog::getFilePath(const QString &path) { return path.mid(0, path.indexOf("::")); @@ -126,7 +157,7 @@ QString OutputStrDialog::setFilePath(const QString &p) //--------------------------------------------------------------------------- void OutputStrDialog::showSerialOptions(int index, int opt) { - if ((index < 0) || (index > 1)) return; + if ((index < 0) || (index >= RTKSVRNSOL)) return; serialOptDialog->setOptions(opt); serialOptDialog->setPath(paths[index][0]); @@ -139,7 +170,7 @@ void OutputStrDialog::showSerialOptions(int index, int opt) //--------------------------------------------------------------------------- void OutputStrDialog::showTcpOptions(int index, int opt) { - if ((index < 0) || (index > 1)) return; + if ((index < 0) || (index >= RTKSVRNSOL)) return; tcpOptDialog->setOptions(opt); tcpOptDialog->setHistory(history, 10); @@ -157,16 +188,21 @@ void OutputStrDialog::showTcpOptions(int index, int opt) void OutputStrDialog::updateEnable() { int ena = (ui->cBStream1C->isChecked() && (ui->cBStream1->currentIndex() == 5)) || - (ui->cBStream2C->isChecked() && (ui->cBStream2->currentIndex() == 5)); + (ui->cBStream2C->isChecked() && (ui->cBStream2->currentIndex() == 5)) || + (ui->cBStream3C->isChecked() && (ui->cBStream3->currentIndex() == 5)); ui->cBStream1->setEnabled(ui->cBStream1C->isChecked()); ui->cBStream2->setEnabled(ui->cBStream2C->isChecked()); + ui->cBStream3->setEnabled(ui->cBStream3C->isChecked()); ui->btnStream1->setEnabled(ui->cBStream1C->isChecked() && ui->cBStream1->currentIndex() <= 4); ui->btnStream2->setEnabled(ui->cBStream2C->isChecked() && ui->cBStream2->currentIndex() <= 4); + ui->btnStream3->setEnabled(ui->cBStream3C->isChecked() && ui->cBStream3->currentIndex() <= 4); ui->lEFilePath1->setEnabled(ui->cBStream1C->isChecked() && ui->cBStream1->currentIndex() == 5); ui->lEFilePath2->setEnabled(ui->cBStream2C->isChecked() && ui->cBStream2->currentIndex() == 5); + ui->lEFilePath3->setEnabled(ui->cBStream3C->isChecked() && ui->cBStream3->currentIndex() == 5); ui->cBFormat1->setEnabled(ui->cBStream1C->isChecked()); ui->cBFormat2->setEnabled(ui->cBStream2C->isChecked()); + ui->cBFormat3->setEnabled(ui->cBStream3C->isChecked()); ui->lblF1->setEnabled(ena); ui->lblSwapInterval->setEnabled(ena); ui->cBTimeTag->setEnabled(ena); @@ -176,8 +212,8 @@ void OutputStrDialog::updateEnable() //--------------------------------------------------------------------------- void OutputStrDialog::setStreamEnabled(int stream, int enabled) { - QCheckBox *cBStreamC[] = {ui->cBStream1C, ui->cBStream2C}; - if ((stream < 0 ) || (stream > 1)) return; + QCheckBox *cBStreamC[] = {ui->cBStream1C, ui->cBStream2C, ui->cBStream3C}; + if ((stream < 0 ) || (stream >= RTKSVRNSOL)) return; cBStreamC[stream]->setChecked(enabled); @@ -186,16 +222,16 @@ void OutputStrDialog::setStreamEnabled(int stream, int enabled) //--------------------------------------------------------------------------- int OutputStrDialog::getStreamEnabled(int stream) { - QCheckBox *cBStreamC[] = {ui->cBStream1C, ui->cBStream2C}; - if ((stream < 0 ) || (stream > 1)) return false; + QCheckBox *cBStreamC[] = {ui->cBStream1C, ui->cBStream2C, ui->cBStream3C}; + if ((stream < 0 ) || (stream >= RTKSVRNSOL)) return false; return cBStreamC[stream]->isChecked(); } //--------------------------------------------------------------------------- void OutputStrDialog::setStreamType(int stream, int type) { - QComboBox *cBStream[] = {ui->cBStream1, ui->cBStream2}; - if ((stream < 0 ) || (stream > 1)) return; + QComboBox *cBStream[] = {ui->cBStream1, ui->cBStream2, ui->cBStream3}; + if ((stream < 0 ) || (stream >= RTKSVRNSOL)) return; cBStream[stream]->setCurrentIndex(type); @@ -204,8 +240,8 @@ void OutputStrDialog::setStreamType(int stream, int type) //--------------------------------------------------------------------------- void OutputStrDialog::setStreamFormat(int stream, int format) { - QComboBox *cBFormat[] = {ui->cBFormat1, ui->cBFormat2}; - if ((stream < 0 ) || (stream > 1)) return; + QComboBox *cBFormat[] = {ui->cBFormat1, ui->cBFormat2, ui->cBFormat3}; + if ((stream < 0 ) || (stream >= RTKSVRNSOL)) return; cBFormat[stream]->setCurrentIndex(format); updateEnable(); @@ -213,8 +249,8 @@ void OutputStrDialog::setStreamFormat(int stream, int format) //--------------------------------------------------------------------------- int OutputStrDialog::getStreamFormat(int stream) { - QComboBox *cBFormat[] = {ui->cBFormat1, ui->cBFormat2}; - if ((stream < 0 ) || (stream > 1)) return STRFMT_RTCM2; + QComboBox *cBFormat[] = {ui->cBFormat1, ui->cBFormat2, ui->cBFormat3}; + if ((stream < 0 ) || (stream >= RTKSVRNSOL)) return STRFMT_RTCM2; return cBFormat[stream]->currentIndex(); } @@ -222,16 +258,16 @@ int OutputStrDialog::getStreamFormat(int stream) //--------------------------------------------------------------------------- int OutputStrDialog::getStreamType(int stream) { - QComboBox *cBStream[] = {ui->cBStream1, ui->cBStream2}; - if ((stream < 0 ) || (stream > 1)) return STR_NONE; + QComboBox *cBStream[] = {ui->cBStream1, ui->cBStream2, ui->cBStream3}; + if ((stream < 0 ) || (stream >= RTKSVRNSOL)) return STR_NONE; return cBStream[stream]->currentIndex(); }; //--------------------------------------------------------------------------- void OutputStrDialog::setPath(int stream, int type, const QString &path) { - QLineEdit *edits[] = {ui->lEFilePath1, ui->lEFilePath2}; - if ((stream < 0 ) || (stream > 1)) return; + QLineEdit *edits[] = {ui->lEFilePath1, ui->lEFilePath2, ui->lEFilePath3}; + if ((stream < 0 ) || (stream >= RTKSVRNSOL)) return; if ((type < 0) || (type > 3)) return; paths[stream][type] = path; @@ -251,8 +287,8 @@ void OutputStrDialog::setPath(int stream, int type, const QString &path) //--------------------------------------------------------------------------- QString OutputStrDialog::getPath(int stream, int type) { - QLineEdit *edits[] = {ui->lEFilePath1, ui->lEFilePath2}; - if ((stream < 0 ) || (stream > 1)) return ""; + QLineEdit *edits[] = {ui->lEFilePath1, ui->lEFilePath2, ui->lEFilePath3}; + if ((stream < 0 ) || (stream >= RTKSVRNSOL)) return ""; if ((type < 0) || (type > 3)) return ""; if (type == 2) diff --git a/app/qtapp/rtknavi_qt/outstrdlg.h b/app/qtapp/rtknavi_qt/outstrdlg.h index d807e55fb..dbf06781c 100644 --- a/app/qtapp/rtknavi_qt/outstrdlg.h +++ b/app/qtapp/rtknavi_qt/outstrdlg.h @@ -4,6 +4,8 @@ //--------------------------------------------------------------------------- #include +#include "rtklib.h" + namespace Ui { class OutputStrDialog; } @@ -49,8 +51,10 @@ class OutputStrDialog : public QDialog public slots: void showStream1Options(); void showStream2Options(); + void showStream3Options(); void selectFile1(); void selectFile2(); + void selectFile3(); void showKeyDialog(); void updateEnable(); @@ -62,7 +66,7 @@ public slots: Ui::OutputStrDialog *ui; - QString paths[2][4]; + QString paths[RTKSVRNSOL][4]; QString history[10]; }; diff --git a/app/qtapp/rtknavi_qt/outstrdlg.ui b/app/qtapp/rtknavi_qt/outstrdlg.ui index 7ae2adbf1..7ff248287 100644 --- a/app/qtapp/rtknavi_qt/outstrdlg.ui +++ b/app/qtapp/rtknavi_qt/outstrdlg.ui @@ -165,6 +165,13 @@ + + + + Specify file name for third solution data stream + + + @@ -183,30 +190,55 @@ 0 - - - - Enable first output stream for solution data + + + + + 0 + 0 + - (4) Solution 1 + Output Stream - - + + + + Type + + + + + + + Options + + + + + + + Format + + + + + + - Select options for the second solution data stream + Enable first output stream for solution data - ... + (9) Solution 1 - - + + - Select stream type for second solution output stream + Select stream type for first solution output stream @@ -240,30 +272,63 @@ - - + + + + Select options for the first solution data stream + - Type + ... - - - - - 0 - 0 - + + + + Select time and position format for data stream + + + + Lat/Lon/Height + + + + + X/Y/Z-ECEF + + + + + E/N/U-Baseline + + + + + NMEA0183 + + + + + Solution Status + + + + + + + + + Enable second output stream for solution data - Output Stream + (10) Solution 2 - - + + - Select stream type for first solution output stream + Select stream type for second solution output stream @@ -297,74 +362,108 @@ - - + + - Enable second output stream for solution data + Select options for the second solution data stream - (5) Solution 2 + ... - - - - Options + + + + Select time and position format for data stream + + + Lat/Lon/Height + + + + + X/Y/Z-ECEF + + + + + E/N/U-Baseline + + + + + NMEA0183 + + + + + Solution Status + + - - + + + - Select options for the first solution data stream + Enable third output stream for solution data - ... + (11) Solution 3 - - - - Format - - - - - + + - Select time and position format for data stream + Select stream type for third solution output stream - Lat/Lon/Height + Serial - X/Y/Z-ECEF + TCP Client - E/N/U-Baseline + TCP Server - NMEA0183 + NTRIP Server - Solution Status + NTRIP Caster + + + + + File - - + + + + Select options for the third solution data stream + + + ... + + + + + Select time and position format for data stream @@ -395,6 +494,7 @@ + @@ -409,9 +509,14 @@ cBStream2 btnStream2 cBFormat2 + cBStream3C + cBStream3 + btnStream3 + cBFormat3 btnKey lEFilePath1 lEFilePath2 + lEFilePath3 cBTimeTag cBSwapInterval diff --git a/app/winapp/rtknavi/instrdlg.cpp b/app/winapp/rtknavi/instrdlg.cpp index 404a58c9c..011e6b89b 100644 --- a/app/winapp/rtknavi/instrdlg.cpp +++ b/app/winapp/rtknavi/instrdlg.cpp @@ -30,11 +30,14 @@ __fastcall TInputStrDialog::TInputStrDialog(TComponent* Owner) int i; Format1->Items->Clear(); Format2->Items->Clear(); + Format3->Items->Clear(); + Format4->Items->Clear(); NRcv=0; for (i=0;i<=MAXRCVFMT;i++) { Format1->Items->Add(formatstrs[i]); Format2->Items->Add(formatstrs[i]); Format3->Items->Add(formatstrs[i]); + Format4->Items->Add(formatstrs[i]); NRcv++; } Format3->Items->Add("SP3"); @@ -47,15 +50,19 @@ void __fastcall TInputStrDialog::FormShow(TObject *Sender) StreamC1 ->Checked =StreamC[0]; StreamC2 ->Checked =StreamC[1]; StreamC3 ->Checked =StreamC[2]; + StreamC4 ->Checked =StreamC[3]; Stream1 ->ItemIndex=Stream[0]; Stream2 ->ItemIndex=Stream[1]; Stream3 ->ItemIndex=Stream[2]; + Stream4 ->ItemIndex=Stream[3]; Format1 ->ItemIndex=Format[0]; Format2 ->ItemIndex=Format[1]ItemIndex=Format[2]ItemIndex=Format[3]Text =GetFilePath(Paths[0][2]); FilePath2 ->Text =GetFilePath(Paths[1][2]); FilePath3 ->Text =GetFilePath(Paths[2][2]); + FilePath4 ->Text =GetFilePath(Paths[3][2]); NmeaReqL ->ItemIndex=NmeaReq; TimeTagC ->Checked =TimeTag; TimeSpeedL->Text =TimeSpeed; @@ -74,15 +81,19 @@ void __fastcall TInputStrDialog::BtnOkClick(TObject *Sender) StreamC[0] =StreamC1 ->Checked; StreamC[1] =StreamC2 ->Checked; StreamC[2] =StreamC3 ->Checked; + StreamC[3] =StreamC4 ->Checked; Stream[0] =Stream1 ->ItemIndex; Stream[1] =Stream2 ->ItemIndex; Stream[2] =Stream3 ->ItemIndex; + Stream[3] =Stream4 ->ItemIndex; Format[0] =Format1 ->ItemIndex; Format[1] =Format2->ItemIndexItemIndex:STRFMT_SP3+Format2->ItemIndex-NRcv; Format[2] =Format3->ItemIndexItemIndex:STRFMT_SP3+Format3->ItemIndex-NRcv; + Format[3] =Format4->ItemIndexItemIndex:STRFMT_SP3+Format4->ItemIndex-NRcv; Paths[0][2]=SetFilePath(FilePath1->Text); Paths[1][2]=SetFilePath(FilePath2->Text); Paths[2][2]=SetFilePath(FilePath3->Text); + Paths[3][2]=SetFilePath(FilePath4->Text); NmeaReq =NmeaReqL ->ItemIndex; TimeTag =TimeTagC ->Checked; TimeSpeed =TimeSpeedL->Text; @@ -100,12 +111,21 @@ void __fastcall TInputStrDialog::StreamC1Click(TObject *Sender) UpdateEnable(); } //--------------------------------------------------------------------------- - void __fastcall TInputStrDialog::StreamC2Click(TObject *Sender) { UpdateEnable(); } //--------------------------------------------------------------------------- +void __fastcall TInputStrDialog::StreamC3Click(TObject *Sender) +{ + UpdateEnable(); +} +//--------------------------------------------------------------------------- +void __fastcall TInputStrDialog::StreamC4Click(TObject *Sender) +{ + UpdateEnable(); +} +//--------------------------------------------------------------------------- void __fastcall TInputStrDialog::Stream1Change(TObject *Sender) { UpdateEnable(); @@ -121,6 +141,11 @@ void __fastcall TInputStrDialog::Stream3Change(TObject *Sender) UpdateEnable(); } //--------------------------------------------------------------------------- +void __fastcall TInputStrDialog::Stream4Change(TObject *Sender) +{ + UpdateEnable(); +} +//--------------------------------------------------------------------------- void __fastcall TInputStrDialog::NmeaReqCClick(TObject *Sender) { UpdateEnable(); @@ -187,6 +212,18 @@ void __fastcall TInputStrDialog::BtnStr3Click(TObject *Sender) } } //--------------------------------------------------------------------------- +void __fastcall TInputStrDialog::BtnStr4Click(TObject *Sender) +{ + switch (Stream4->ItemIndex) { + case 0: SerialOpt(3,0); break; + case 1: TcpOpt(3,1); break; + case 2: TcpOpt(3,0); break; + case 3: TcpOpt(3,3); break; + case 5: FtpOpt(3,0); break; + case 6: FtpOpt(3,1); break; + } +} +//--------------------------------------------------------------------------- void __fastcall TInputStrDialog::BtnCmd1Click(TObject *Sender) { for (int i=0;i<3;i++) { @@ -262,6 +299,31 @@ void __fastcall TInputStrDialog::BtnCmd3Click(TObject *Sender) } } //--------------------------------------------------------------------------- +void __fastcall TInputStrDialog::BtnCmd4Click(TObject *Sender) +{ + for (int i=0;i<3;i++) { + if (Stream4->ItemIndex==0) { + CmdOptDialog->Cmds [i]=Cmds [3][i]; + CmdOptDialog->CmdEna[i]=CmdEna[3][i]; + } + else { + CmdOptDialog->Cmds [i]=CmdsTcp [3][i]; + CmdOptDialog->CmdEna[i]=CmdEnaTcp[3][i]; + } + } + if (CmdOptDialog->ShowModal()!=mrOk) return; + for (int i=0;i<3;i++) { + if (Stream4->ItemIndex==0) { + Cmds [3][i]=CmdOptDialog->Cmds [i]; + CmdEna[3][i]=CmdOptDialog->CmdEna[i]; + } + else { + CmdsTcp [3][i]=CmdOptDialog->Cmds [i]; + CmdEnaTcp[3][i]=CmdOptDialog->CmdEna[i]; + } + } +} +//--------------------------------------------------------------------------- void __fastcall TInputStrDialog::BtnRcvOpt1Click(TObject *Sender) { RcvOptDialog->Option=RcvOpt[0]; @@ -283,6 +345,13 @@ void __fastcall TInputStrDialog::BtnRcvOpt3Click(TObject *Sender) RcvOpt[2]=RcvOptDialog->Option; } //--------------------------------------------------------------------------- +void __fastcall TInputStrDialog::BtnRcvOpt4Click(TObject *Sender) +{ + RcvOptDialog->Option=RcvOpt[3]; + if (RcvOptDialog->ShowModal()!=mrOk) return; + RcvOpt[3]=RcvOptDialog->Option; +} +//--------------------------------------------------------------------------- void __fastcall TInputStrDialog::BtnPosClick(TObject *Sender) { AnsiString s; @@ -325,6 +394,13 @@ void __fastcall TInputStrDialog::BtnFile3Click(TObject *Sender) FilePath3->Text=OpenDialog->FileName; } //--------------------------------------------------------------------------- +void __fastcall TInputStrDialog::BtnFile4Click(TObject *Sender) +{ + //OpenDialog->FileName=FilePath4->Text; + if (!OpenDialog->Execute()) return; + FilePath4->Text=OpenDialog->FileName; +} +//--------------------------------------------------------------------------- void __fastcall TInputStrDialog::TcpOpt(int index, int opt) { TcpOptDialog->Path=Paths[index][1]; @@ -351,24 +427,30 @@ void __fastcall TInputStrDialog::UpdateEnable(void) { int ena1=(StreamC1->Checked&&Stream1->ItemIndex==4)|| (StreamC2->Checked&&Stream2->ItemIndex==4)|| - (StreamC3->Checked&&Stream3->ItemIndex==4); + (StreamC3->Checked&&Stream3->ItemIndex==4)|| + (StreamC4->Checked&&Stream4->ItemIndex==4); int ena2=StreamC2->Checked&&Stream2->ItemIndex<=3; Stream1 ->Enabled=StreamC1->Checked; Stream2 ->Enabled=StreamC2->Checked; Stream3 ->Enabled=StreamC3->Checked; + Stream4 ->Enabled=StreamC4->Checked; BtnStr1 ->Enabled=StreamC1->Checked&&Stream1->ItemIndex!=4; BtnStr2 ->Enabled=StreamC2->Checked&&Stream2->ItemIndex!=4; BtnStr3 ->Enabled=StreamC3->Checked&&Stream3->ItemIndex!=4; + BtnStr4 ->Enabled=StreamC4->Checked&&Stream4->ItemIndex!=4; BtnCmd1 ->Enabled=StreamC1->Checked&&Stream1->ItemIndex!=4; BtnCmd2 ->Enabled=StreamC2->Checked&&Stream2->ItemIndex!=4; BtnCmd3 ->Enabled=StreamC3->Checked&&Stream3->ItemIndex!=4; + BtnCmd4 ->Enabled=StreamC4->Checked&&Stream4->ItemIndex!=4; Format1 ->Enabled=StreamC1->Checked; Format2 ->Enabled=StreamC2->Checked; Format3 ->Enabled=StreamC3->Checked; + Format4 ->Enabled=StreamC4->Checked; BtnRcvOpt1->Enabled=StreamC1->Checked; BtnRcvOpt2->Enabled=StreamC2->Checked; BtnRcvOpt3->Enabled=StreamC3->Checked; + BtnRcvOpt4->Enabled=StreamC4->Checked; LabelNmea ->Enabled=ena2; NmeaReqL ->Enabled=ena2; @@ -386,9 +468,11 @@ void __fastcall TInputStrDialog::UpdateEnable(void) FilePath1 ->Enabled=StreamC1->Checked&&Stream1->ItemIndex==4; FilePath2 ->Enabled=StreamC2->Checked&&Stream2->ItemIndex==4; FilePath3 ->Enabled=StreamC3->Checked&&Stream3->ItemIndex==4; + FilePath4 ->Enabled=StreamC4->Checked&&Stream4->ItemIndex==4; BtnFile1 ->Enabled=StreamC1->Checked&&Stream1->ItemIndex==4; BtnFile2 ->Enabled=StreamC2->Checked&&Stream2->ItemIndex==4; BtnFile3 ->Enabled=StreamC3->Checked&&Stream3->ItemIndex==4; + BtnFile4 ->Enabled=StreamC4->Checked&&Stream4->ItemIndex==4; TimeTagC ->Enabled=ena1; TimeStartE->Enabled=ena1&&TimeTagC->Checked; TimeSpeedL->Enabled=ena1&&TimeTagC->Checked; diff --git a/app/winapp/rtknavi/instrdlg.dfm b/app/winapp/rtknavi/instrdlg.dfm index 2f6a34262..fb175e29b 100644 --- a/app/winapp/rtknavi/instrdlg.dfm +++ b/app/winapp/rtknavi/instrdlg.dfm @@ -4,7 +4,7 @@ object InputStrDialog: TInputStrDialog BorderIcons = [biSystemMenu] BorderStyle = bsDialog Caption = 'Input Streams' - ClientHeight = 261 + ClientHeight = 307 ClientWidth = 405 Color = clWhite Font.Charset = DEFAULT_CHARSET @@ -54,28 +54,28 @@ object InputStrDialog: TInputStrDialog end object LabelF1: TLabel Left = 8 - Top = 147 + Top = 171 Width = 75 Height = 13 Caption = 'Input File Paths' end object LabelF2: TLabel Left = 155 - Top = 236 + Top = 282 Width = 5 Height = 13 Caption = 's' end object LabelF3: TLabel Left = 101 - Top = 236 + Top = 282 Width = 8 Height = 13 Caption = '+' end object LabelNmea: TLabel Left = 9 - Top = 88 + Top = 112 Width = 172 Height = 13 Caption = 'Transmit NMEA GGA to Base Station' @@ -89,21 +89,21 @@ object InputStrDialog: TInputStrDialog end object LabelResetCmd: TLabel Left = 8 - Top = 128 + Top = 152 Width = 52 Height = 13 Caption = 'Reset Cmd' end object LabelMaxBL: TLabel Left = 273 - Top = 129 + Top = 153 Width = 62 Height = 13 Caption = 'Max Baseline' end object LabelKm: TLabel Left = 375 - Top = 129 + Top = 153 Width = 13 Height = 13 Caption = 'km' @@ -128,7 +128,7 @@ object InputStrDialog: TInputStrDialog end object TimeTagC: TCheckBox Left = 7 - Top = 234 + Top = 280 Width = 47 Height = 17 Caption = 'Time' @@ -137,7 +137,7 @@ object InputStrDialog: TInputStrDialog end object BtnCancel: TButton Left = 313 - Top = 230 + Top = 276 Width = 85 Height = 27 Caption = '&Cancel' @@ -146,7 +146,7 @@ object InputStrDialog: TInputStrDialog end object BtnOk: TButton Left = 224 - Top = 230 + Top = 276 Width = 85 Height = 27 Caption = '&OK' @@ -268,21 +268,21 @@ object InputStrDialog: TInputStrDialog end object FilePath1: TEdit Left = 6 - Top = 161 + Top = 185 Width = 366 Height = 21 TabOrder = 24 end object FilePath2: TEdit Left = 6 - Top = 183 + Top = 207 Width = 366 Height = 21 TabOrder = 26 end object TimeStartE: TEdit Left = 113 - Top = 232 + Top = 280 Width = 39 Height = 21 TabOrder = 30 @@ -290,7 +290,7 @@ object InputStrDialog: TInputStrDialog end object BtnFile1: TButton Left = 373 - Top = 160 + Top = 184 Width = 25 Height = 22 Caption = '...' @@ -305,7 +305,7 @@ object InputStrDialog: TInputStrDialog end object BtnFile2: TButton Left = 373 - Top = 182 + Top = 206 Width = 25 Height = 22 Caption = '...' @@ -320,7 +320,7 @@ object InputStrDialog: TInputStrDialog end object NmeaReqL: TComboBox Left = 7 - Top = 102 + Top = 126 Width = 120 Height = 21 Style = csDropDownList @@ -336,7 +336,7 @@ object InputStrDialog: TInputStrDialog end object TimeSpeedL: TComboBox Left = 50 - Top = 232 + Top = 278 Width = 49 Height = 21 DropDownCount = 20 @@ -354,7 +354,7 @@ object InputStrDialog: TInputStrDialog end object NmeaPos1: TEdit Left = 130 - Top = 102 + Top = 126 Width = 84 Height = 21 TabOrder = 21 @@ -362,7 +362,7 @@ object InputStrDialog: TInputStrDialog end object NmeaPos2: TEdit Left = 216 - Top = 102 + Top = 126 Width = 84 Height = 21 TabOrder = 22 @@ -370,7 +370,7 @@ object InputStrDialog: TInputStrDialog end object BtnPos: TButton Left = 373 - Top = 101 + Top = 125 Width = 25 Height = 22 Caption = '...' @@ -385,14 +385,14 @@ object InputStrDialog: TInputStrDialog end object FilePath3: TEdit Left = 6 - Top = 205 + Top = 229 Width = 366 Height = 21 TabOrder = 31 end object BtnFile3: TButton Left = 373 - Top = 204 + Top = 228 Width = 25 Height = 22 Caption = '...' @@ -410,9 +410,9 @@ object InputStrDialog: TInputStrDialog Top = 68 Width = 121 Height = 17 - Caption = '(3) Correction' + Caption = '(3) Correction 1' TabOrder = 14 - OnClick = StreamC2Click + OnClick = StreamC3Click end object Stream3: TComboBox Left = 120 @@ -472,6 +472,95 @@ object InputStrDialog: TInputStrDialog TabOrder = 17 OnClick = BtnCmd3Click end + object FilePath4: TEdit + Left = 6 + Top = 251 + Width = 366 + Height = 21 + TabOrder = 31 + end + object BtnFile4: TButton + Left = 373 + Top = 250 + Width = 25 + Height = 22 + Caption = '...' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -9 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + TabOrder = 32 + OnClick = BtnFile4Click + end + object StreamC4: TCheckBox + Left = 8 + Top = 92 + Width = 121 + Height = 17 + Caption = '(4) Correction 2' + TabOrder = 14 + OnClick = StreamC4Click + end + object Stream4: TComboBox + Left = 120 + Top = 90 + Width = 103 + Height = 21 + Style = csDropDownList + ItemIndex = 0 + TabOrder = 15 + Text = 'Serial' + OnChange = Stream4Change + Items.Strings = ( + 'Serial' + 'TCP Client' + 'TCP Server' + 'NTRIP Client' + 'File' + 'FTP' + 'HTTP') + end + object BtnStr4: TButton + Left = 224 + Top = 89 + Width = 25 + Height = 22 + Caption = '...' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -9 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + TabOrder = 16 + OnClick = BtnStr4Click + end + object Format4: TComboBox + Left = 275 + Top = 90 + Width = 97 + Height = 21 + Style = csDropDownList + DropDownCount = 16 + TabOrder = 18 + end + object BtnCmd4: TButton + Left = 249 + Top = 89 + Width = 25 + Height = 22 + Caption = '...' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -9 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + TabOrder = 17 + OnClick = BtnCmd4Click + end object BtnRcvOpt1: TButton Left = 373 Top = 17 @@ -517,9 +606,24 @@ object InputStrDialog: TInputStrDialog TabOrder = 19 OnClick = BtnRcvOpt3Click end + object BtnRcvOpt4: TButton + Left = 373 + Top = 89 + Width = 25 + Height = 22 + Caption = '...' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -9 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + TabOrder = 19 + OnClick = BtnRcvOpt4Click + end object NmeaPos3: TEdit Left = 302 - Top = 102 + Top = 126 Width = 70 Height = 21 TabOrder = 33 @@ -527,14 +631,14 @@ object InputStrDialog: TInputStrDialog end object EditResetCmd: TEdit Left = 63 - Top = 125 + Top = 149 Width = 204 Height = 21 TabOrder = 34 end object EditMaxBL: TEdit Left = 338 - Top = 125 + Top = 149 Width = 34 Height = 21 TabOrder = 35 @@ -542,7 +646,7 @@ object InputStrDialog: TInputStrDialog end object Chk64Bit: TCheckBox Left = 166 - Top = 234 + Top = 280 Width = 40 Height = 17 Caption = '64bit' @@ -555,6 +659,6 @@ object InputStrDialog: TInputStrDialog Options = [ofHideReadOnly, ofNoChangeDir, ofEnableSizing] Title = 'Input File Path' Left = 323 - Top = 147 + Top = 171 end end diff --git a/app/winapp/rtknavi/instrdlg.h b/app/winapp/rtknavi/instrdlg.h index 1edfc91ef..964b77b7b 100644 --- a/app/winapp/rtknavi/instrdlg.h +++ b/app/winapp/rtknavi/instrdlg.h @@ -52,9 +52,17 @@ class TInputStrDialog : public TForm TButton *BtnStr3; TComboBox *Format3; TButton *BtnCmd3; + TEdit *FilePath4; + TButton *BtnFile4; + TCheckBox *StreamC4; + TComboBox *Stream4; + TButton *BtnStr4; + TComboBox *Format4; + TButton *BtnCmd4; TButton *BtnRcvOpt1; TButton *BtnRcvOpt2; TButton *BtnRcvOpt3; + TButton *BtnRcvOpt4; TLabel *Label1; TEdit *NmeaPos3; TEdit *EditResetCmd; @@ -79,13 +87,20 @@ class TInputStrDialog : public TForm void __fastcall BtnPosClick(TObject *Sender); void __fastcall StreamC1Click(TObject *Sender); void __fastcall StreamC2Click(TObject *Sender); + void __fastcall StreamC3Click(TObject *Sender); + void __fastcall StreamC4Click(TObject *Sender); void __fastcall Stream3Change(TObject *Sender); void __fastcall BtnStr3Click(TObject *Sender); void __fastcall BtnFile3Click(TObject *Sender); void __fastcall BtnCmd3Click(TObject *Sender); + void __fastcall Stream4Change(TObject *Sender); + void __fastcall BtnStr4Click(TObject *Sender); + void __fastcall BtnFile4Click(TObject *Sender); + void __fastcall BtnCmd4Click(TObject *Sender); void __fastcall BtnRcvOpt1Click(TObject *Sender); void __fastcall BtnRcvOpt2Click(TObject *Sender); void __fastcall BtnRcvOpt3Click(TObject *Sender); + void __fastcall BtnRcvOpt4Click(TObject *Sender); private: AnsiString __fastcall GetFilePath(AnsiString path); AnsiString __fastcall SetFilePath(AnsiString path); @@ -94,11 +109,11 @@ class TInputStrDialog : public TForm void __fastcall FtpOpt(int index, int opt); void __fastcall UpdateEnable(void); public: - int StreamC[3],Stream[3],Format[3],CmdEna[3][3],CmdEnaTcp[3][3]; + int StreamC[RTKSVRNIN],Stream[RTKSVRNIN],Format[RTKSVRNIN],CmdEna[RTKSVRNIN][3],CmdEnaTcp[RTKSVRNIN][3]; int NmeaReq,TimeTag,Time64Bit,NRcv; double NmeaPos[3],MaxBL; - AnsiString Paths[3][4],Cmds[3][3],CmdsTcp[3][3],TimeStart,TimeSpeed; - AnsiString RcvOpt[3],ResetCmd; + AnsiString Paths[RTKSVRNIN][4],Cmds[RTKSVRNIN][3],CmdsTcp[RTKSVRNIN][3],TimeStart,TimeSpeed; + AnsiString RcvOpt[RTKSVRNIN],ResetCmd; AnsiString History[10]; __fastcall TInputStrDialog(TComponent* Owner); }; diff --git a/app/winapp/rtknavi/logstrdlg.cpp b/app/winapp/rtknavi/logstrdlg.cpp index b7d86ccb7..55c294457 100644 --- a/app/winapp/rtknavi/logstrdlg.cpp +++ b/app/winapp/rtknavi/logstrdlg.cpp @@ -24,12 +24,15 @@ void __fastcall TLogStrDialog::FormShow(TObject *Sender) Stream1C ->Checked =StreamC[0]; Stream2C ->Checked =StreamC[1]; Stream3C ->Checked =StreamC[2]; + Stream4C ->Checked =StreamC[3]; Stream1 ->ItemIndex=Stream[0]; Stream2 ->ItemIndex=Stream[1]; Stream3 ->ItemIndex=Stream[2]; + Stream4 ->ItemIndex=Stream[3]; FilePath1->Text =GetFilePath(Paths[0][2]); FilePath2->Text =GetFilePath(Paths[1][2]); FilePath3->Text =GetFilePath(Paths[2][2]); + FilePath4->Text =GetFilePath(Paths[3][2]); SwapIntv ->Text =SwapInterval; TimeTagC ->Checked =LogTimeTag; UpdateEnable(); @@ -40,12 +43,15 @@ void __fastcall TLogStrDialog::BtnOkClick(TObject *Sender) StreamC [0]=Stream1C->Checked; StreamC [1]=Stream2C->Checked; StreamC [2]=Stream3C->Checked; + StreamC [3]=Stream4C->Checked; Stream [0]=Stream1 ->ItemIndex; Stream [1]=Stream2 ->ItemIndex; Stream [2]=Stream3 ->ItemIndex; + Stream [3]=Stream4 ->ItemIndex; Paths[0][2]=SetFilePath(FilePath1->Text); Paths[1][2]=SetFilePath(FilePath2->Text); Paths[2][2]=SetFilePath(FilePath3->Text); + Paths[3][2]=SetFilePath(FilePath4->Text); SwapInterval=SwapIntv->Text; LogTimeTag =TimeTagC->Checked; } @@ -71,6 +77,13 @@ void __fastcall TLogStrDialog::BtnFile3Click(TObject *Sender) FilePath3->Text=SaveDialog->FileName; } //--------------------------------------------------------------------------- +void __fastcall TLogStrDialog::BtnFile4Click(TObject *Sender) +{ + SaveDialog->FileName=FilePath4->Text; + if (!SaveDialog->Execute()) return; + FilePath4->Text=SaveDialog->FileName; +} +//--------------------------------------------------------------------------- void __fastcall TLogStrDialog::Stream1Change(TObject *Sender) { UpdateEnable(); @@ -81,7 +94,12 @@ void __fastcall TLogStrDialog::Stream2Change(TObject *Sender) UpdateEnable(); } //--------------------------------------------------------------------------- -void __fastcall TLogStrDialog::Stream3CClick(TObject *Sender) +void __fastcall TLogStrDialog::Stream3Change(TObject *Sender) +{ + UpdateEnable(); +} +//--------------------------------------------------------------------------- +void __fastcall TLogStrDialog::Stream4Change(TObject *Sender) { UpdateEnable(); } @@ -96,7 +114,12 @@ void __fastcall TLogStrDialog::Stream2CClick(TObject *Sender) UpdateEnable(); } //--------------------------------------------------------------------------- -void __fastcall TLogStrDialog::Stream3Change(TObject *Sender) +void __fastcall TLogStrDialog::Stream3CClick(TObject *Sender) +{ + UpdateEnable(); +} +//--------------------------------------------------------------------------- +void __fastcall TLogStrDialog::Stream4CClick(TObject *Sender) { UpdateEnable(); } @@ -139,6 +162,17 @@ void __fastcall TLogStrDialog::BtnStr3Click(TObject *Sender) } } //--------------------------------------------------------------------------- +void __fastcall TLogStrDialog::BtnStr4Click(TObject *Sender) +{ + switch (Stream3->ItemIndex) { + case 0: SerialOpt(3,0); break; + case 1: TcpOpt(3,1); break; + case 2: TcpOpt(3,0); break; + case 3: TcpOpt(3,2); break; + case 4: TcpOpt(3,4); break; + } +} +//--------------------------------------------------------------------------- AnsiString __fastcall TLogStrDialog::GetFilePath(AnsiString path) { char *p,*q,buff[1024]; @@ -185,19 +219,24 @@ void __fastcall TLogStrDialog::UpdateEnable(void) { int ena=(Stream1C->Checked&&Stream1->ItemIndex==5)|| (Stream2C->Checked&&Stream2->ItemIndex==5)|| - (Stream3C->Checked&&Stream3->ItemIndex==5); + (Stream3C->Checked&&Stream3->ItemIndex==5)|| + (Stream4C->Checked&&Stream4->ItemIndex==5); Stream1 ->Enabled=Stream1C->Checked; Stream2 ->Enabled=Stream2C->Checked; Stream3 ->Enabled=Stream3C->Checked; + Stream4 ->Enabled=Stream4C->Checked; BtnStr1 ->Enabled=Stream1C->Checked&&Stream1->ItemIndex<=4; BtnStr2 ->Enabled=Stream2C->Checked&&Stream2->ItemIndex<=4; BtnStr3 ->Enabled=Stream3C->Checked&&Stream3->ItemIndex<=4; + BtnStr4 ->Enabled=Stream4C->Checked&&Stream4->ItemIndex<=4; FilePath1->Enabled=Stream1C->Checked&&Stream1->ItemIndex==5; FilePath2->Enabled=Stream2C->Checked&&Stream2->ItemIndex==5; FilePath3->Enabled=Stream3C->Checked&&Stream3->ItemIndex==5; + FilePath4->Enabled=Stream4C->Checked&&Stream4->ItemIndex==5; BtnFile1 ->Enabled=Stream1C->Checked&&Stream1->ItemIndex==5; BtnFile2 ->Enabled=Stream2C->Checked&&Stream2->ItemIndex==5; BtnFile3 ->Enabled=Stream3C->Checked&&Stream3->ItemIndex==5; + BtnFile4 ->Enabled=Stream4C->Checked&&Stream4->ItemIndex==5; Label1 ->Enabled=ena; Label2 ->Enabled=ena; LabelF1 ->Enabled=ena; diff --git a/app/winapp/rtknavi/logstrdlg.dfm b/app/winapp/rtknavi/logstrdlg.dfm index 75c843014..3334d266f 100644 --- a/app/winapp/rtknavi/logstrdlg.dfm +++ b/app/winapp/rtknavi/logstrdlg.dfm @@ -4,7 +4,7 @@ object LogStrDialog: TLogStrDialog BorderIcons = [biSystemMenu] BorderStyle = bsDialog Caption = 'Log Streams' - ClientHeight = 198 + ClientHeight = 244 ClientWidth = 394 Color = clWhite Font.Charset = DEFAULT_CHARSET @@ -40,14 +40,14 @@ object LogStrDialog: TLogStrDialog end object LabelF1: TLabel Left = 12 - Top = 84 + Top = 107 Width = 66 Height = 13 Caption = 'Log File Paths' end object BtnKey: TSpeedButton Left = 188 - Top = 168 + Top = 214 Width = 21 Height = 23 Caption = '?' @@ -56,21 +56,21 @@ object LogStrDialog: TLogStrDialog end object Label1: TLabel Left = 76 - Top = 173 + Top = 219 Width = 49 Height = 13 Caption = 'Swap Intv' end object Label2: TLabel Left = 175 - Top = 173 + Top = 219 Width = 7 Height = 13 Caption = 'H' end object BtnCancel: TButton Left = 303 - Top = 167 + Top = 213 Width = 85 Height = 27 Caption = '&Cancel' @@ -79,7 +79,7 @@ object LogStrDialog: TLogStrDialog end object BtnOk: TButton Left = 215 - Top = 167 + Top = 213 Width = 85 Height = 27 Caption = '&OK' @@ -155,21 +155,21 @@ object LogStrDialog: TLogStrDialog end object FilePath1: TEdit Left = 8 - Top = 98 + Top = 121 Width = 355 Height = 21 TabOrder = 8 end object FilePath2: TEdit Left = 8 - Top = 120 + Top = 143 Width = 355 Height = 21 TabOrder = 10 end object BtnFile1: TButton Left = 363 - Top = 97 + Top = 120 Width = 25 Height = 22 Caption = '...' @@ -184,7 +184,7 @@ object LogStrDialog: TLogStrDialog end object BtnFile2: TButton Left = 363 - Top = 119 + Top = 142 Width = 25 Height = 22 Caption = '...' @@ -199,7 +199,7 @@ object LogStrDialog: TLogStrDialog end object TimeTagC: TCheckBox Left = 10 - Top = 170 + Top = 216 Width = 63 Height = 17 Caption = 'Time-Tag' @@ -210,7 +210,7 @@ object LogStrDialog: TLogStrDialog Top = 19 Width = 117 Height = 17 - Caption = '(6) Rover' + Caption = '(5) Rover' TabOrder = 2 OnClick = Stream1CClick end @@ -219,7 +219,7 @@ object LogStrDialog: TLogStrDialog Top = 42 Width = 117 Height = 17 - Caption = '(7) Base Station' + Caption = '(6) Base Station' TabOrder = 5 OnClick = Stream2CClick end @@ -228,7 +228,7 @@ object LogStrDialog: TLogStrDialog Top = 65 Width = 117 Height = 17 - Caption = '(8) Correction' + Caption = '(7) Correction' TabOrder = 13 OnClick = Stream3CClick end @@ -267,14 +267,14 @@ object LogStrDialog: TLogStrDialog end object FilePath3: TEdit Left = 8 - Top = 142 + Top = 165 Width = 355 Height = 21 TabOrder = 16 end object BtnFile3: TButton Left = 363 - Top = 141 + Top = 164 Width = 25 Height = 22 Caption = '...' @@ -287,9 +287,73 @@ object LogStrDialog: TLogStrDialog TabOrder = 17 OnClick = BtnFile3Click end + object Stream4C: TCheckBox + Left = 8 + Top = 87 + Width = 117 + Height = 17 + Caption = '(8) Correction' + TabOrder = 13 + OnClick = Stream4CClick + end + object Stream4: TComboBox + Left = 133 + Top = 86 + Width = 103 + Height = 21 + Style = csDropDownList + ItemIndex = 0 + TabOrder = 14 + Text = 'Serial' + OnChange = Stream4Change + Items.Strings = ( + 'Serial' + 'TCP Client' + 'TCP Server' + 'NTRIP Server' + 'NTRIP Caster' + 'File') + end + object BtnStr4: TButton + Left = 237 + Top = 85 + Width = 25 + Height = 22 + Caption = '...' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -9 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + TabOrder = 15 + OnClick = BtnStr4Click + end + object FilePath4: TEdit + Left = 8 + Top = 187 + Width = 355 + Height = 21 + TabOrder = 16 + end + object BtnFile4: TButton + Left = 363 + Top = 186 + Width = 25 + Height = 22 + Caption = '...' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -9 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + TabOrder = 17 + OnClick = BtnFile4Click + end object SwapIntv: TComboBox Left = 128 - Top = 170 + Top = 216 Width = 45 Height = 21 TabOrder = 18 diff --git a/app/winapp/rtknavi/logstrdlg.h b/app/winapp/rtknavi/logstrdlg.h index f37d9a38a..741ce9f8b 100644 --- a/app/winapp/rtknavi/logstrdlg.h +++ b/app/winapp/rtknavi/logstrdlg.h @@ -36,6 +36,11 @@ class TLogStrDialog : public TForm TButton *BtnStr3; TEdit *FilePath3; TButton *BtnFile3; + TCheckBox *Stream4C; + TComboBox *Stream4; + TButton *BtnStr4; + TEdit *FilePath4; + TButton *BtnFile4; TComboBox *SwapIntv; TLabel *Label1; TLabel *Label2; @@ -55,6 +60,10 @@ class TLogStrDialog : public TForm void __fastcall BtnFile3Click(TObject *Sender); void __fastcall Stream3CClick(TObject *Sender); void __fastcall Stream3Change(TObject *Sender); + void __fastcall BtnStr4Click(TObject *Sender); + void __fastcall BtnFile4Click(TObject *Sender); + void __fastcall Stream4CClick(TObject *Sender); + void __fastcall Stream4Change(TObject *Sender); private: AnsiString __fastcall GetFilePath(AnsiString path); AnsiString __fastcall SetFilePath(AnsiString path); @@ -62,8 +71,8 @@ class TLogStrDialog : public TForm void __fastcall TcpOpt(int index, int opt); void __fastcall UpdateEnable(void); public: - int StreamC[3],Stream[3],LogTimeTag,LogAppend; - AnsiString Paths[3][4],SwapInterval; + int StreamC[RTKSVRNIN],Stream[RTKSVRNIN],LogTimeTag,LogAppend; + AnsiString Paths[RTKSVRNIN][4],SwapInterval; AnsiString History[10]; __fastcall TLogStrDialog(TComponent* Owner); }; diff --git a/app/winapp/rtknavi/mondlg.cpp b/app/winapp/rtknavi/mondlg.cpp index 4f8626e06..b1ee3cfdd 100644 --- a/app/winapp/rtknavi/mondlg.cpp +++ b/app/winapp/rtknavi/mondlg.cpp @@ -69,16 +69,16 @@ void __fastcall TMonitorDialog::BtnCloseClick(TObject *Sender) //--------------------------------------------------------------------------- void __fastcall TMonitorDialog::TypeChange(TObject *Sender) { - int index; - TypeF=Type->ItemIndex; - index=TypeF-NMONITEM; - if (0<=index) { + if (TypeF >= 16) { + // Clear the peek buffers. rtksvrlock(&rtksvr); - if (index<2) rtksvr.npb[index ]=0; - else if (index<4) rtksvr.nsb[index-2]=0; - else rtksvr.rtk.neb=0; + if (TypeF == 16) { + for (int i = 0; i < RTKSVRNIN; i++) rtksvr.npb[i] = 0; + } else if (TypeF == 17) { + for (int i = 0; i < RTKSVRNSOL; i++) rtksvr.nsb[i] = 0; + } else rtksvr.rtk.neb = 0; rtksvrunlock(&rtksvr); } ClearTable(); @@ -369,7 +369,7 @@ void __fastcall TMonitorDialog::ShowRtk(void) double *del,*off,runtime,rt[3]={0},dop[4]={0}; double azel[MAXSAT*2],pos[3],vel[3],rr[3]={0},enu[3]={0}; int i,j,k,thread,cycle,state,rtkstat,nsat0,nsat1,prcout,nave; - int cputime,nb[3]={0},nmsg[3][10]={{0}},ne; + int cputime,nb[RTKSVRNIN]={0},nmsg[RTKSVRNIN][10]={{0}},ne; char tstr[40],*ant,id[8],s1[40]="-",s2[40]="-",s3[40]="-"; char file[1024]=""; const char *ionoopt[]={"OFF","Broadcast","SBAS","Dual-Frequency","Estimate STEC","IONEX TEC","QZSS LEX",""}; @@ -391,8 +391,8 @@ void __fastcall TMonitorDialog::ShowRtk(void) cputime=rtksvr.cputime; prcout =rtksvr.prcout; nave=rtksvr.nave; - for (i=0;i<3;i++) nb[i]=rtksvr.nb[i]; - for (i=0;i<3;i++) for (j=0;j<10;j++) { + for (i=0;iopt.navsys&SYS_SBS) navsys=navsys+"SBAS "; Label->Caption=""; - Tbl->RowCount=55+NFREQ*2; + Tbl->RowCount=56+NFREQ*2; i=1; Tbl->Cells[0][i ]="RTKLIB Version"; @@ -533,10 +533,14 @@ void __fastcall TMonitorDialog::ShowRtk(void) nmsg[1][0],nmsg[1][1]+nmsg[1][6],nmsg[1][2],nmsg[1][3], nmsg[1][4],nmsg[1][5],nmsg[1][7],nmsg[1][9]); - Tbl->Cells[0][i ]="# of Input Data Ephemeris"; + Tbl->Cells[0][i ]="# of Input Data Correction 1"; Tbl->Cells[1][i++]=s.sprintf("Obs(%d), Nav(%d), Ion(%d), Sbs(%d), Pos(%d), Dgps(%d), Ssr(%d), Err(%d)", nmsg[2][0],nmsg[2][1]+nmsg[2][6],nmsg[2][2],nmsg[2][3], nmsg[2][4],nmsg[2][5],nmsg[2][7],nmsg[2][9]); + Tbl->Cells[0][i ]="# of Input Data Correction 2"; + Tbl->Cells[1][i++]=s.sprintf("Obs(%d), Nav(%d), Ion(%d), Sbs(%d), Pos(%d), Dgps(%d), Ssr(%d), Err(%d)", + nmsg[3][0],nmsg[3][1]+nmsg[3][6],nmsg[3][2],nmsg[3][3], + nmsg[3][4],nmsg[3][5],nmsg[3][7],nmsg[3][9]); Tbl->Cells[0][i ]="Solution Status"; Tbl->Cells[1][i++]=sol[rtkstat]; @@ -1481,7 +1485,7 @@ void __fastcall TMonitorDialog::SetStr(void) "STR","Stream","Type","Format","Mode","State","Input(bytes)","Input(bps)", "Output(bytes)","Output(bps)","Path","Message" }; - int i,width[]={25,95,70,80,35,35,70,70,70,70,220,220}; + int i,width[]={30,95,70,80,35,35,70,70,70,70,220,220}; Tbl->ColCount=12; Tbl->RowCount=2; @@ -1494,9 +1498,10 @@ void __fastcall TMonitorDialog::SetStr(void) //--------------------------------------------------------------------------- void __fastcall TMonitorDialog::ShowStr(void) { - AnsiString ch[]={ - "Input Rover","Input Base","Input Correction","Output Solution 1", - "Output Solution 2","Log Rover","Log Base","Log Correction", + AnsiString ch[MAXSTRRTK + 1]={ + "Input Rover","Input Base","Input Correction 1","Input Correction 2", + "Log Rover","Log Base","Log Correction 1","Log Correction 2", + "Output Solution 1","Output Solution 2","Output Solution 3", "Monitor" }; AnsiString type[]={ @@ -1510,28 +1515,28 @@ void __fastcall TMonitorDialog::ShowStr(void) }; AnsiString state[]={"Error","-","OK"}; AnsiString s,mode,form; - stream_t stream[9]; - int i,j,format[9]={0}; + stream_t stream[MAXSTRRTK + 1]; + int i,j,format[MAXSTRRTK + 1]={0}; char path[MAXSTRPATH]="",*p,*q,*pp; rtksvrlock(&rtksvr); // lock - for (i=0;i<8;i++) stream[i]=rtksvr.stream[i]; - for (i=0;i<3;i++) format[i]=rtksvr.format[i]; - for (i=3;i<5;i++) format[i]=rtksvr.solopt[i-3].posf; - stream[8]=monistr; - format[8]=SOLF_LLH; + for (i=0;iRowCount=10; + Tbl->RowCount=1 + MAXSTRRTK + 1; Label->Caption=""; - for (i=0;i<9;i++) { + for (i=0;iCells[j++][i+1]=s.sprintf("(%d)",i+1); Tbl->Cells[j++][i+1]=ch[i]; Tbl->Cells[j++][i+1]=type[stream[i].type]; if (!stream[i].type) form="-"; - else if (i<3) form=formatstrs[format[i]]; - else if (i<5||i==8) form=outformat[format[i]]; + else if (i= RTKSVRNIN*2) form=outformat[format[i]]; else form="-"; Tbl->Cells[j++][i+1]=form; if (stream[i].mode&STR_MODE_R) mode="R"; else mode=""; diff --git a/app/winapp/rtknavi/mondlg.dfm b/app/winapp/rtknavi/mondlg.dfm index 094643201..e10aaa96e 100644 --- a/app/winapp/rtknavi/mondlg.dfm +++ b/app/winapp/rtknavi/mondlg.dfm @@ -177,7 +177,8 @@ object MonitorDialog: TMonitorDialog Items.Strings = ( '(1) Rover' '(2) Base Station' - '(3) Correction') + '(3) Correction 1' + '(4) Correction 2') end object SelSat: TComboBox AlignWithMargins = True @@ -307,11 +308,12 @@ object MonitorDialog: TMonitorDialog Style = csDropDownList ItemIndex = 0 TabOrder = 8 - Text = '(4) Solution 1' + Text = '(9) Solution 1' OnChange = SelStr2Change Items.Strings = ( - '(4) Solution 1' - '(5) Solution 2') + '(9) Solution 1' + '(10) Solution 2' + '(11) Solution 3') end object BtnCopy: TButton AlignWithMargins = True diff --git a/app/winapp/rtknavi/navimain.cpp b/app/winapp/rtknavi/navimain.cpp index 0612ced10..96ace58cd 100644 --- a/app/winapp/rtknavi/navimain.cpp +++ b/app/winapp/rtknavi/navimain.cpp @@ -120,10 +120,13 @@ __fastcall TMainForm::TMainForm(TComponent* Owner) { SvrCycle=SvrBuffSize=0; SolBuffSize=1000; - for (int i=0;i<8;i++) { - StreamC[i]=Stream[i]=Format[i]=CmdEna[i][0]=CmdEna[i][1]=CmdEna[i][2]=0; + for (int i=0;i= RTKSVRNIN*2) Format[i] = i == RTKSVRNIN*2 ? SOLF_LLH : SOLF_NMEA; + else Format[i] = 0; } - for (int i=0;i<3;i++) { + for (int i=0;iStreamC[i]=StreamC[i]; InputStrDialog->Stream [i]=Stream [i]; InputStrDialog->Format [i]=Format [i]; @@ -632,7 +635,7 @@ void __fastcall TMainForm::BtnInputStrClick(TObject *Sender) /* Paths[0]:serial,[1]:tcp,[2]:file,[3]:ftp */ for (j=0;j<4;j++) InputStrDialog->Paths[i][j]=Paths[i][j]; } - for (i=0;i<3;i++) for (j=0;j<3;j++) { + for (i=0;iCmdEna [i][j]=CmdEna [i][j]; InputStrDialog->Cmds [i][j]=Cmds [i][j]; InputStrDialog->CmdEnaTcp[i][j]=CmdEnaTcp[i][j]; @@ -654,14 +657,14 @@ void __fastcall TMainForm::BtnInputStrClick(TObject *Sender) if (InputStrDialog->ShowModal()!=mrOk) return; - for (i=0;i<3;i++) { + for (i=0;iStreamC[i]; Stream [i]=InputStrDialog->Stream[i]; Format [i]=InputStrDialog->Format[i]; RcvOpt [i]=InputStrDialog->RcvOpt[i]; for (j=0;j<4;j++) Paths[i][j]=InputStrDialog->Paths[i][j]; } - for (i=0;i<3;i++) for (j=0;j<3;j++) { + for (i=0;iCmdEna [i][j]; Cmds [i][j]=InputStrDialog->Cmds [i][j]; CmdEnaTcp[i][j]=InputStrDialog->CmdEnaTcp[i][j]; @@ -702,7 +705,7 @@ int __fastcall TMainForm::ConfOverwrite(const char *path) fclose(fp); // check overwrite input files - for (i=0;i<3;i++) { + for (i=0;iStreamC[i-3]=StreamC[i]; - OutputStrDialog->Stream [i-3]=Stream[i]; - OutputStrDialog->Format [i-3]=Format[i]; - for (j=0;j<4;j++) OutputStrDialog->Paths[i-3][j]=Paths[i][j]; + for (i=RTKSVRNIN*2;iStreamC[i-RTKSVRNIN*2]=StreamC[i]; + OutputStrDialog->Stream [i-RTKSVRNIN*2]=Stream[i]; + OutputStrDialog->Format [i-RTKSVRNIN*2]=Format[i]; + for (j=0;j<4;j++) OutputStrDialog->Paths[i-RTKSVRNIN*2][j]=Paths[i][j]; } for (i=0;i<10;i++) { OutputStrDialog->History [i]=History [i]; @@ -744,18 +747,18 @@ void __fastcall TMainForm::BtnOutputStrClick(TObject *Sender) if (OutputStrDialog->ShowModal()!=mrOk) return; - for (i=3;i<5;i++) { - if (StreamC[i]!=OutputStrDialog->StreamC[i-3]|| - Stream [i]!=OutputStrDialog->Stream[i-3]|| - Format [i]!=OutputStrDialog->Format[i-3]|| - Paths[i][0]!=OutputStrDialog->Paths[i-3][0]|| - Paths[i][1]!=OutputStrDialog->Paths[i-3][1]|| - Paths[i][2]!=OutputStrDialog->Paths[i-3][2]|| - Paths[i][3]!=OutputStrDialog->Paths[i-3][3]) update[i-3]=1; - StreamC[i]=OutputStrDialog->StreamC[i-3]; - Stream [i]=OutputStrDialog->Stream[i-3]; - Format [i]=OutputStrDialog->Format[i-3]; - for (j=0;j<4;j++) Paths[i][j]=OutputStrDialog->Paths[i-3][j]; + for (i=RTKSVRNIN*2;iStreamC[i-RTKSVRNIN*2]|| + Stream [i]!=OutputStrDialog->Stream[i-RTKSVRNIN*2]|| + Format [i]!=OutputStrDialog->Format[i-RTKSVRNIN*2]|| + Paths[i][0]!=OutputStrDialog->Paths[i-RTKSVRNIN*2][0]|| + Paths[i][1]!=OutputStrDialog->Paths[i-RTKSVRNIN*2][1]|| + Paths[i][2]!=OutputStrDialog->Paths[i-RTKSVRNIN*2][2]|| + Paths[i][3]!=OutputStrDialog->Paths[i-RTKSVRNIN*2][3]) update[i-RTKSVRNIN*2]=1; + StreamC[i]=OutputStrDialog->StreamC[i-RTKSVRNIN*2]; + Stream [i]=OutputStrDialog->Stream[i-RTKSVRNIN*2]; + Format [i]=OutputStrDialog->Format[i-RTKSVRNIN*2]; + for (j=0;j<4;j++) Paths[i][j]=OutputStrDialog->Paths[i-RTKSVRNIN*2][j]; } for (i=0;i<10;i++) { History [i]=OutputStrDialog->History [i]; @@ -766,8 +769,8 @@ void __fastcall TMainForm::BtnOutputStrClick(TObject *Sender) if (BtnStart->Enabled) return; - for (i=3;i<5;i++) { - if (!update[i-3]) continue; + for (i=RTKSVRNIN*2;iStreamC[i-5]=StreamC[i]; - LogStrDialog->Stream [i-5]=Stream [i]; - for (j=0;j<4;j++) LogStrDialog->Paths[i-5][j]=Paths[i][j]; + for (i=RTKSVRNIN;iStreamC[i-RTKSVRNIN]=StreamC[i]; + LogStrDialog->Stream [i-RTKSVRNIN]=Stream [i]; + for (j=0;j<4;j++) LogStrDialog->Paths[i-RTKSVRNIN][j]=Paths[i][j]; } for (i=0;i<10;i++) { LogStrDialog->History [i]=History [i]; @@ -811,16 +814,16 @@ void __fastcall TMainForm::BtnLogStrClick(TObject *Sender) if (LogStrDialog->ShowModal()!=mrOk) return; - for (i=5;i<8;i++) { - if (StreamC[i]!=OutputStrDialog->StreamC[i-5]|| - Stream [i]!=OutputStrDialog->Stream[i-5]|| - Paths[i][0]!=OutputStrDialog->Paths[i-3][0]|| - Paths[i][1]!=OutputStrDialog->Paths[i-3][1]|| - Paths[i][2]!=OutputStrDialog->Paths[i-3][2]|| - Paths[i][3]!=OutputStrDialog->Paths[i-3][3]) update[i-5]=1; - StreamC[i]=LogStrDialog->StreamC[i-5]; - Stream [i]=LogStrDialog->Stream [i-5]; - for (j=0;j<4;j++) Paths[i][j]=LogStrDialog->Paths[i-5][j]; + for (i=RTKSVRNIN;iStreamC[i-RTKSVRNIN]|| + Stream [i]!=LogStrDialog->Stream[i-RTKSVRNIN]|| + Paths[i][0]!=LogStrDialog->Paths[i-RTKSVRNIN][0]|| + Paths[i][1]!=LogStrDialog->Paths[i-RTKSVRNIN][1]|| + Paths[i][2]!=LogStrDialog->Paths[i-RTKSVRNIN][2]|| + Paths[i][3]!=LogStrDialog->Paths[i-RTKSVRNIN][3]) update[i-RTKSVRNIN]=1; + StreamC[i]=LogStrDialog->StreamC[i-RTKSVRNIN]; + Stream [i]=LogStrDialog->Stream [i-RTKSVRNIN]; + for (j=0;j<4;j++) Paths[i][j]=LogStrDialog->Paths[i-RTKSVRNIN][j]; } for (i=0;i<10;i++) { History [i]=LogStrDialog->History [i]; @@ -831,8 +834,8 @@ void __fastcall TMainForm::BtnLogStrClick(TObject *Sender) if (BtnStart->Enabled) return; - for (i=5;i<8;i++) { - if (!update[i-5]) continue; + for (i=RTKSVRNIN;i0) traceclose(); free_pcvs(&rtksvr.pcvsr); @@ -1311,9 +1314,10 @@ void __fastcall TMainForm::SvrStart(void) if (DCBFileF!="") { readdcb(DCBFileF.c_str(),&rtksvr.nav,NULL); } - for (i=0;i<2;i++) { + + for (i=0;iReadInteger("stream",s.sprintf("streamc%d",no),0); Stream [i]=ini->ReadInteger("stream",s.sprintf("stream%d", no),0); @@ -2475,17 +2479,17 @@ void __fastcall TMainForm::LoadOpt(void) Paths[i][j]=ini->ReadString("stream",s.sprintf("path_%d_%d",no,j),""); } } - for (i=0;i<3;i++) { + for (i=0;iReadString("stream",s.sprintf("rcvopt%d",i+1),""); } - for (i=0;i<3;i++) for (j=0;j<3;j++) { + for (i=0;iReadString("serial",s.sprintf("cmd_%d_%d",i,j),""); CmdEna[i][j]=ini->ReadInteger("serial",s.sprintf("cmdena_%d_%d",i,j),0); for (p=Cmds[i][j].c_str();*p;p++) { if ((p=strstr(p,"@@"))) strncpy(p,"\r\n",2); else break; } } - for (i=0;i<3;i++) for (j=0;j<3;j++) { + for (i=0;iReadString("tcpip",s.sprintf("cmd_%d_%d",i,j),""); CmdEnaTcp[i][j]=ini->ReadInteger("tcpip",s.sprintf("cmdena_%d_%d",i,j),0); for (p=CmdsTcp[i][j].c_str();*p;p++) { @@ -2732,12 +2736,12 @@ void __fastcall TMainForm::SaveOpt(void) { TIniFile *ini=new TIniFile(IniFile); AnsiString s; - int i,j,no,strno[]={0,1,6,2,3,4,5,7}; + int i,j,no, strno[MAXSTRRTK] = { 0, 1, 6, 9, 4, 5, 7, 10, 2, 3, 8 }; char *p; trace(3,"SaveOpt\n"); - for (i=0;i<8;i++) { + for (i=0;iWriteInteger("stream",s.sprintf("streamc%d",no),StreamC[i]); ini->WriteInteger("stream",s.sprintf("stream%d" ,no),Stream [i]); @@ -2746,17 +2750,17 @@ void __fastcall TMainForm::SaveOpt(void) ini->WriteString("stream",s.sprintf("path_%d_%d",no,j),Paths[i][j]); } } - for (i=0;i<3;i++) { + for (i=0;iWriteString("stream",s.sprintf("rcvopt%d",i+1),RcvOpt[i]); } - for (i=0;i<3;i++) for (j=0;j<3;j++) { + for (i=0;iWriteString ("serial",s.sprintf("cmd_%d_%d" ,i,j),Cmds [i][j]); ini->WriteInteger("serial",s.sprintf("cmdena_%d_%d",i,j),CmdEna[i][j]); } - for (i=0;i<3;i++) for (j=0;j<3;j++) { + for (i=0;iStreamC[i]=strtype[i]!=STR_NONE; MainForm->Stream[i]=STR_NONE; - for (int j=0;j<(i<3?num_itype:num_otype);j++) { - if (strtype[i]!=(i<3?itype[j]:otype[j])) continue; + for (int j=0;j<(iStream[i]=j; break; } - if (i<5) MainForm->Format[i]=strfmt[i]; + if (i=RTKSVRNIN*2) MainForm->Format[i]=strfmt[i]; if (strtype[i]==STR_SERIAL) { MainForm->Paths[i][0]=strpath[i]; @@ -911,8 +919,8 @@ void __fastcall TOptDialog::SaveOpt(AnsiString file) solopt_t solopt=solopt_default; filopt_t filopt={""}; - for (int i=0;i<8;i++) { - strtype[i]=i<3?itype[MainForm->Stream[i]]:otype[MainForm->Stream[i]]; + for (int i=0;iStream[i]]:otype[MainForm->Stream[i]]; strfmt[i]=MainForm->Format[i]; if (!MainForm->StreamC[i]) { diff --git a/app/winapp/rtknavi/naviopt.h b/app/winapp/rtknavi/naviopt.h index 81b298347..0f650c77e 100644 --- a/app/winapp/rtknavi/naviopt.h +++ b/app/winapp/rtknavi/naviopt.h @@ -46,6 +46,7 @@ class TOptDialog : public TForm TLabel *LabelHold; TLabel *Label22; TLabel *Label14; + TLabel *Label58; TLabel *Label11; TLabel *Label37; TComboBox *AmbRes; diff --git a/app/winapp/rtknavi/outstrdlg.cpp b/app/winapp/rtknavi/outstrdlg.cpp index d986fcad5..86c7d571c 100644 --- a/app/winapp/rtknavi/outstrdlg.cpp +++ b/app/winapp/rtknavi/outstrdlg.cpp @@ -23,12 +23,16 @@ void __fastcall TOutputStrDialog::FormShow(TObject *Sender) { Stream1C ->Checked =StreamC[0]; Stream2C ->Checked =StreamC[1]; + Stream3C ->Checked =StreamC[2]; Stream1 ->ItemIndex=Stream[0]; Stream2 ->ItemIndex=Stream[1]; + Stream3 ->ItemIndex=Stream[2]; Format1 ->ItemIndex=Format[0]; Format2 ->ItemIndex=Format[1]; + Format3 ->ItemIndex=Format[2]; FilePath1->Text =GetFilePath(Paths[0][2]); FilePath2->Text =GetFilePath(Paths[1][2]); + FilePath3->Text =GetFilePath(Paths[2][2]); SwapIntv->Text =SwapInterval; TimeTagC ->Checked =OutTimeTag; UpdateEnable(); @@ -38,12 +42,16 @@ void __fastcall TOutputStrDialog::BtnOkClick(TObject *Sender) { StreamC[0] =Stream1C->Checked; StreamC[1] =Stream2C->Checked; + StreamC[2] =Stream3C->Checked; Stream[0] =Stream1->ItemIndex; Stream[1] =Stream2->ItemIndex; + Stream[2] =Stream3->ItemIndex; Format[0] =Format1->ItemIndex; Format[1] =Format2->ItemIndex; + Format[2] =Format3->ItemIndex; Paths [0][2]=SetFilePath(FilePath1->Text); Paths [1][2]=SetFilePath(FilePath2->Text); + Paths [2][2]=SetFilePath(FilePath3->Text); SwapInterval=SwapIntv->Text; OutTimeTag =TimeTagC->Checked; } @@ -62,6 +70,13 @@ void __fastcall TOutputStrDialog::BtnFile2Click(TObject *Sender) FilePath2->Text=SaveDialog->FileName; } //--------------------------------------------------------------------------- +void __fastcall TOutputStrDialog::BtnFile3Click(TObject *Sender) +{ + SaveDialog->FileName=FilePath3->Text; + if (!SaveDialog->Execute()) return; + FilePath3->Text=SaveDialog->FileName; +} +//--------------------------------------------------------------------------- void __fastcall TOutputStrDialog::Stream1Change(TObject *Sender) { UpdateEnable(); @@ -72,6 +87,11 @@ void __fastcall TOutputStrDialog::Stream2Change(TObject *Sender) UpdateEnable(); } //--------------------------------------------------------------------------- +void __fastcall TOutputStrDialog::Stream3Change(TObject *Sender) +{ + UpdateEnable(); +} +//--------------------------------------------------------------------------- void __fastcall TOutputStrDialog::Stream1CClick(TObject *Sender) { UpdateEnable(); @@ -82,6 +102,11 @@ void __fastcall TOutputStrDialog::Stream2CClick(TObject *Sender) UpdateEnable(); } //--------------------------------------------------------------------------- +void __fastcall TOutputStrDialog::Stream3CClick(TObject *Sender) +{ + UpdateEnable(); +} +//--------------------------------------------------------------------------- void __fastcall TOutputStrDialog::BtnKeyClick(TObject *Sender) { KeyDialog->ShowModal(); @@ -109,6 +134,17 @@ void __fastcall TOutputStrDialog::BtnStr2Click(TObject *Sender) } } //--------------------------------------------------------------------------- +void __fastcall TOutputStrDialog::BtnStr3Click(TObject *Sender) +{ + switch (Stream3->ItemIndex) { + case 0: SerialOpt(2,0); break; + case 1: TcpOpt(2,1); break; + case 2: TcpOpt(2,0); break; + case 3: TcpOpt(2,2); break; + case 4: TcpOpt(2,4); break; + } +} +//--------------------------------------------------------------------------- AnsiString __fastcall TOutputStrDialog::GetFilePath(AnsiString path) { char *p,*q,buff[1024]; @@ -157,12 +193,16 @@ void __fastcall TOutputStrDialog::UpdateEnable(void) (Stream2C->Checked&&Stream2->ItemIndex==5); Stream1 ->Enabled=Stream1C->Checked; Stream2 ->Enabled=Stream2C->Checked; + Stream3 ->Enabled=Stream3C->Checked; BtnStr1 ->Enabled=Stream1C->Checked&&Stream1->ItemIndex<=4; BtnStr2 ->Enabled=Stream2C->Checked&&Stream2->ItemIndex<=4; + BtnStr3 ->Enabled=Stream3C->Checked&&Stream3->ItemIndex<=4; FilePath1->Enabled=Stream1C->Checked&&Stream1->ItemIndex==5; FilePath2->Enabled=Stream2C->Checked&&Stream2->ItemIndex==5; + FilePath3->Enabled=Stream3C->Checked&&Stream3->ItemIndex==5; BtnFile1 ->Enabled=Stream1C->Checked&&Stream1->ItemIndex==5; BtnFile2 ->Enabled=Stream2C->Checked&&Stream2->ItemIndex==5; + BtnFile3 ->Enabled=Stream3C->Checked&&Stream3->ItemIndex==5; LabelF1 ->Enabled=ena; Label1 ->Enabled=ena; Label2 ->Enabled=ena; diff --git a/app/winapp/rtknavi/outstrdlg.dfm b/app/winapp/rtknavi/outstrdlg.dfm index 2f5d0f8ec..6010c2300 100644 --- a/app/winapp/rtknavi/outstrdlg.dfm +++ b/app/winapp/rtknavi/outstrdlg.dfm @@ -4,7 +4,7 @@ object OutputStrDialog: TOutputStrDialog BorderIcons = [biSystemMenu] BorderStyle = bsDialog Caption = 'Output Streams' - ClientHeight = 158 + ClientHeight = 202 ClientWidth = 393 Color = clWhite Font.Charset = DEFAULT_CHARSET @@ -17,6 +17,13 @@ object OutputStrDialog: TOutputStrDialog OnShow = FormShow PixelsPerInch = 96 TextHeight = 13 + object Label10: TLabel + Left = 44 + Top = 3 + Width = 71 + Height = 13 + Caption = 'Output Stream' + end object Label5: TLabel Left = 169 Top = 3 @@ -31,13 +38,6 @@ object OutputStrDialog: TOutputStrDialog Height = 13 Caption = 'Option' end - object Label10: TLabel - Left = 44 - Top = 3 - Width = 71 - Height = 13 - Caption = 'Output Stream' - end object Label7: TLabel Left = 308 Top = 5 @@ -45,54 +45,14 @@ object OutputStrDialog: TOutputStrDialog Height = 13 Caption = 'Format' end - object LabelF1: TLabel + object Stream1C: TCheckBox Left = 8 - Top = 65 - Width = 83 - Height = 13 - Caption = 'Output File Paths' - end - object BtnKey: TSpeedButton - Left = 190 - Top = 128 - Width = 21 - Height = 23 - Caption = '?' - Flat = True - OnClick = BtnKeyClick - end - object Label1: TLabel - Left = 78 - Top = 132 - Width = 49 - Height = 13 - Caption = 'Swap Intv' - end - object Label2: TLabel - Left = 178 - Top = 132 - Width = 7 - Height = 13 - Caption = 'H' - end - object BtnCancel: TButton - Left = 301 - Top = 127 - Width = 85 - Height = 27 - Caption = '&Cancel' - ModalResult = 2 - TabOrder = 0 - end - object BtnOk: TButton - Left = 213 - Top = 127 - Width = 85 - Height = 27 - Caption = '&OK' - ModalResult = 1 - TabOrder = 1 - OnClick = BtnOkClick + Top = 20 + Width = 120 + Height = 17 + Caption = '(9) Solution 1' + TabOrder = 2 + OnClick = Stream1CClick end object Stream1: TComboBox Left = 133 @@ -127,20 +87,30 @@ object OutputStrDialog: TOutputStrDialog TabOrder = 4 OnClick = BtnStr1Click end - object BtnStr2: TButton - Left = 237 - Top = 40 - Width = 25 - Height = 22 - Caption = '...' - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -9 - Font.Name = 'Tahoma' - Font.Style = [] - ParentFont = False - TabOrder = 8 - OnClick = BtnStr2Click + object Format1: TComboBox + Left = 278 + Top = 18 + Width = 107 + Height = 21 + Style = csDropDownList + ItemIndex = 0 + TabOrder = 5 + Text = 'Lat/Lon/Height' + Items.Strings = ( + 'Lat/Lon/Height' + 'X/Y/Z-ECEF' + 'E/N/U-Baseline' + 'NMEA0183' + 'Solution Status') + end + object Stream2C: TCheckBox + Left = 8 + Top = 43 + Width = 120 + Height = 17 + Caption = '(10) Solution 2' + TabOrder = 6 + OnClick = Stream2CClick end object Stream2: TComboBox Left = 133 @@ -158,15 +128,28 @@ object OutputStrDialog: TOutputStrDialog 'NTRIP Caster' 'File') end - object Format1: TComboBox + object BtnStr2: TButton + Left = 237 + Top = 40 + Width = 25 + Height = 22 + Caption = '...' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -9 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + TabOrder = 8 + OnClick = BtnStr2Click + end + object Format2: TComboBox Left = 278 - Top = 18 + Top = 41 Width = 107 Height = 21 Style = csDropDownList - ItemIndex = 0 - TabOrder = 5 - Text = 'Lat/Lon/Height' + TabOrder = 9 Items.Strings = ( 'Lat/Lon/Height' 'X/Y/Z-ECEF' @@ -174,13 +157,53 @@ object OutputStrDialog: TOutputStrDialog 'NMEA0183' 'Solution Status') end - object Format2: TComboBox + object Stream3C: TCheckBox + Left = 8 + Top = 66 + Width = 120 + Height = 17 + Caption = '(11) Solution 3' + TabOrder = 10 + OnClick = Stream3CClick + end + object Stream3: TComboBox + Left = 133 + Top = 64 + Width = 103 + Height = 21 + Style = csDropDownList + TabOrder = 11 + OnChange = Stream3Change + Items.Strings = ( + 'Serial' + 'TCP Client' + 'TCP Server' + 'NTRIP Server' + 'NTRIP Caster' + 'File') + end + object BtnStr3: TButton + Left = 237 + Top = 63 + Width = 25 + Height = 22 + Caption = '...' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -9 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + TabOrder = 12 + OnClick = BtnStr3Click + end + object Format3: TComboBox Left = 278 - Top = 41 + Top = 64 Width = 107 Height = 21 Style = csDropDownList - TabOrder = 9 + TabOrder = 13 Items.Strings = ( 'Lat/Lon/Height' 'X/Y/Z-ECEF' @@ -188,16 +211,23 @@ object OutputStrDialog: TOutputStrDialog 'NMEA0183' 'Solution Status') end + object LabelF1: TLabel + Left = 8 + Top = 87 + Width = 83 + Height = 13 + Caption = 'Output File Paths' + end object FilePath1: TEdit Left = 6 - Top = 80 + Top = 103 Width = 355 Height = 21 - TabOrder = 10 + TabOrder = 14 end object BtnFile1: TButton Left = 361 - Top = 79 + Top = 102 Width = 25 Height = 22 Caption = '...' @@ -207,19 +237,19 @@ object OutputStrDialog: TOutputStrDialog Font.Name = 'Tahoma' Font.Style = [] ParentFont = False - TabOrder = 11 + TabOrder = 15 OnClick = BtnFile1Click end object FilePath2: TEdit Left = 6 - Top = 102 + Top = 125 Width = 355 Height = 21 - TabOrder = 12 + TabOrder = 16 end object BtnFile2: TButton Left = 361 - Top = 101 + Top = 124 Width = 25 Height = 22 Caption = '...' @@ -229,41 +259,68 @@ object OutputStrDialog: TOutputStrDialog Font.Name = 'Tahoma' Font.Style = [] ParentFont = False - TabOrder = 13 + TabOrder = 17 OnClick = BtnFile2Click end + object FilePath3: TEdit + Left = 6 + Top = 146 + Width = 355 + Height = 21 + TabOrder = 18 + end + object BtnFile3: TButton + Left = 361 + Top = 145 + Width = 25 + Height = 22 + Caption = '...' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -9 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + TabOrder = 19 + OnClick = BtnFile3Click + end + object BtnKey: TSpeedButton + Left = 190 + Top = 172 + Width = 21 + Height = 23 + Caption = '?' + Flat = True + OnClick = BtnKeyClick + end + object Label1: TLabel + Left = 78 + Top = 176 + Width = 49 + Height = 13 + Caption = 'Swap Intv' + end + object Label2: TLabel + Left = 178 + Top = 176 + Width = 7 + Height = 13 + Caption = 'H' + end object TimeTagC: TCheckBox Left = 8 - Top = 130 + Top = 174 Width = 65 Height = 17 Caption = 'Time-Tag' - TabOrder = 14 - end - object Stream1C: TCheckBox - Left = 8 - Top = 20 - Width = 120 - Height = 17 - Caption = '(4) Solution 1' - TabOrder = 2 - OnClick = Stream1CClick - end - object Stream2C: TCheckBox - Left = 8 - Top = 43 - Width = 120 - Height = 17 - Caption = '(5) Solution 2' - TabOrder = 6 - OnClick = Stream2CClick + TabOrder = 20 end object SwapIntv: TComboBox Left = 130 - Top = 129 + Top = 173 Width = 45 Height = 21 - TabOrder = 15 + TabOrder = 21 Items.Strings = ( '' '0.25' @@ -274,6 +331,25 @@ object OutputStrDialog: TOutputStrDialog '12' '24') end + object BtnCancel: TButton + Left = 301 + Top = 171 + Width = 85 + Height = 27 + Caption = '&Cancel' + ModalResult = 2 + TabOrder = 0 + end + object BtnOk: TButton + Left = 213 + Top = 171 + Width = 85 + Height = 27 + Caption = '&OK' + ModalResult = 1 + TabOrder = 1 + OnClick = BtnOkClick + end object SaveDialog: TSaveDialog Filter = 'All File (*.*)|*.*|Log File (*.log)|*.log|RTCM2 File (*.rtcm2)|*' + diff --git a/app/winapp/rtknavi/outstrdlg.h b/app/winapp/rtknavi/outstrdlg.h index 31f6cc729..05f7b4d38 100644 --- a/app/winapp/rtknavi/outstrdlg.h +++ b/app/winapp/rtknavi/outstrdlg.h @@ -17,22 +17,28 @@ class TOutputStrDialog : public TForm TLabel *Label5; TLabel *Label6; TComboBox *Stream1; + TComboBox *Stream2; + TComboBox *Stream3; TButton *BtnStr1; TButton *BtnStr2; - TComboBox *Stream2; + TButton *BtnStr3; TLabel *Label10; TLabel *Label7; TComboBox *Format1; TComboBox *Format2; + TComboBox *Format3; TButton *BtnFile1; + TButton *BtnFile2; + TButton *BtnFile3; TEdit *FilePath1; TEdit *FilePath2; - TButton *BtnFile2; + TEdit *FilePath3; TLabel *LabelF1; TSaveDialog *SaveDialog; TCheckBox *TimeTagC; TCheckBox *Stream1C; TCheckBox *Stream2C; + TCheckBox *Stream3C; TSpeedButton *BtnKey; TLabel *Label1; TComboBox *SwapIntv; @@ -41,12 +47,16 @@ class TOutputStrDialog : public TForm void __fastcall FormShow(TObject *Sender); void __fastcall BtnStr1Click(TObject *Sender); void __fastcall BtnStr2Click(TObject *Sender); + void __fastcall BtnStr3Click(TObject *Sender); void __fastcall Stream1Change(TObject *Sender); void __fastcall Stream2Change(TObject *Sender); + void __fastcall Stream3Change(TObject *Sender); void __fastcall BtnFile1Click(TObject *Sender); void __fastcall BtnFile2Click(TObject *Sender); + void __fastcall BtnFile3Click(TObject *Sender); void __fastcall Stream1CClick(TObject *Sender); void __fastcall Stream2CClick(TObject *Sender); + void __fastcall Stream3CClick(TObject *Sender); void __fastcall BtnKeyClick(TObject *Sender); private: AnsiString __fastcall GetFilePath(AnsiString path); @@ -55,8 +65,8 @@ class TOutputStrDialog : public TForm void __fastcall TcpOpt(int index, int opt); void __fastcall UpdateEnable(void); public: - int StreamC[2],Stream[2],Format[2],OutTimeTag,OutAppend; - AnsiString Paths[2][4],SwapInterval; + int StreamC[RTKSVRNSOL],Stream[RTKSVRNSOL],Format[RTKSVRNSOL],OutTimeTag,OutAppend; + AnsiString Paths[RTKSVRNSOL][4],SwapInterval; AnsiString History[10]; __fastcall TOutputStrDialog(TComponent* Owner); }; diff --git a/src/rtklib.h b/src/rtklib.h index 2d3093453..40a1333ca 100644 --- a/src/rtklib.h +++ b/src/rtklib.h @@ -282,7 +282,13 @@ extern "C" { #define MAXCOMMENT 100 /* max number of RINEX comments */ #define MAXSTRPATH 1024 /* max length of stream path */ #define MAXSTRMSG 1024 /* max length of stream message */ -#define MAXSTRRTK 8 /* max number of stream in RTK server */ +#ifndef RTKSVRNIN +#define RTKSVRNIN 4 // Number of RTK server input streams. +#endif +#ifndef RTKSVRNSOL +#define RTKSVRNSOL 3 // Number of RTK server output streams. +#endif +#define MAXSTRRTK (RTKSVRNIN * 2 + RTKSVRNSOL) // Max number of stream in RTK server. #define MAXSBSMSG 32 /* max number of SBAS msg in RTK server */ #define MAXSOLLEN 512 /* max line length of solution message */ #define MAXSOLMSG 32768 /* max length of solution messages */ @@ -1329,28 +1335,28 @@ typedef struct { /* RTK server type */ int nmeareq; /* NMEA request (0:no,1:nmeapos,2:single sol) */ double nmeapos[3]; /* NMEA request position (ecef) (m) */ int buffsize; /* input buffer size (bytes) */ - int format[3]; /* input format {rov,base,corr} */ - solopt_t solopt[2]; /* output solution options {sol1,sol2} */ + int format[RTKSVRNIN]; /* input format {rov,base,corr} */ + solopt_t solopt[RTKSVRNSOL]; /* output solution options {sol1,sol2,sol3} */ int navsel; /* ephemeris select (0:all,1:rover,2:base,3:corr) */ int nsbs; /* number of sbas message */ int nsol; /* number of solution buffer */ rtk_t rtk; /* RTK control/result struct */ - int nb [3]; /* bytes in input buffers {rov,base} */ - int nsb[2]; /* bytes in solution buffers */ - int npb[3]; /* bytes in input peek buffers */ - uint8_t *buff[3]; /* input buffers {rov,base,corr} */ - uint8_t *sbuf[2]; /* output buffers {sol1,sol2} */ - uint8_t *pbuf[3]; /* peek buffers {rov,base,corr} */ + int nb [RTKSVRNIN]; /* bytes in input buffers {rov,base} */ + int nsb[RTKSVRNSOL]; /* bytes in solution buffers */ + int npb[RTKSVRNIN]; /* bytes in input peek buffers */ + uint8_t *buff[RTKSVRNIN]; /* input buffers {rov,base,corr} */ + uint8_t *sbuf[RTKSVRNSOL]; /* output buffers {sol1,sol2} */ + uint8_t *pbuf[RTKSVRNIN]; /* peek buffers {rov,base,corr} */ sol_t solbuf[MAXSOLBUF]; /* solution line buffer */ - uint32_t nmsg[3][10]; /* input message counts */ - raw_t raw [3]; /* receiver raw control {rov,base,corr} */ - rtcm_t rtcm[3]; /* RTCM control {rov,base,corr} */ - gtime_t ftime[3]; /* download time {rov,base,corr} */ - char files[3][MAXSTRPATH]; /* download paths {rov,base,corr} */ - obs_t obs[3][MAXOBSBUF]; /* observation data {rov,base,corr} */ + uint32_t nmsg[RTKSVRNIN][10]; /* input message counts */ + raw_t raw [RTKSVRNIN]; /* receiver raw control {rov,base,corr} */ + rtcm_t rtcm[RTKSVRNIN]; /* RTCM control {rov,base,corr} */ + gtime_t ftime[RTKSVRNIN]; /* download time {rov,base,corr} */ + char files[RTKSVRNIN][MAXSTRPATH]; /* download paths {rov,base,corr} */ + obs_t obs[RTKSVRNIN][MAXOBSBUF]; /* observation data {rov,base,corr} */ nav_t nav; /* navigation data */ sbsmsg_t sbsmsg[MAXSBSMSG]; /* SBAS message buffer */ - stream_t stream[8]; /* streams {rov,base,corr,sol1,sol2,logr,logb,logc} */ + stream_t stream[MAXSTRRTK]; /* streams {rov,base,corr1,corr2,logr,logb,logc1,logc2,sol1,sol2,sol3} */ stream_t *moni; /* monitor stream */ uint32_t tick; /* start tick */ rtklib_thread_t thread; /* server thread */ @@ -1358,7 +1364,7 @@ typedef struct { /* RTK server type */ int prcout; /* missing observation data count */ int nave; /* number of averaging base pos */ double rb_ave[3]; /* averaging base pos */ - char cmds_periodic[3][MAXRCVCMD]; /* periodic commands */ + char cmds_periodic[RTKSVRNIN][MAXRCVCMD]; /* periodic commands */ char cmd_reset[MAXRCVCMD]; /* reset command */ double bl_reset; /* baseline length to reset (km) */ pcvs_t pcvsr; // Receiver antenna parameters. diff --git a/src/rtksvr.c b/src/rtksvr.c index c318bdeca..e6f66d965 100644 --- a/src/rtksvr.c +++ b/src/rtksvr.c @@ -95,7 +95,7 @@ static void writesol(rtksvr_t *svr, int index) tracet(4,"writesol: index=%d\n",index); - for (i=0;i<2;i++) { + for (i=0;isolopt[i].posf==SOLF_STAT) { /* output solution status */ @@ -107,7 +107,7 @@ static void writesol(rtksvr_t *svr, int index) /* output solution */ n=outsols(buff,&svr->rtk.sol,svr->rtk.rb,svr->solopt+i); } - strwrite(svr->stream+i+3,buff,n); + strwrite(svr->stream+RTKSVRNIN*2+i,buff,n); /* save output buffer */ rtksvrlock(svr); @@ -116,7 +116,7 @@ static void writesol(rtksvr_t *svr, int index) /* output extended solution */ n=outsolexs(buff,&svr->rtk.sol,svr->rtk.ssat,svr->solopt+i); - strwrite(svr->stream+i+3,buff,n); + strwrite(svr->stream+RTKSVRNIN*2+i,buff,n); /* save output buffer */ rtksvrlock(svr); @@ -668,7 +668,7 @@ static void *rtksvrthread(void *arg) for (cycle=0;svr->state;cycle++) { tick=tickget(); - for (i=0;i<3;i++) { + for (i=0;ibuff[i]+svr->nb[i]; q=svr->buff[i]+svr->buffsize; /* read receiver raw/rtcm data from input stream */ @@ -676,7 +676,7 @@ static void *rtksvrthread(void *arg) continue; } /* write receiver raw/rtcm data to log stream */ - strwrite(svr->stream+i+5,p,n); + strwrite(svr->stream+i+RTKSVRNIN,p,n); svr->nb[i]+=n; /* save peek buffer */ @@ -686,8 +686,8 @@ static void *rtksvrthread(void *arg) svr->npb[i]+=n; rtksvrunlock(svr); } - int fobs[3]={0}; - for (i=0;i<3;i++) { + int fobs[RTKSVRNIN]={0}; + for (i=0;iformat[i]==STRFMT_SP3||svr->format[i]==STRFMT_RNXCLK) { /* decode download file */ decodefile(svr,i); @@ -747,7 +747,7 @@ static void *rtksvrthread(void *arg) tick1hz=tick; } /* write periodic command to input stream */ - for (i=0;i<3;i++) { + for (i=0;icycle,svr->cmds_periodic[i],svr->stream+i); } /* send nmea request to base/nrtk input stream */ @@ -762,14 +762,14 @@ static void *rtksvrthread(void *arg) } free(data); for (i=0;istream+i); - for (i=0;i<3;i++) { + for (i=0;inb[i]=svr->npb[i]=0; free(svr->buff[i]); svr->buff[i]=NULL; free(svr->pbuf[i]); svr->pbuf[i]=NULL; free_raw (svr->raw +i); free_rtcm(svr->rtcm+i); } - for (i=0;i<2;i++) { + for (i=0;insb[i]=0; free(svr->sbuf[i]); svr->sbuf[i]=NULL; } @@ -793,20 +793,25 @@ extern int rtksvrinit(rtksvr_t *svr) svr->state=svr->cycle=svr->nmeacycle=svr->nmeareq=0; for (i=0;i<3;i++) svr->nmeapos[i]=0.0; svr->buffsize=0; - for (i=0;i<3;i++) svr->format[i]=0; - for (i=0;i<2;i++) svr->solopt[i]=solopt_default; svr->navsel=svr->nsbs=svr->nsol=0; rtkinit(&svr->rtk,&prcopt_default); - for (i=0;i<3;i++) svr->nb[i]=0; - for (i=0;i<2;i++) svr->nsb[i]=0; - for (i=0;i<3;i++) svr->npb[i]=0; - for (i=0;i<3;i++) svr->buff[i]=NULL; - for (i=0;i<2;i++) svr->sbuf[i]=NULL; - for (i=0;i<3;i++) svr->pbuf[i]=NULL; + for (i=0;iformat[i]=0; + svr->nb[i]=0; + svr->npb[i]=0; + svr->buff[i]=NULL; + svr->pbuf[i]=NULL; + for (j=0;j<10;j++) svr->nmsg[i][j]=0; + svr->ftime[i]=time0; + svr->files[i][0]='\0'; + svr->cmds_periodic[i][0]='\0'; + } + for (i=0;isolopt[i]=solopt_default; + svr->nsb[i]=0; + svr->sbuf[i]=NULL; + } for (i=0;isolbuf[i]=sol0; - for (i=0;i<3;i++) for (j=0;j<10;j++) svr->nmsg[i][j]=0; - for (i=0;i<3;i++) svr->ftime[i]=time0; - for (i=0;i<3;i++) svr->files[i][0]='\0'; svr->moni=NULL; svr->tick=0; svr->thread=0; @@ -838,16 +843,16 @@ extern int rtksvrinit(rtksvr_t *svr) } svr->nav.ng = svr->nav.ngmax = MAXPRNGLO * 2; - for (i=0;i<3;i++) for (j=0;jobs[i][j].data=(obsd_t *)malloc(sizeof(obsd_t)*MAXOBS))) { tracet(1,"rtksvrinit: malloc error\n"); rtksvrfree(svr); return 0; } - } - for (i=0;i<3;i++) { - memset(svr->raw +i,0,sizeof(raw_t )); - memset(svr->rtcm+i,0,sizeof(rtcm_t)); + } + memset(svr->raw +i,0,sizeof(raw_t )); + memset(svr->rtcm+i,0,sizeof(rtcm_t)); } for (i=0;istream+i); @@ -858,7 +863,6 @@ extern int rtksvrinit(rtksvr_t *svr) } } - for (i=0;i<3;i++) *svr->cmds_periodic[i]='\0'; *svr->cmd_reset='\0'; svr->bl_reset=10.0; svr->pcvsr.pcv = NULL; @@ -879,7 +883,7 @@ extern void rtksvrfree(rtksvr_t *svr) free(svr->nav.eph ); free(svr->nav.geph); free(svr->nav.seph); - for (i=0;i<3;i++) for (j=0;jobs[i][j].data); } rtkfree(&svr->rtk); @@ -900,31 +904,38 @@ extern void rtksvrunlock(rtksvr_t *svr) {rtklib_unlock(&svr->lock);} * int *strs I stream types (STR_???) * types[0]=input stream rover * types[1]=input stream base station -* types[2]=input stream correction -* types[3]=output stream solution 1 -* types[4]=output stream solution 2 -* types[5]=log stream rover -* types[6]=log stream base station -* types[7]=log stream correction +* types[2]=input stream correction 1 +* types[3]=input stream correction 2 +* types[4]=log stream rover +* types[5]=log stream base station +* types[6]=log stream correction 1 +* types[7]=log stream correction 2 +* types[8]=output stream solution 1 +* types[9]=output stream solution 2 +* types[10]=output stream solution 3 * char *paths I input stream paths * int *format I input stream formats (STRFMT_???) * format[0]=input stream rover * format[1]=input stream base station -* format[2]=input stream correction +* format[2]=input stream correction 1 +* format[3]=input stream correction 2 * int navsel I navigation message select * (0:rover,1:base,2:ephem,3:all) * char **cmds I input stream start commands * cmds[0]=input stream rover (NULL: no command) * cmds[1]=input stream base (NULL: no command) -* cmds[2]=input stream corr (NULL: no command) +* cmds[2]=input stream corr 1 (NULL: no command) +* cmds[3]=input stream corr 2 (NULL: no command) * char **cmds_periodic I input stream periodic commands * cmds[0]=input stream rover (NULL: no command) * cmds[1]=input stream base (NULL: no command) -* cmds[2]=input stream corr (NULL: no command) +* cmds[2]=input stream corr 1 (NULL: no command) +* cmds[3]=input stream corr 2 (NULL: no command) * char **rcvopts I receiver options * rcvopt[0]=receiver option rover * rcvopt[1]=receiver option base -* rcvopt[2]=receiver option corr +* rcvopt[2]=receiver option corr 1 +* rcvopt[3]=receiver option corr 2 * int nmeacycle I nmea request cycle (ms) (0:no request) * int nmeareq I nmea request type * (0:no,1:base pos,2:single sol,3:reset and single) @@ -933,6 +944,7 @@ extern void rtksvrunlock(rtksvr_t *svr) {rtklib_unlock(&svr->lock);} * solopt_t *solopt I solution options * solopt[0]=solution 1 options * solopt[1]=solution 2 options +* solopt[2]=solution 3 options * stream_t *moni I monitor stream (NULL: not used) * char *errmsg O error message * return : status (1:ok 0:error) @@ -959,7 +971,7 @@ extern int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs, svr->nmeareq=nmeareq; for (i=0;i<3;i++) svr->nmeapos[i]=nmeapos[i]; svr->buffsize=buffsize>4096?buffsize:4096; - for (i=0;i<3;i++) svr->format[i]=formats[i]; + for (i=0;iformat[i]=formats[i]; svr->navsel=navsel; svr->nsbs=0; svr->nsol=0; @@ -971,7 +983,7 @@ extern int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs, svr->nave=0; for (i=0;i<3;i++) svr->rb_ave[i]=0.0; } - for (i=0;i<3;i++) { /* input/log streams */ + for (i=0;inb[i]=svr->npb[i]=0; if (!(svr->buff[i]=(uint8_t *)malloc(buffsize))|| !(svr->pbuf[i]=(uint8_t *)malloc(buffsize))) { @@ -994,7 +1006,7 @@ extern int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs, /* connect dgps corrections */ svr->rtcm[i].dgps=svr->nav.dgps; } - for (i=0;i<2;i++) { /* output peek buffer */ + for (i=0;isbuf[i]=(uint8_t *)malloc(buffsize))) { tracet(1,"rtksvrstart: malloc error\n"); sprintf(errmsg,"rtk server malloc error"); @@ -1002,7 +1014,7 @@ extern int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs, } } /* set solution options */ - for (i=0;i<2;i++) { + for (i=0;isolopt[i]=solopt[i]; } /* set base station position */ @@ -1023,8 +1035,8 @@ extern int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs, svr->moni=moni; /* open input streams */ - for (i=0;i<8;i++) { - rw=i<3?STR_MODE_R:STR_MODE_W; + for (i=0;istream+i,strs[i],rw,paths[i])) { sprintf(errmsg,"str%d open error path=%s",i+1,paths[i]); @@ -1032,7 +1044,7 @@ extern int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs, return 0; } /* set initial time for rtcm and raw */ - if (i<3) { + if (iraw [i].time=strs[i]==STR_FILE?strgettime(svr->stream+i):time; svr->rtcm[i].time=strs[i]==STR_FILE?strgettime(svr->stream+i):time; @@ -1049,15 +1061,15 @@ extern int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs, strsync(svr->stream,svr->stream+2); /* write start commands to input streams */ - for (i=0;i<3;i++) { + for (i=0;istream+i,(unsigned char *)"",0); /* for connect */ sleepms(100); strsendcmd(svr->stream+i,cmds[i]); } /* write solution header to solution streams */ - for (i=3;i<5;i++) { - writesolhead(svr->stream+i,svr->solopt+(i-3), prcopt); + for (i=RTKSVRNIN*2;istream+i,svr->solopt+(i-RTKSVRNIN*2), prcopt); } /* create rtk server thread */ #ifdef WIN32 @@ -1088,7 +1100,7 @@ extern void rtksvrstop(rtksvr_t *svr, const char **cmds) /* write stop commands to input streams */ rtksvrlock(svr); - for (i=0;i<3;i++) { + for (i=0;istream+i,cmds[i]); } rtksvrunlock(svr); @@ -1108,8 +1120,8 @@ extern void rtksvrstop(rtksvr_t *svr, const char **cmds) * open output/log stream * args : rtksvr_t *svr IO rtk server * int index I output/log stream index -* (3:solution 1,4:solution 2,5:log rover, -* 6:log base station,7:log correction) +* (4:log rover, 5:log base station, 6:log correction 1, +* 7:log correction 2, 8:solution 1, 8:solution 2, 9:solution 2) * int str I output/log stream types (STR_???) * char *path I output/log stream path * solopt_t *solopt I solution options @@ -1120,7 +1132,7 @@ extern int rtksvropenstr(rtksvr_t *svr, int index, int str, const char *path, { tracet(3,"rtksvropenstr: index=%d str=%d path=%s\n",index,str,path); - if (index<3||index>7||!svr->state) return 0; + if (index=MAXSTRRTK||!svr->state) return 0; rtksvrlock(svr); @@ -1133,11 +1145,11 @@ extern int rtksvropenstr(rtksvr_t *svr, int index, int str, const char *path, rtksvrunlock(svr); return 0; } - if (index<=4) { - svr->solopt[index-3]=*solopt; + if (index >= RTKSVRNIN*2) { + svr->solopt[index - RTKSVRNIN*2] = *solopt; /* write solution header to solution stream */ - writesolhead(svr->stream+index,svr->solopt+(index-3),prcopt); + writesolhead(svr->stream+index,svr->solopt+(index-RTKSVRNIN*2),prcopt); } rtksvrunlock(svr); return 1; @@ -1146,15 +1158,15 @@ extern int rtksvropenstr(rtksvr_t *svr, int index, int str, const char *path, * close output/log stream * args : rtksvr_t *svr IO rtk server * int index I output/log stream index -* (3:solution 1,4:solution 2,5:log rover, -* 6:log base station,7:log correction) +* (4:log rover, 5:log base station, 6:log correction 1, +* 7:log correction 1, 8:solution 1, 9:solution 2, 10:solution 3) * return : none *-----------------------------------------------------------------------------*/ extern void rtksvrclosestr(rtksvr_t *svr, int index) { tracet(3,"rtksvrclosestr: index=%d\n",index); - if (index<3||index>7||!svr->state) return; + if (index=MAXSTRRTK||!svr->state) return; rtksvrlock(svr); @@ -1223,7 +1235,7 @@ extern void rtksvrsstat(rtksvr_t *svr, int *sstat, char *msg) rtksvrunlock(svr); } /* mark current position ------------------------------------------------------- -* open output/log stream +* mark current position * args : rtksvr_t *svr IO rtk server * char *name I marker name * char *comment I comment string @@ -1245,7 +1257,7 @@ extern int rtksvrmark(rtksvr_t *svr, const char *name, const char *comment) tow=time2gpst(svr->rtk.sol.time,&week); ecef2pos(svr->rtk.sol.rr,pos); - for (i=0;i<2;i++) { + for (i=0;isolopt[i].posf==SOLF_STAT) { p+=sprintf(p,"$MARK,%d,%.3f,%d,%.4f,%.4f,%.4f,%s,%s\r\n",week,tow, @@ -1264,7 +1276,7 @@ extern int rtksvrmark(rtksvr_t *svr, const char *name, const char *comment) name,tstr,pos[0]*R2D,pos[1]*R2D,pos[2],svr->rtk.sol.stat, comment); } - strwrite(svr->stream+i+3,(uint8_t *)buff,(int)(p-buff)); + strwrite(svr->stream+RTKSVRNIN*2+i,(uint8_t *)buff,(int)(p-buff)); saveoutbuf(svr,(uint8_t *)buff,(int)(p-buff),i); } if (svr->moni) {