diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | gpsd.c | 44 | ||||
-rw-r--r-- | gpsd.spec.in | 5 | ||||
-rw-r--r-- | gpsd.xml | 16 |
4 files changed, 53 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac index 3430ce2c..bbd34ebe 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT -AM_INIT_AUTOMAKE(gpsd, 2.29) +AM_INIT_AUTOMAKE(gpsd, 2.30) AC_PREFIX_PROGRAM(gcc) AM_CONFIG_HEADER(config.h) AC_LANG([C]) @@ -287,9 +287,7 @@ static struct subscriber_t { bool tied; /* client set device with F */ bool watcher; /* is client in watcher mode? */ int raw; /* is client in raw mode? */ -#ifdef RTCM104_SERVICE - bool rtcm; /* is RTCM what he actually wants? */ -#endif /* RTCM104_SERVICE */ + enum {GPS,RTCM104,ANY} requires; /* type of device requested */ /*@relnull@*/struct gps_device_t *device; /* device subscriber listens to */ } subscribers[FD_SETSIZE]; /* indexed by client file descriptor */ @@ -413,10 +411,17 @@ static bool allocation_policy(struct gps_device_t *channel, /* maybe we have already bound a more recently active device */ if (user->device!=NULL && channel->gpsdata.sentence_time < most_recent) return false; -#ifdef RTCM104_SERVICE - if (user->rtcm == (channel->packet_type == RTCM_PACKET)) + gpsd_report(1, "User requires %d, channel type is %d\n", user->requires, channel->packet_type); + /* we might have type constraints */ + if (user->requires == ANY) + return true; + else if (user->requires==RTCM104 && (channel->packet_type==RTCM_PACKET)) + return true; + else if (user->requires == GPS + && (channel->packet_type!=RTCM_PACKET) && (channel->packet_type!=BAD_PACKET)) + return true; + else return false; -#endif /* RTCM104_SERVICE */ return true; } @@ -629,6 +634,25 @@ static int handle_gpsd_request(int cfd, char *buf, int buflen) else (void)strcpy(phrase, ",F=?"); break; + case 'G': + if (*p == '=') { + gpsd_report(1,"<= client(%d): requesting data type %s\n",cfd,++p); + if (strncasecmp(p, "rtcm104", 7) == 0) + whoami->requires = RTCM104; + else if (strncasecmp(p, "gps", 3) == 0) + whoami->requires = GPS; + else + whoami->requires = ANY; + p += strcspn(p, ",\r\n"); + } + (void)assign_channel(whoami); + if (whoami->device==NULL||whoami->device->packet_type==BAD_PACKET) + (void)strcpy(phrase, ",G=?"); + else if (whoami->device->packet_type == RTCM_PACKET) + (void)snprintf(phrase, sizeof(phrase), ",G=RTCM104"); + else + (void)snprintf(phrase, sizeof(phrase), ",G=GPS"); + break; case 'I': if (assign_channel(whoami) && whoami->device->device_type!=NULL) (void)snprintf(phrase, sizeof(phrase), ",I=%s", @@ -650,7 +674,7 @@ static int handle_gpsd_request(int cfd, char *buf, int buflen) phrase[strlen(phrase)-1] = '\0'; break; case 'L': - (void)snprintf(phrase, sizeof(phrase), ",L=2 " VERSION " abcdefiklmnopqrstuvwxyz"); //ghj + (void)snprintf(phrase, sizeof(phrase), ",L=2 " VERSION " abcdefgiklmnopqrstuvwxyz"); //hj break; case 'M': if (!assign_channel(whoami) && (!whoami->device || whoami->device->gpsdata.fix.mode == MODE_NOT_SEEN)) @@ -1300,9 +1324,7 @@ int main(int argc, char *argv[]) FD_SET(ssock, &all_fds); subscribers[ssock].active = timestamp(); subscribers[ssock].tied = false; -#ifdef RTCM104_SERVICE - subscribers[ssock].rtcm = false; -#endif /* RTCM104_SERVICE */ + subscribers[ssock].requires = ANY; } FD_CLR(msock, &rfds); } @@ -1324,7 +1346,7 @@ int main(int argc, char *argv[]) FD_SET(ssock, &all_fds); subscribers[rsock].active = true; subscribers[rsock].tied = false; - subscribers[rsock].rtcm = true; + subscribers[rsock].requires = RTCM104; } FD_CLR(nsock, &rfds); } diff --git a/gpsd.spec.in b/gpsd.spec.in index e1c20edb..5648de42 100644 --- a/gpsd.spec.in +++ b/gpsd.spec.in @@ -140,10 +140,11 @@ cp gps.py gpsfake.py "$RPM_BUILD_ROOT"%{_libdir}/python${PYVERSION}/site-package %{_libdir}/X11/app-defaults/xgpsspeed %changelog -* Sat Aug 20 2005 Eric S. Raymond <esr@snark.thyrsus.com> - @VERSION@-1 +* Wed Sep 14 2005 Eric S. Raymond <esr@snark.thyrsus.com> - @VERSION@-1 - Prevent core dump on -d option. The .log option is no longer required for test loads. cgps and xgps now have configurable latitude/longitude formats - via the -l option. + via the -l option. Introduced new 'g' command that allows clients to + specify whether they want GPS or RTCM104 information. * Fri Aug 19 2005 Eric S. Raymond <esr@snark.thyrsus.com> - 2.29-1 - Added Sony CXD2951 support, untested. All error estimates are @@ -284,6 +284,22 @@ client was attached, and multiple devices were not supported.)</para> </varlistentry> <varlistentry> +<term>g</term> +<listitem> +<para>With =, accepts a single argument which may have either of the +values 'gps' or 'rtcm104', with case ignored. This specifies the +type of information the client wants and forces a device assignment. +Without =, forces a device assignment but doesn't force the type. +This command is optional; if it is not given, the client will be +bound to whatever available device the daemon finds first.</para> + +<para>This command returns either '?' if no device of the specified +type(s) could be assigned, otherwise a string ('GPS' or 'RTCM104') +identifying the kind of information the attached device returns.</para> +</listitem> +</varlistentry> + +<varlistentry> <term>i</term> <listitem><para>Returns a text string identifying the GPS. The string may contain spaces and is terminated by CR-LF. This command will |