diff options
author | Chris Kuethe <chris.kuethe@gmail.com> | 2009-07-04 21:46:26 +0000 |
---|---|---|
committer | Chris Kuethe <chris.kuethe@gmail.com> | 2009-07-04 21:46:26 +0000 |
commit | bf951f8b844ddec9fcfabed6380b03f5bbb40444 (patch) | |
tree | c45c4e1e27c3fd5419d5b06cab48f9ce07348413 | |
parent | 330725e9464de9e9707dea8e6eb776649f494962 (diff) | |
download | gpsd-bf951f8b844ddec9fcfabed6380b03f5bbb40444.tar.gz |
change the dgnss_ prefix to netgnss_
this more accurately reflects that this is now becoming a generic
network gnss interface
-rw-r--r-- | gpsd.c | 14 | ||||
-rw-r--r-- | gpsd.h-tail | 14 | ||||
-rw-r--r-- | libgpsd_core.c | 2 | ||||
-rw-r--r-- | net_dgpsip.c | 4 | ||||
-rw-r--r-- | net_gnss_dispatch.c | 47 | ||||
-rw-r--r-- | net_ntrip.c | 8 |
6 files changed, 48 insertions, 41 deletions
@@ -120,10 +120,10 @@ static struct gps_context_t context = { .valid = 0, .readonly = false, .sentdgps = false, - .dgnss_service = dgnss_none, + .netgnss_service = netgnss_none, .fixcnt = 0, .dsock = -1, - .dgnss_privdata = NULL, + .netgnss_privdata = NULL, .rtcmbytes = 0, .rtcmbuf = {'\0'}, .rtcmtime = 0, @@ -541,9 +541,9 @@ static /*@null@*/ struct gps_device_t *open_device(char *device_name) { struct gps_device_t *chp; - /* special case: source may be a URL to differential-GPS service */ - if (dgnss_url(device_name)) { - int dsock = dgnss_open(&context, device_name); + /* special case: source may be a URI to a remote GNSS or DGPS service */ + if (netgnss_uri_check(device_name)) { + int dsock = netgnss_uri_open(&context, device_name); if (dsock >= 0) { FD_SET(dsock, &all_fds); adjust_max_fd(dsock, true); @@ -1787,7 +1787,7 @@ int main(int argc, char *argv[]) if (context.dsock >= 0 && FD_ISSET(context.dsock, &rfds)) { /* be ready for DGPS reports */ - if (dgnss_poll(&context) == -1){ + if (netgnss_poll(&context) == -1){ FD_CLR(context.dsock, &all_fds); FD_CLR(context.dsock, &rfds); context.dsock = -1; @@ -1907,7 +1907,7 @@ int main(int argc, char *argv[]) if (context.fixcnt > 0 && context.dsock == -1) { for (channel=channels; channel < channels+MAXDEVICES; channel++) { if (channel->gpsdata.fix.mode > MODE_NO_FIX) { - dgnss_autoconnect(&context, + netgnss_autoconnect(&context, channel->gpsdata.fix.latitude, channel->gpsdata.fix.longitude); break; diff --git a/gpsd.h-tail b/gpsd.h-tail index 663c6237..e73bcccc 100644 --- a/gpsd.h-tail +++ b/gpsd.h-tail @@ -139,10 +139,10 @@ struct gps_context_t { #define LEAP_SECOND_VALID 0x01 /* we have or don't need correction */ /* DGPSIP status */ bool sentdgps; /* have we sent a DGPS report? */ - enum { dgnss_none, dgnss_dgpsip, dgnss_ntrip } dgnss_service; /* type of DGNSS service */ + enum { netgnss_none, netgnss_dgpsip, netgnss_ntrip } netgnss_service; /* type of DGNSS service */ int fixcnt; /* count of good fixes seen */ int dsock; /* socket to DGPSIP server/Ntrip caster */ - void *dgnss_privdata; /* DGNSS service specific data */ + void *netgnss_privdata; /* DGNSS service specific data */ ssize_t rtcmbytes; /* byte count of last RTCM104 report */ char rtcmbuf[RTCM_MAX]; /* last RTCM104 report */ double rtcmtime; /* timestamp of last RTCM104 report */ @@ -381,11 +381,11 @@ extern gps_mask_t garmin_ser_parse(struct gps_device_t *); extern gps_mask_t garmintxt_parse(struct gps_device_t *); extern gps_mask_t aivdm_parse(struct gps_device_t *); -extern bool dgnss_url(char *); -extern int dgnss_open(struct gps_context_t *, char *); -extern int dgnss_poll(struct gps_context_t *); -extern void dgnss_report(struct gps_device_t *); -extern void dgnss_autoconnect(struct gps_context_t *, double, double); +extern bool netgnss_uri_check(char *); +extern int netgnss_uri_open(struct gps_context_t *, char *); +extern int netgnss_poll(struct gps_context_t *); +extern void netgnss_report(struct gps_device_t *); +extern void netgnss_autoconnect(struct gps_context_t *, double, double); extern void rtcm_relay(struct gps_device_t *); extern void rtcm2_output_mag(isgps30bits_t *, FILE *); diff --git a/libgpsd_core.c b/libgpsd_core.c index b8a94470..73fcf60a 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -820,7 +820,7 @@ cycle+1){ } if (session->gpsdata.fix.mode == MODE_3D) - dgnss_report(session); + netgnss_report(session); return session->gpsdata.set; } diff --git a/net_dgpsip.c b/net_dgpsip.c index 15962dd5..9e5ab3dd 100644 --- a/net_dgpsip.c +++ b/net_dgpsip.c @@ -1,5 +1,5 @@ /* $Id$ */ -/* dgpsip.c -- gather and dispatch DGPS data from DGPSIP servers */ +/* net_dgpsip.c -- gather and dispatch DGPS data from DGPSIP servers */ #include <sys/types.h> #ifndef S_SPLINT_S #include <sys/socket.h> @@ -38,7 +38,7 @@ int dgpsip_open(struct gps_context_t *context, const char *dgpsserver) /* greeting required by some RTCM104 servers; others will ignore it */ (void)snprintf(buf,sizeof(buf), "HELO %s gpsd %s\r\nR\r\n",hn,VERSION); if (write(context->dsock, buf, strlen(buf)) == (ssize_t)strlen(buf)) - context->dgnss_service = dgnss_dgpsip; + context->netgnss_service = netgnss_dgpsip; else gpsd_report(LOG_ERROR, "hello to DGPS server %s failed\n", dgpsserver); } else diff --git a/net_gnss_dispatch.c b/net_gnss_dispatch.c index b2ca450e..bfba6949 100644 --- a/net_gnss_dispatch.c +++ b/net_gnss_dispatch.c @@ -1,5 +1,5 @@ /* $Id$ */ -/* dgnss.c -- common interface to a number of Differential GNSS services */ +/* net_gnss_dispatch.c -- common interface to a number of Network GNSS services */ #include <sys/types.h> #ifndef S_SPLINT_S @@ -12,44 +12,51 @@ #include "gpsd_config.h" #include "gpsd.h" -#define DGNSS_PROTO_DGPSIP "dgpsip://" -#define DGNSS_PROTO_NTRIP "ntrip://" +#define NETGNSS_DGPSIP "dgpsip://" +#define NETGNSS_NTRIP "ntrip://" +#define NETGNSS_GPSD "gpsd://" /* Where to find the list of DGPSIP correction servers, if there is one */ #define DGPSIP_SERVER_LIST "/usr/share/gpsd/dgpsip-servers" -bool dgnss_url(char *name) -/* is given string a valid URL for DGPS service? */ +bool netgnss_uri_check(char *name) +/* is given string a valid URI for GNSS/DGPS service? */ { return - strncmp(name,DGNSS_PROTO_NTRIP,strlen(DGNSS_PROTO_NTRIP))==0 - || strncmp(name,DGNSS_PROTO_DGPSIP,strlen(DGNSS_PROTO_DGPSIP))==0; + strncmp(name, NETGNSS_NTRIP, strlen(NETGNSS_NTRIP)) == 0 + || strncmp(name, NETGNSS_GPSD, strlen(NETGNSS_GPSD)) == 0 + || strncmp(name, NETGNSS_DGPSIP, strlen(NETGNSS_DGPSIP)) == 0; } /*@ -branchstate */ -int dgnss_open(struct gps_context_t *context, char *dgnss_service) +int netgnss_uri_open(struct gps_context_t *context, char *netgnss_service) /* open a connection to a DGNSS service */ { #ifdef NTRIP_ENABLE - if (strncmp(dgnss_service,DGNSS_PROTO_NTRIP,strlen(DGNSS_PROTO_NTRIP))==0) - return ntrip_open(context, dgnss_service + strlen(DGNSS_PROTO_NTRIP)); + if (strncmp(netgnss_service, NETGNSS_NTRIP, strlen(NETGNSS_NTRIP))==0) + return ntrip_open(context, netgnss_service + strlen(NETGNSS_NTRIP)); #endif - if (strncmp(dgnss_service,DGNSS_PROTO_DGPSIP,strlen(DGNSS_PROTO_DGPSIP))==0) - return dgpsip_open(context, dgnss_service + strlen(DGNSS_PROTO_DGPSIP)); + if (strncmp(netgnss_service, NETGNSS_DGPSIP, strlen(NETGNSS_DGPSIP))==0) + return dgpsip_open(context, netgnss_service + strlen(NETGNSS_DGPSIP)); + +#if 0 + if (strncmp(netgnss_service, NETGNSS_GPSD, strlen(NETGNSS_GPSD))==0) + return remotegpsd_open(context, netgnss_service + strlen(NETGNSS_GPSD)); +#endif #ifndef REQUIRE_DGNSS_PROTO - return dgpsip_open(context, dgnss_service); + return dgpsip_open(context, netgnss_service); #else gpsd_report(LOG_ERROR, "Unknown or unspecified DGNSS protocol for service %s\n", - dgnss_service); + netgnss_service); return -1; #endif } /*@ +branchstate */ -int dgnss_poll(struct gps_context_t *context) +int netgnss_poll(struct gps_context_t *context) /* poll the DGNSS service for a correction report */ { if (context->dsock > -1) { @@ -65,20 +72,20 @@ int dgnss_poll(struct gps_context_t *context) return 0; } -void dgnss_report(struct gps_device_t *session) +void netgnss_report(struct gps_device_t *session) /* may be time to ship a usage report to the DGNSS service */ { - if (session->context->dgnss_service == dgnss_dgpsip) + if (session->context->netgnss_service == netgnss_dgpsip) dgpsip_report(session); #ifdef NTRIP_ENABLE - else if (session->context->dgnss_service == dgnss_ntrip) + else if (session->context->netgnss_service == netgnss_ntrip) ntrip_report(session); #endif } -void dgnss_autoconnect(struct gps_context_t *context, double lat, double lon) +void netgnss_autoconnect(struct gps_context_t *context, double lat, double lon) { - if (context->dgnss_service != dgnss_ntrip) { + if (context->netgnss_service != netgnss_ntrip) { dgpsip_autoconnect(context, lat, lon, DGPSIP_SERVER_LIST); } } diff --git a/net_ntrip.c b/net_ntrip.c index 441e8319..9cb5d569 100644 --- a/net_ntrip.c +++ b/net_ntrip.c @@ -1,5 +1,5 @@ /* $Id$ */ -/* ntrip.c -- gather and dispatch DGNSS data from Ntrip broadcasters */ +/* net_ntrip.c -- gather and dispatch DGNSS data from Ntrip broadcasters */ #include <sys/types.h> #ifndef S_SPLINT_S #include <sys/socket.h> @@ -384,9 +384,9 @@ static int ntrip_stream_open(const char *caster, if (opts >= 0) (void)fcntl(context->dsock, F_SETFL, opts | O_NONBLOCK); - context->dgnss_service = dgnss_ntrip; + context->netgnss_service = netgnss_ntrip; #ifndef S_SPLINT_S - context->dgnss_privdata = stream; + context->netgnss_privdata = stream; #endif return context->dsock; close: @@ -454,7 +454,7 @@ int ntrip_open(struct gps_context_t *context, char *caster) void ntrip_report(struct gps_device_t *session) /* may be time to ship a usage report to the Ntrip caster */ { - struct ntrip_stream_t *stream = session->context->dgnss_privdata; + struct ntrip_stream_t *stream = session->context->netgnss_privdata; /* * 10 is an arbitrary number, the point is to have gotten several good * fixes before reporting usage to our Ntrip caster. |