Skip to content

Commit 7b9bc50

Browse files
committed
rtkrcv, rtknavi: support more solution out streams
Move towards the number of output streams being a compilation option, adding the RTKSVRNSOL define 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 now builds with up to 6 output streams and could support more by simply adding move config options for them, and rtknavi builds with 3 out streams.
1 parent 89a735b commit 7b9bc50

20 files changed

Lines changed: 820 additions & 485 deletions

app/consapp/rtkrcv/gcc/makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
BINDIR = /usr/local/bin
44
SRC = ../../../../src
55

6-
CTARGET= -DTRACE -DENAGLO -DENAQZS -DENACMP -DENAGAL -DENAIRN -DNFREQ=4 -DNEXOBS=3 -DSVR_REUSEADDR
6+
CTARGET= -DTRACE -DENAGLO -DENAQZS -DENACMP -DENAGAL -DENAIRN -DNFREQ=4 -DNEXOBS=3 -DSVR_REUSEADDR -DRTKSVRNSOL=6
77
#CTARGET= -DENAGLO -DENAQZS -DENACMP -DENAGAL -DENAIRN -DNFREQ=4 -DIERS_MODEL -DSVR_REUSEADDR
88

99
CFLAGS = -std=c99 -Wall -O3 -pedantic -Wno-unused-but-set-variable -I$(SRC) -I.. -DTRACE $(CTARGET) -g

app/consapp/rtkrcv/rtkrcv.c

