Skip to content

Commit f6ceaa9

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 5ad3a28 commit f6ceaa9

File tree

20 files changed

+820
-485
lines changed

20 files changed

+820
-485
lines changed

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,
@@ -989,35 +1006,34 @@ static void prerror(vt_t *vt)
9891006
static void prstream(vt_t *vt)
9901007
{
9911008
const char *ch[]={
992-
"input rover","input base","input corr","output sol1","output sol2",
993-
"log rover","log base","log corr","monitor"
994-
};
1009+
"input rover","input base","input corr","log rover","log base","log corr"};
9951010
const char *type[]={
9961011
"-","serial","file","tcpsvr","tcpcli","ntrips","ntripc","ftp",
9971012
"http","ntripcas","udpsvr","udpcli","membuf"
9981013
};
9991014
const char *fmt[]={"rtcm2","rtcm3","oem4","","ubx","swift","hemis","skytreq",
10001015
"javad","nvs","binex","rt17","sbf","","unicore","sp3",""};
10011016
const char *sol[]={"llh","xyz","enu","nmea","stat","-"};
1002-
stream_t stream[9];
1003-
int i,format[9]={0};
1017+
stream_t stream[MAXSTRRTK+1];
1018+
int i,format[MAXSTRRTK+1]={0};
10041019

10051020
trace(4,"prstream:\n");
10061021

10071022
rtksvrlock(&svr);
1008-
for (i=0;i<8;i++) stream[i]=svr.stream[i];
1023+
for (i=0;i<MAXSTRRTK;i++) stream[i]=svr.stream[i];
10091024
for (i=0;i<3;i++) format[i]=svr.format[i];
1010-
for (i=3;i<5;i++) format[i]=svr.solopt[i-3].posf;
1011-
stream[8]=moni;
1012-
format[8]=SOLF_LLH;
1025+
for (i=0;i<RTKSVRNSOL;i++) format[6+i]=svr.solopt[i].posf;
1026+
stream[MAXSTRRTK]=moni;
1027+
format[MAXSTRRTK]=SOLF_LLH;
10131028
rtksvrunlock(&svr);
10141029

10151030
vt_printf(vt,"\n%s%-12s %-8s %-5s %s %10s %7s %10s %7s %-24s %s%s\n",ESC_BOLD,
10161031
"Stream","Type","Fmt","S","In-byte","In-bps","Out-byte","Out-bps",
10171032
"Path","Message",ESC_RESET);
1018-
for (i=0;i<9;i++) {
1033+
for (i=0;i<MAXSTRRTK+1;i++) {
1034+
const char *name = i < 6 ? ch[i] : i >= MAXSTRRTK ? "monitor" : "output sol";
10191035
vt_printf(vt,"%-12s %-8s %-5s %s %10d %7d %10d %7d %-24.24s %s\n",
1020-
ch[i],type[stream[i].type],i<3?fmt[format[i]]:(i<5||i==8?sol[format[i]]:"-"),
1036+
name,type[stream[i].type],i<3?fmt[format[i]]:(i>=6?sol[format[i]]:"-"),
10211037
stream[i].state<0?"E":(stream[i].state?"C":"-"),
10221038
stream[i].inb,stream[i].inr,stream[i].outb,stream[i].outr,
10231039
stream[i].path,stream[i].msg);
@@ -1283,7 +1299,7 @@ static void cmd_set(char **args, int narg, vt_t *vt)
12831299
return;
12841300
}
12851301
getsysopts(&prcopt,solopt,&filopt);
1286-
solopt[1]=solopt[0];
1302+
for (int i = 1; i < RTKSVRNSOL; i++) solopt[i] = solopt[0];
12871303

12881304
vt_printf(vt,"option %s changed.",opt->name);
12891305
if (strncmp(opt->name,"console",7)) {
@@ -1388,7 +1404,7 @@ static void cmd_load(char **args, int narg, vt_t *vt)
13881404
return;
13891405
}
13901406
getsysopts(&prcopt,solopt,&filopt);
1391-
solopt[1]=solopt[0];
1407+
for (int i = 1; i < RTKSVRNSOL; i++) solopt[i] = solopt[0];
13921408

13931409
if (!loadopts(file,rcvopts)) {
13941410
vt_printf(vt,"no options file: %s\n",file);
@@ -1827,6 +1843,14 @@ int main(int argc, char **argv)
18271843
traceopen(TRACEFILE);
18281844
tracelevel(trace);
18291845
}
1846+
1847+
// Default input streams.
1848+
for (int i = i; i < RTKSVRNSOL; i++) {
1849+
strtype[6 + i] = STR_NONE;
1850+
strcpy(strpath[6 + i], "");
1851+
ostrfmt[i] = i == 0 ? SOLF_LLH : SOLF_NMEA;
1852+
}
1853+
18301854
/* initialize rtk server and monitor port */
18311855
rtksvrinit(&svr);
18321856
strinit(&moni);
@@ -1839,8 +1863,8 @@ int main(int argc, char **argv)
18391863
fprintf(stderr,"no options file: %s. defaults used\n",file);
18401864
}
18411865
getsysopts(&prcopt,solopt,&filopt);
1842-
/* Copy the system options for the second output solution stream */
1843-
solopt[1]=solopt[0];
1866+
/* Copy the system options for the other output solution streams */
1867+
for (int i = 1; i < RTKSVRNSOL; i++) solopt[i] = solopt[0];
18441868

