|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
[PATCH 2.34] gpspipe file output optionHi gpsd developers,
this patch adds a file output option to gpspipe. So instead of: gpspipe -r >> ~.wine/dosdevices/com3 You can now say: gpspipe -r -f ~.wine/dosdevices/com3 This patch is one step towards an enhanced version of gpspipe, that not only outputs NMEA sentences, but NMEA+TMC=GNS 1.0. I'am aware, that RDS-TMC support was already discussed multiple times on the gpsd mailing lists. Nevertheless I'm going to implement this at least for my own pleasure. But if there is still interest in it, I can post it on the gpsd mailing list, as soon as it's finished. Different from my solution of enhancing gpspipe, the discussions in the past covered an enhancement of gpsd itself. And I agree, that this is not the right place to implement RDS-TMC support. But I see gpspipe (or name it gpspipe-tmc) as the right place. The GNS1.0 protocol itself is very easy, as it looks almost like NMEA with inserted RDS-TMC groups enclosed as following: ?...? Next I'm going to prepare and post a patch on the rds mailing list, that outputs only the rds blocks that contain tmc groups to a file/fifo. This patch will almost be identical to the one below. So this here was the first exercise. gpspipe-tmc will then read these rds-tmc blocks and insert it enclosed in the NMEA output stream. That's all. :-) Then you can use any gps receiver supported by gpsd and it doesn't need to be NMEA and together with an RDS-supporting radio, like the Silicon Laboratories USB Radio reference design with the si4701, you can use your preferred wine/navigation program with gps+tmc support. Bye, Toby Signed-off-by: Tobias Lorenz <tobias.lorenz@...> --- gpspipe.c.orig 2006-12-15 00:43:39.000000000 +0100 +++ gpspipe.c 2008-01-23 19:56:08.000000000 +0100 @@ -90,6 +90,7 @@ static void usage(void) "-j Turn on server-side buffering.\n" "-t Time stamp the data.\n" "-s [serial dev] emulate a 4800bps NMEA GPS on serial port (use with '-r').\n" + "-f [filename] output data to file or fifo.\n" "-n [count] exit after count packets.\n" "-v Print a little spinner.\n" "-V Print version and exit.\n\n" @@ -111,9 +112,10 @@ int main( int argc, char **argv) char *arg = NULL, *colon1, *colon2, *device = NULL; char *port = DEFAULT_GPSD_PORT, *server = "127.0.0.1"; char *serialport = NULL; + char *outfile = NULL; buf[0] = '\0'; - while ((option = getopt(argc, argv, "?hrRwjtvVn:s:")) != -1) { + while ((option = getopt(argc, argv, "?hrRwjtvVn:s:f:")) != -1) { switch (option) { case 'n': count = strtol(optarg, 0, 0); @@ -142,6 +144,9 @@ int main( int argc, char **argv) case 's': serialport = optarg; break; + case 'f': + outfile = optarg; + break; case '?': case 'h': default: @@ -159,6 +164,12 @@ int main( int argc, char **argv) (void)fprintf(stderr, "gpspipe: one of '-R', '-r' or '-w' is required.\n"); exit(1); } + + if ((serialport != NULL) && (outfile != NULL)) { + (void)fprintf(stderr, "gpspipe: use either '-s' or '-f'.\n"); + exit(1); + } + /* Grok the server, port, and device. */ /*@ -branchstate @*/ if (optind < argc) { @@ -190,6 +201,14 @@ int main( int argc, char **argv) if (serialport) open_serial(serialport); + /* Open the serial port and set it up. */ + if (outfile) { + if ((fd_out = open(outfile, O_RDWR|O_NOCTTY)) < 0) { + fprintf(stderr, "gpspipe: error opening output file %s\n", outfile); + exit(1); + } + } + /*@ -nullpass @*/ sock = netlib_connectsock( server, port, "tcp"); if (sock < 0) { @@ -240,7 +259,7 @@ int main( int argc, char **argv) } if (c == '\n') { - if (serialport != NULL) { + if ((serialport != NULL) || (outfile != NULL)) { if (write(fd_out, serbuf, (size_t)j) == -1) { fprintf(stderr, "gpspipe: Serial port write Error, %s(%d)\n", _______________________________________________ Gpsd-dev mailing list Gpsd-dev@... https://lists.berlios.de/mailman/listinfo/gpsd-dev |
| Free embeddable forum powered by Nabble | Forum Help |