summaryrefslogtreecommitdiff
path: root/net_gnss_dispatch.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-04-14 04:16:04 -0400
committerEric S. Raymond <esr@thyrsus.com>2010-04-14 04:16:04 -0400
commitdaeca67395cf1276a8c33194654b9c7a2b952540 (patch)
tree76e6e66913781927e620cfbb81603a5a4e017ea8 /net_gnss_dispatch.c
parent1876159a5a80ae8c6eca24ba128e134edd0fe125 (diff)
downloadgpsd-daeca67395cf1276a8c33194654b9c7a2b952540.tar.gz
Reindent the network support. All regression tests pass.
Diffstat (limited to 'net_gnss_dispatch.c')
-rw-r--r--net_gnss_dispatch.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/net_gnss_dispatch.c b/net_gnss_dispatch.c
index c8b5a7d1..fb1e6a81 100644
--- a/net_gnss_dispatch.c
+++ b/net_gnss_dispatch.c
@@ -8,9 +8,9 @@
#include "gpsd_config.h"
#include <sys/types.h>
#ifndef S_SPLINT_S
- #ifdef HAVE_SYS_SOCKET_H
- #include <sys/socket.h>
- #endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
#include <unistd.h>
#endif /* S_SPLINT_S */
#include <string.h>
@@ -38,30 +38,33 @@ int netgnss_uri_open(struct gps_context_t *context, char *netgnss_service)
/* open a connection to a DGNSS service */
{
#ifdef NTRIP_ENABLE
- if (strncmp(netgnss_service, NETGNSS_NTRIP, strlen(NETGNSS_NTRIP))==0)
+ if (strncmp(netgnss_service, NETGNSS_NTRIP, strlen(NETGNSS_NTRIP)) == 0)
return ntrip_open(context, netgnss_service + strlen(NETGNSS_NTRIP));
#endif
- if (strncmp(netgnss_service, NETGNSS_DGPSIP, strlen(NETGNSS_DGPSIP))==0)
+ if (strncmp(netgnss_service, NETGNSS_DGPSIP, strlen(NETGNSS_DGPSIP)) == 0)
return dgpsip_open(context, netgnss_service + strlen(NETGNSS_DGPSIP));
#ifndef REQUIRE_DGNSS_PROTO
return dgpsip_open(context, netgnss_service);
#else
- gpsd_report(LOG_ERROR, "Unknown or unspecified DGNSS protocol for service %s\n",
+ gpsd_report(LOG_ERROR,
+ "Unknown or unspecified DGNSS protocol for service %s\n",
netgnss_service);
return -1;
#endif
}
+
/*@ +branchstate */
int netgnss_poll(struct gps_context_t *context)
/* poll the DGNSS service for a correction report */
{
if (context->dsock > -1) {
- context->rtcmbytes = read(context->dsock, context->rtcmbuf, sizeof(context->rtcmbuf));
- if ((context->rtcmbytes == -1 && errno != EAGAIN) ||
- (context->rtcmbytes == 0)) {
+ context->rtcmbytes =
+ read(context->dsock, context->rtcmbuf, sizeof(context->rtcmbuf));
+ if ((context->rtcmbytes == -1 && errno != EAGAIN)
+ || (context->rtcmbytes == 0)) {
(void)shutdown(context->dsock, SHUT_RDWR);
(void)close(context->dsock);
return -1;
@@ -82,7 +85,8 @@ void netgnss_report(struct gps_device_t *session)
#endif
}
-void netgnss_autoconnect(struct gps_context_t *context, double lat, double lon)
+void netgnss_autoconnect(struct gps_context_t *context, double lat,
+ double lon)
{
if (context->netgnss_service == netgnss_dgpsip) {
dgpsip_autoconnect(context, lat, lon, DGPSIP_SERVER_LIST);
@@ -92,18 +96,19 @@ void netgnss_autoconnect(struct gps_context_t *context, double lat, double lon)
void rtcm_relay(struct gps_device_t *session)
/* pass a DGNSS connection report to a session */
{
- if (session->gpsdata.gps_fd !=-1
+ if (session->gpsdata.gps_fd != -1
&& session->context->rtcmbytes > -1
&& session->rtcmtime < session->context->rtcmtime
&& session->device_type->rtcm_writer != NULL) {
if (session->device_type->rtcm_writer(session,
session->context->rtcmbuf,
- (size_t)session->context->rtcmbytes) == 0)
+ (size_t) session->context->
+ rtcmbytes) == 0)
gpsd_report(LOG_ERROR, "Write to RTCM sink failed\n");
else {
session->rtcmtime = timestamp();
- gpsd_report(LOG_IO, "<= DGPS: %zd bytes of RTCM relayed.\n", session->context->rtcmbytes);
+ gpsd_report(LOG_IO, "<= DGPS: %zd bytes of RTCM relayed.\n",
+ session->context->rtcmbytes);
}
}
}
-