18451869
/* read navigation data */
18461870
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
@@ -1575,10 +1575,10 @@ void MonitorDialog::setStream()
15751575
header << tr("STR") << tr("Stream") << tr("Type") << tr("Format") << tr("Mode") << tr("State") << tr("Input (bytes)") << tr("Input (bps)")
15761576
<< tr("Output (bytes)") << tr("Output (bps)") << tr("Path") << tr("Message");
15771577

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

15801580
ui->tWConsole->setColumnCount(12);
1581-
ui->tWConsole->setRowCount(9);
1581+
ui->tWConsole->setRowCount(MAXSTRRTK + 1);
15821582
ui->tWConsole->setHorizontalHeaderLabels(header);
15831583

15841584
for (i = 0; i < ui->tWConsole->columnCount(); i++)
@@ -1593,9 +1593,10 @@ void MonitorDialog::setStream()
15931593
//---------------------------------------------------------------------------
15941594
void MonitorDialog::showStream()
15951595
{
1596-
const QString ch[] = {
1597-
tr("Input Rover"), tr("Input Base"), tr("Input Correction"), tr("Output Solution 1"),
1598-
tr("Output Solution 2"), tr("Log Rover"), tr("Log Base"), tr("Log Correction"),
1596+
const QString ch[MAXSTRRTK + 1] = {
1597+
tr("Input Rover"), tr("Input Base"), tr("Input Correction"),
1598+
tr("Log Rover"), tr("Log Base"), tr("Log Correction"),
1599+
tr("Output Solution 1"), tr("Output Solution 2"), tr("Output Solution 3"),
15991600
tr("Monitor")
16001601
};
16011602
const QString type[] = {
@@ -1608,26 +1609,26 @@ void MonitorDialog::showStream()
16081609
tr("Solution stats"), tr("GSI F1/F2")};
16091610
const QString state[] = {tr("Error"), tr("-"), tr("OK")};
16101611
QString mode, form;
1611-
stream_t stream[9];
1612-
int i, format[9] = {0};
1612+
stream_t stream[MAXSTRRTK + 1];
1613+
int i, format[MAXSTRRTK + 1] = {0};
16131614
char path[MAXSTRPATH] = "", *p, *q;
16141615

16151616
rtksvrlock(rtksvr); // lock
1616-
for (i = 0; i < 8; i++) stream[i] = rtksvr->stream[i];
1617+
for (i = 0; i < MAXSTRRTK; i++) stream[i] = rtksvr->stream[i];
16171618
for (i = 0; i < 3; i++) format[i] = rtksvr->format[i];
1618-
for (i = 3; i < 5; i++) format[i] = rtksvr->solopt[i - 3].posf;
1619-
stream[8] = *monistr;
1620-
format[8] = SOLF_LLH;
1619+
for (i = 0; i < RTKSVRNSOL; i++) format[6+i] = rtksvr->solopt[i].posf;
1620+
stream[MAXSTRRTK] = *monistr;
1621+
format[MAXSTRRTK] = SOLF_LLH;
16211622
rtksvrunlock(rtksvr); // unlock
16221623

1623-
for (i = 0; i < 9; i++) {
1624+
for (i = 0; i < MAXSTRRTK + 1; i++) {
16241625
int j = 0;
16251626
ui->tWConsole->item(i, j++)->setText(QString("(%1)").arg(i+1));
16261627
ui->tWConsole->item(i, j++)->setText(ch[i]);
16271628
ui->tWConsole->item(i, j++)->setText(type[stream[i].type]);
16281629
if (!stream[i].type) form = "-";
16291630
else if (i < 3) form = formatstrs[format[i]];
1630-
else if (i < 5 || i == 8) form = outformat[format[i]];
1631+
else if (i >= 6) form = outformat[format[i]];
16311632
else form = "-";
16321633
ui->tWConsole->item(i, j++)->setText(form);
16331634
if (stream[i].mode & STR_MODE_R) mode = tr("R"); else mode = "";

0 commit comments

Comments
 (0)