@@ -156,6 +156,8 @@ static const char *helptxt[]={
156156 "error : show error/warning messages" ,
157157 "option [opt] : show option(s)" ,
158158 "set opt [val] : set option" ,
159+ "mark [name] [comment] : log a marker" ,
160+ "mode ['g'|'s'|'f'|n] : set the processing mode" ,
159161 "load [file] : load options from file" ,
160162 "save [file] : save options to file" ,
161163 "log [file|off] : start/stop log to file" ,
@@ -1247,6 +1249,83 @@ static void cmd_set(char **args, int narg, vt_t *vt)
12471249 }
12481250 vt_printf (vt ,"\n" );
12491251}
1252+ /* Mark command ------------------------------------------------------------*/
1253+ static void cmd_mark (char * * args , int narg , vt_t * vt )
1254+ {
1255+ trace (3 ,"cmd_mark:\n" );
1256+
1257+ // Remember the marker name so that it can be repeated, and default
1258+ // to replacement by a counter.
1259+ static int nmarker = 1 ;
1260+ static char markername [128 ] = "%r" ;
1261+ char markercomment [256 ] = {0 };
1262+
1263+ if (narg > 1 )
1264+ snprintf (markername , sizeof (markername ), "%s" , args [1 ]);
1265+ if (narg > 2 )
1266+ snprintf (markercomment , sizeof (markercomment ), "%s" , args [2 ]);
1267+
1268+ char nmarker_str [32 ];
1269+ snprintf (nmarker_str , sizeof (nmarker_str ), "%03d" , nmarker );
1270+ nmarker ++ ;
1271+ char markername_rep [1024 ];
1272+ reppath (markername , markername_rep , utc2gpst (timeget ()), nmarker_str , "" );
1273+ rtksvrmark (& svr , markername_rep , markercomment );
1274+
1275+ vt_printf (vt , "%-28s: %s %s\n" , "mark" , markername_rep , markercomment );
1276+ }
1277+ /* Mode command --------------------------------------------------------------*/
1278+ static void cmd_mode (char * * args , int narg , vt_t * vt ) {
1279+ const char * mode [] = {"single" , "DGPS" , "kinematic" , "static" , "static-start" ,
1280+ "moving-base" , "fixed" , "PPP-kinematic" , "PPP-static" };
1281+
1282+ trace (3 , "cmd_mode:\n" );
1283+
1284+ int current_pmode = svr .rtk .opt .mode ;
1285+
1286+ if (narg < 2 ) {
1287+ vt_printf (vt , "%-28s: %s\n" , "positioning mode" , mode [current_pmode ]);
1288+ return ;
1289+ }
1290+
1291+ rtksvrlock (& svr );
1292+ int pmode = svr .rtk .opt .mode ;
1293+ rtksvrunlock (& svr );
1294+
1295+ if (args [1 ][0 ] == 'G' || args [1 ][0 ] == 'g' ) {
1296+ // Go
1297+ if (pmode == PMODE_KINEMA || pmode == PMODE_STATIC || pmode == PMODE_STATIC_START || pmode == PMODE_FIXED )
1298+ pmode = PMODE_KINEMA ;
1299+ else if (pmode == PMODE_PPP_KINEMA || pmode == PMODE_PPP_STATIC || pmode == PMODE_PPP_FIXED )
1300+ pmode = PMODE_PPP_KINEMA ;
1301+ } else if (args [1 ][0 ] == 'S' || args [1 ][0 ] == 's' ) {
1302+ // Stop
1303+ if (pmode == PMODE_KINEMA || pmode == PMODE_STATIC || pmode == PMODE_STATIC_START || pmode == PMODE_FIXED )
1304+ pmode = PMODE_STATIC ;
1305+ else if (pmode == PMODE_PPP_KINEMA || pmode == PMODE_PPP_STATIC || pmode == PMODE_PPP_FIXED )
1306+ pmode = PMODE_PPP_KINEMA ;
1307+ } else if (args [1 ][0 ] == 'F' || args [1 ][0 ] == 'f' ) {
1308+ // Fixed
1309+ if (pmode == PMODE_KINEMA || pmode == PMODE_STATIC || pmode == PMODE_STATIC_START || pmode == PMODE_FIXED )
1310+ pmode = PMODE_FIXED ;
1311+ else if (pmode == PMODE_PPP_KINEMA || pmode == PMODE_PPP_STATIC || pmode == PMODE_PPP_FIXED )
1312+ pmode = PMODE_PPP_FIXED ;
1313+ } else if (sscanf (args [1 ], "%d" , & pmode ) < 1 ) {
1314+ vt_printf (vt , "invalid processing mode: %s\n" , args [1 ]);
1315+ return ;
1316+ }
1317+
1318+ if (pmode < PMODE_SINGLE || pmode > PMODE_PPP_FIXED ) {
1319+ vt_printf (vt , "unexpected processing mode: %d\n" , pmode );
1320+ return ;
1321+ }
1322+
1323+ rtksvrlock (& svr );
1324+ svr .rtk .opt .mode = pmode ;
1325+ rtksvrunlock (& svr );
1326+
1327+ vt_printf (vt , "%-28s: %s\n" , "positioning mode" , mode [pmode ]);
1328+ }
12501329/* load command --------------------------------------------------------------*/
12511330static void cmd_load (char * * args , int narg , vt_t * vt )
12521331{
@@ -1341,8 +1420,8 @@ static void *con_thread(void *arg)
13411420{
13421421 const char * cmds []= {
13431422 "start" ,"stop" ,"restart" ,"solution" ,"status" ,"satellite" ,"observ" ,
1344- "navidata" ,"stream" ,"ssr" ,"error" ,"option" ,"set" ,"load" , "save" , "log" ,
1345- "help" ,"?" ,"exit" ,"shutdown" ,""
1423+ "navidata" ,"stream" ,"ssr" ,"error" ,"option" ,"set" ,
1424+ "mark" , "mode" , "load" , "save" , "log" , " help" ,"?" ,"exit" ,"shutdown" ,""
13461425 };
13471426 con_t * con = (con_t * )arg ;
13481427 int i ,j ,narg ;
@@ -1401,15 +1480,17 @@ static void *con_thread(void *arg)
14011480 case 10 : cmd_error (args ,narg ,con -> vt ); break ;
14021481 case 11 : cmd_option (args ,narg ,con -> vt ); break ;
14031482 case 12 : cmd_set (args ,narg ,con -> vt ); break ;
1404- case 13 : cmd_load (args ,narg ,con -> vt ); break ;
1405- case 14 : cmd_save (args ,narg ,con -> vt ); break ;
1406- case 15 : cmd_log (args ,narg ,con -> vt ); break ;
1407- case 16 : cmd_help (args ,narg ,con -> vt ); break ;
1408- case 17 : cmd_help (args ,narg ,con -> vt ); break ;
1409- case 18 : /* exit */
1483+ case 13 : cmd_mark (args ,narg ,con -> vt ); break ;
1484+ case 14 : cmd_mode (args ,narg ,con -> vt ); break ;
1485+ case 15 : cmd_load (args ,narg ,con -> vt ); break ;
1486+ case 16 : cmd_save (args ,narg ,con -> vt ); break ;
1487+ case 17 : cmd_log (args ,narg ,con -> vt ); break ;
1488+ case 18 : cmd_help (args ,narg ,con -> vt ); break ;
1489+ case 19 : cmd_help (args ,narg ,con -> vt ); break ;
1490+ case 20 : /* exit */
14101491 if (con -> vt -> type ) con -> state = 0 ;
14111492 break ;
1412- case 19 : /* shutdown */
1493+ case 21 : /* shutdown */
14131494 if (!strcmp (args [0 ],"shutdown" )) {
14141495 vt_printf (con -> vt ,"rtk server shutdown ...\n" );
14151496 sleepms (1000 );
@@ -1634,6 +1715,15 @@ static void deamonise(void)
16341715* prompt message is shown to input the value. The change of the
16351716* processing option is not enabled before RTK server is restarted.
16361717*
1718+ * mark [name] [comment]
1719+ * Log a marker.
1720+ *
1721+ * mode ['g'|'s'|'f'|n]
1722+ * Set the processing mode. Either 'g' or 'go' for kinematic mode,
1723+ * 's' or 'stop' for static mode or 'f' or 'fixed' for fixed mode.
1724+ * An internal mode number is also accepted but not all mode changes
1725+ * are smoothly handled.
1726+ *
16371727* load [file]
16381728* Load processing options from file. Without option, default file
16391729* rtkrcv.conf is used. To enable the changes, restart RTK server.
0 commit comments