Lines changed: 74 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,14 @@ static char passwd[MAXSTR]="admin"; /* login password */
9191
static int timetype =0; /* time format (0:gpst,1:utc,2:jst,3:tow) */
9292
static int soltype =0; /* sol format (0:dms,1:deg,2:xyz,3:enu,4:pyl) */
9393
static int solflag =2; /* sol flag (1:std+2:age/ratio/ns) */
94-
static int strtype[]={ /* stream types */
95-
STR_SERIAL,STR_NONE,STR_NONE,STR_NONE,STR_NONE,STR_NONE,STR_NONE,STR_NONE
94+
static int strtype[MAXSTRRTK]={ /* stream types */
95+
STR_SERIAL,STR_NONE,STR_NONE,STR_NONE,STR_NONE,STR_NONE
9696
};
97-
static char strpath[8][MAXSTR]={"","","","","","","",""}; /* stream paths */
98-
static int strfmt[]={ /* stream formats */
99-
STRFMT_UBX,STRFMT_RTCM3,STRFMT_SP3,SOLF_LLH,SOLF_NMEA
97+
static char strpath[MAXSTRRTK][MAXSTR]={"","","","","",""}; /* stream paths */
98+
static int strfmt[]={ /* Input stream formats */
99+
STRFMT_UBX,STRFMT_RTCM3,STRFMT_SP3
100100
};
101+
static int ostrfmt[RTKSVRNSOL]; /* Output stream formats */
101102
static char rcvopt[3][256]={""}; /* Receiver options */
102103
static int svrcycle =10; /* server cycle (ms) */
103104
static int timeout =10000; /* timeout time (ms) */
@@ -122,7 +123,7 @@ static int fswapmargin =30; /* file swap margin (s) */
122123
static char sta_name[256]=""; /* station name */
123124

124125
static prcopt_t prcopt; /* processing options */
125-
static solopt_t solopt[2]={{0}}; /* solution options */
126+
static solopt_t solopt[RTKSVRNSOL]={{0}}; /* solution options */
126127
static filopt_t filopt ={""}; /* file options */
127128

128129
/* help text -----------------------------------------------------------------*/
@@ -197,33 +198,51 @@ static opt_t rcvopts[]={
197198
{"console-solflag", 0, (void *)&solflag, FLGOPT },
198199

199200
{"inpstr1-type", 3, (void *)&strtype[0], ISTOPT },
200-
{"inpstr2-type", 3, (void *)&strtype[1], ISTOPT },
201-
{"inpstr3-type", 3, (void *)&strtype[2], ISTOPT },
202201
{"inpstr1-path", 2, (void *)strpath [0], "" },
203-
{"inpstr2-path", 2, (void *)strpath [1], "" },
204-
{"inpstr3-path", 2, (void *)strpath [2], "" },
205202
{"inpstr1-format", 3, (void *)&strfmt [0], FMTOPT },
206-
{"inpstr2-format", 3, (void *)&strfmt [1], FMTOPT },
207-
{"inpstr3-format", 3, (void *)&strfmt [2], FMTOPT },
208203
{"inpstr1-rcvopt", 2, (void *)rcvopt[0], "" },
204+
{"inpstr2-type", 3, (void *)&strtype[1], ISTOPT },
205+
{"inpstr2-path", 2, (void *)strpath [1], "" },
206+
{"inpstr2-format", 3, (void *)&strfmt [1], FMTOPT },
209207
{"inpstr2-rcvopt", 2, (void *)rcvopt[1], "" },
210-
{"inpstr3-rcvopt", 2, (void *)rcvopt[2], "" },
211208
{"inpstr2-nmeareq", 3, (void *)&nmeareq, NMEOPT },
212209
{"inpstr2-nmealat", 1, (void *)&nmeapos[0], "deg" },
213210
{"inpstr2-nmealon", 1, (void *)&nmeapos[1], "deg" },
214211
{"inpstr2-nmeahgt", 1, (void *)&nmeapos[2], "m" },
215-
{"outstr1-type", 3, (void *)&strtype[3], OSTOPT },
216-
{"outstr2-type", 3, (void *)&strtype[4], OSTOPT },
217-
{"outstr1-path", 2, (void *)strpath [3], "" },
218-
{"outstr2-path", 2, (void *)strpath [4], "" },
219-
{"outstr1-format", 3, (void *)&strfmt [3], SOLOPT },
220-
{"outstr2-format", 3, (void *)&strfmt [4], SOLOPT },
221-
{"logstr1-type", 3, (void *)&strtype[5], OSTOPT },
222-
{"logstr2-type", 3, (void *)&strtype[6], OSTOPT },
223-
{"logstr3-type", 3, (void *)&strtype[7], OSTOPT },
224-
{"logstr1-path", 2, (void *)strpath [5], "" },
225-
{"logstr2-path", 2, (void *)strpath [6], "" },
226-
{"logstr3-path", 2, (void *)strpath [7], "" },
212+
{"inpstr3-type", 3, (void *)&strtype[2], ISTOPT },
213+
{"inpstr3-path", 2, (void *)strpath [2], "" },
214+
{"inpstr3-format", 3, (void *)&strfmt [2], FMTOPT },
215+
{"inpstr3-rcvopt", 2, (void *)rcvopt[2], "" },
216+
{"logstr1-type", 3, (void *)&strtype[3], OSTOPT },
217+
{"logstr1-path", 2, (void *)strpath [3], "" },
218+
{"logstr2-type", 3, (void *)&strtype[4], OSTOPT },
219+
{"logstr2-path", 2, (void *)strpath [4], "" },
220+
{"logstr3-type", 3, (void *)&strtype[5], OSTOPT },
221+
{"logstr3-path", 2, (void *)strpath [5], "" },
222+
{"outstr1-type", 3, (void *)&strtype[6], OSTOPT },
223+
{"outstr1-path", 2, (void *)strpath [6], "" },
224+
{"outstr1-format", 3, (void *)&ostrfmt[0], SOLOPT },
225+
{"outstr2-type", 3, (void *)&strtype[7], OSTOPT },
226+
{"outstr2-path", 2, (void *)strpath [7], "" },
227+
{"outstr2-format", 3, (void *)&ostrfmt[1], SOLOPT },
228+
{"outstr3-type", 3, (void *)&strtype[8], OSTOPT },
229+
{"outstr3-path", 2, (void *)strpath [8], "" },
230+
{"outstr3-format", 3, (void *)&ostrfmt[2], SOLOPT },
231+
#if RTKSVRNSOL > 3
232+
{"outstr4-type", 3, (void *)&strtype[9], OSTOPT },
233+
{"outstr4-path", 2, (void *)strpath [9], "" },
234+
{"outstr4-format", 3, (void *)&ostrfmt[3], SOLOPT },
235+
#endif
236+
#if RTKSVRNSOL > 4
237+
{"outstr5-type", 3, (void *)&strtype[10], OSTOPT },
238+
{"outstr5-path", 2, (void *)strpath [10], "" },
239+
{"outstr5-format", 3, (void *)&ostrfmt[4], SOLOPT },
240+
#endif
241+
#if RTKSVRNSOL > 5
242+
{"outstr6-type", 3, (void *)&strtype[11], OSTOPT },
243+
{"outstr6-path", 2, (void *)strpath [11], "" },
244+
{"outstr6-format", 3, (void *)&ostrfmt[5], SOLOPT },
245+
#endif
227246

228247
{"misc-svrcycle", 0, (void *)&svrcycle, "ms" },
229248
{"misc-timeout", 0, (void *)&timeout, "ms" },
@@ -436,15 +455,12 @@ static int startsvr(vt_t *vt)
436455
char s1[3][MAXRCVCMD]={"","",""},*cmds[]={NULL,NULL,NULL};
437456
char s2[3][MAXRCVCMD]={"","",""},*cmds_periodic[]={NULL,NULL,NULL};
438457
char *ropts[]={rcvopt[0],rcvopt[1],rcvopt[2]};
439-
char *paths[]={
440-
strpath[0],strpath[1],strpath[2],strpath[3],strpath[4],strpath[5],
441-
strpath[6],strpath[7]
442-
};
458+
char *paths[MAXSTRRTK];
443459
char errmsg[2048]="";
444-
int i,stropt[8]={0};
460+
int i,stropt[MAXSTRRTK]={0};
445461

446462
trace(3,"startsvr:\n");
447-
463+
448464
/* read start commands from command files */
449465
for (i=0;i<3;i++) {
450466
if (!*rcvcmds[i]) continue;
@@ -459,7 +475,7 @@ static int startsvr(vt_t *vt)
459475
}
460476
/* confirm overwrite */
461477
if (vt!=NULL) {
462-
for (i=3;i<8;i++) {
478+
for (i = 3; i < MAXSTRRTK; i++) {
463479
if (strtype[i]==STR_FILE&&!confwrite(vt,strpath[i])) return 0;
464480
}
465481
}
@@ -507,9 +523,10 @@ static int startsvr(vt_t *vt)
507523
vt_printf(vt,"command exec error: %s (%d)\n",startcmd,ret);
508524
}
509525
#endif
510-
solopt[0].posf=strfmt[3];
511-
solopt[1].posf=strfmt[4];
512-
526+
for (int i = 0; i < RTKSVRNSOL; i++) solopt[i].posf=ostrfmt[i];
527+
528+
for (int i = 0; i < MAXSTRRTK; i++) paths[i] = strpath[i];
529+
513530
/* start rtk server */
514531
if (!rtksvrstart(&svr,svrcycle,buffsize,strtype,(const char **)paths,strfmt,navmsgsel,
515532
(const char **)cmds,(const char **)cmds_periodic,(const char **)ropts,nmeacycle,nmeareq,npos,&prcopt,
@@ -1003,35 +1020,34 @@ static void prerror(vt_t *vt)
10031020
static void prstream(vt_t *vt)
10041021
{
10051022
const char *ch[]={
1006-
"input rover","input base","input corr","output sol1","output sol2",
1007-
"log rover","log base","log corr","monitor"
1008-
};
1023+
"input rover","input base","input corr","log rover","log base","log corr"};
10091024
const char *type[]={
10101025
"-","serial","file","tcpsvr","tcpcli","ntrips","ntripc","ftp",
10111026
"http","ntripcas","udpsvr","udpcli","membuf"
10121027
};
10131028
const char *fmt[]={"rtcm2","rtcm3","oem4","","ubx","swift","hemis","skytreq",
10141029
"javad","nvs","binex","rt17","sbf","","unicore","sp3",""};
10151030
const char *sol[]={"llh","xyz","enu","nmea","stat","-"};
1016-
stream_t stream[9];
1017-
int i,format[9]={0};
1031+
stream_t stream[MAXSTRRTK+1];
1032+
int i,format[MAXSTRRTK+1]={0};
10181033

10191034
trace(4,"prstream:\n");
10201035

10211036
rtksvrlock(&svr);
1022-
for (i=0;i<8;i++) stream[i]=svr.stream[i];
1037+
for (i=0;i<MAXSTRRTK;i++) stream[i]=svr.stream[i];
10231038
for (i=0;i<3;i++) format[i]=svr.format[i];
1024-
for (i=3;i<5;i++) format[i]=svr.solopt[i-3].posf;
1025-
stream[8]=moni;
1026-
format[8]=SOLF_LLH;
1039+
for (i=0;i<RTKSVRNSOL;i++) format[6+i]=svr.solopt[i].posf;
1040+
stream[MAXSTRRTK]=moni;
1041+
format[MAXSTRRTK]=SOLF_LLH;
10271042
rtksvrunlock(&svr);
10281043

10291044
vt_printf(vt,"\n%s%-12s %-8s %-5s %s %10s %7s %10s %7s %-24s %s%s\n",ESC_BOLD,
10301045
"Stream","Type","Fmt","S","In-byte","In-bps","Out-byte","Out-bps",
10311046
"Path","Message",ESC_RESET);
1032-
for (i=0;i<9;i++) {
1047+
for (i=0;i<MAXSTRRTK+1;i++) {
1048+
const char *name = i < 6 ? ch[i] : i >= MAXSTRRTK ? "monitor" : "output sol";
10331049
vt_printf(vt,"%-12s %-8s %-5s %s %10d %7d %10d %7d %-24.24s %s\n",
1034-
ch[i],type[stream[i].type],i<3?fmt[format[i]]:(i<5||i==8?sol[format[i]]:"-"),
1050+
name,type[stream[i].type],i<3?fmt[format[i]]:(i>=6?sol[format[i]]:"-"),
10351051
stream[i].state<0?"E":(stream[i].state?"C":"-"),
10361052
stream[i].inb,stream[i].inr,stream[i].outb,stream[i].outr,
10371053
stream[i].path,stream[i].msg);
@@ -1326,7 +1342,7 @@ static void cmd_set(char **args, int narg, vt_t *vt)
13261342
return;
13271343
}
13281344
getsysopts(&prcopt,solopt,&filopt);
1329-
solopt[1]=solopt[0];
1345+
for (int i = 1; i < RTKSVRNSOL; i++) solopt[i] = solopt[0];
13301346

13311347
vt_printf(vt,"option %s changed.",opt->name);
13321348
if (strncmp(opt->name,"console",7)) {
@@ -1431,7 +1447,7 @@ static void cmd_load(char **args, int narg, vt_t *vt)
14311447
return;
14321448
}
14331449
getsysopts(&prcopt,solopt,&filopt);
1434-
solopt[1]=solopt[0];
1450+
for (int i = 1; i < RTKSVRNSOL; i++) solopt[i] = solopt[0];
14351451

14361452
if (!loadopts(file,rcvopts)) {
14371453
vt_printf(vt,"no options file: %s\n",file);
@@ -1875,6 +1891,14 @@ int main(int argc, char **argv)
18751891
traceopen(TRACEFILE);
18761892
tracelevel(trace);
18771893
}
1894+
1895+
// Default input streams.
1896+
for (int i = 0; i < RTKSVRNSOL; i++) {
1897+
strtype[6 + i] = STR_NONE;
1898+
strcpy(strpath[6 + i], "");
1899+
ostrfmt[i] = i == 0 ? SOLF_LLH : SOLF_NMEA;
1900+
}
1901+
18781902
/* initialize rtk server and monitor port */
18791903
rtksvrinit(&svr);
18801904
strinit(&moni);
@@ -1887,8 +1911,8 @@ int main(int argc, char **argv)
18871911
fprintf(stderr,"no options file: %s. defaults used\n",file);
18881912
}
18891913
getsysopts(&prcopt,solopt,&filopt);
1890-
/* Copy the system options for the second output solution stream */
1891-
solopt[1]=solopt[0];
1914+
/* Copy the system options for the other output solution streams */
1915+
for (int i = 1; i < RTKSVRNSOL; i++) solopt[i] = solopt[0];
18921916

18931917
/* read navigation data */
18941918
if (!readnav(NAVIFILE,&svr.nav)) {

app/qtapp/rtknavi_qt/logstrdlg.ui

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@
193193
<string>Enable rover data stream logging</string>
194194
</property>
195195
<property name="text">
196-
<string>(6) Rover</string>
196+
<string>(3) Rover</string>
197197
</property>
198198
</widget>
199199
</item>
@@ -223,7 +223,7 @@
223223
<string>Enable base station data stream logging</string>
224224
</property>
225225
<property name="text">
226-
<string>(7) Base Station</string>
226+
<string>(4) Base Station</string>
227227
</property>
228228
</widget>
229229
</item>
@@ -243,7 +243,7 @@
243243
<string>Enable correction data stream logging</string>
244244
</property>
245245
<property name="text">
246-
<string>(8) Correction</string>
246+
<string>(5) Correction</string>
247247
</property>
248248
</widget>
249249
</item>

app/qtapp/rtknavi_qt/mondlg.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,10 +1586,10 @@ void MonitorDialog::setStream()
15861586
header << tr("STR") << tr("Stream") << tr("Type") << tr("Format") << tr("Mode") << tr("State") << tr("Input (bytes)") << tr("Input (bps)")
15871587
<< tr("Output (bytes)") << tr("Output (bps)") << tr("Path") << tr("Message");
15881588

1589-
int i, width[] = {40, 150, 120, 110, 50, 50, 140, 140, 140, 140, 220, 220};
1589+
int i, width[] = {45, 170, 120, 150, 60, 55, 120, 110, 135, 120, 220, 220};
15901590

15911591
ui->tWConsole->setColumnCount(12);
1592-
ui->tWConsole->setRowCount(9);
1592+
ui->tWConsole->setRowCount(MAXSTRRTK + 1);
15931593
ui->tWConsole->setHorizontalHeaderLabels(header);
15941594

15951595
for (i = 0; i < ui->tWConsole->columnCount(); i++)
@@ -1604,9 +1604,10 @@ void MonitorDialog::setStream()
16041604
//---------------------------------------------------------------------------
16051605
void MonitorDialog::showStream()
16061606
{
1607-
const QString ch[] = {
1608-
tr("Input Rover"), tr("Input Base"), tr("Input Correction"), tr("Output Solution 1"),
1609-
tr("Output Solution 2"), tr("Log Rover"), tr("Log Base"), tr("Log Correction"),
1607+
const QString ch[MAXSTRRTK + 1] = {
1608+
tr("Input Rover"), tr("Input Base"), tr("Input Correction"),
1609+
tr("Log Rover"), tr("Log Base"), tr("Log Correction"),
1610+
tr("Output Solution 1"), tr("Output Solution 2"), tr("Output Solution 3"),
16101611
tr("Monitor")
16111612
};
16121613
const QString type[] = {
@@ -1619,26 +1620,26 @@ void MonitorDialog::showStream()
16191620
tr("Solution stats"), tr("GSI F1/F2")};
16201621
const QString state[] = {tr("Error"), tr("-"), tr("OK")};
16211622
QString mode, form;
1622-
stream_t stream[9];
1623-
int i, format[9] = {0};
1623+
stream_t stream[MAXSTRRTK + 1];
1624+
int i, format[MAXSTRRTK + 1] = {0};
16241625
char path[MAXSTRPATH] = "", *p, *q;
16251626

16261627
rtksvrlock(rtksvr); // lock
1627-
for (i = 0; i < 8; i++) stream[i] = rtksvr->stream[i];
1628+
for (i = 0; i < MAXSTRRTK; i++) stream[i] = rtksvr->stream[i];
16281629
for (i = 0; i < 3; i++) format[i] = rtksvr->format[i];
1629-
for (i = 3; i < 5; i++) format[i] = rtksvr->solopt[i - 3].posf;
1630-
stream[8] = *monistr;
1631-
format[8] = SOLF_LLH;
1630+
for (i = 0; i < RTKSVRNSOL; i++) format[6+i] = rtksvr->solopt[i].posf;
1631+
stream[MAXSTRRTK] = *monistr;
1632+
format[MAXSTRRTK] = SOLF_LLH;
16321633
rtksvrunlock(rtksvr); // unlock
16331634

1634-
for (i = 0; i < 9; i++) {
1635+
for (i = 0; i < MAXSTRRTK + 1; i++) {
16351636
int j = 0;
16361637
ui->tWConsole->item(i, j++)->setText(QString("(%1)").arg(i+1));
16371638
ui->tWConsole->item(i, j++)->setText(ch[i]);
16381639
ui->tWConsole->item(i, j++)->setText(type[stream[i].type]);
16391640
if (!stream[i].type) form = "-";
16401641
else if (i < 3) form = formatstrs[format[i]];
1641-
else if (i < 5 || i == 8) form = outformat[format[i]];
1642+
else if (i >= 6) form = outformat[format[i]];
16421643
else form = "-";
16431644
ui->tWConsole->item(i, j++)->setText(form);
16441645
if (stream[i].mode & STR_MODE_R) mode = tr("R"); else mode = "";

0 commit comments

Comments
 (0)