diff options
author | Gary E. Miller <gem@rellim.com> | 2016-03-29 19:31:22 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2016-03-29 19:31:22 -0700 |
commit | 686eaea63c44399dee5e80b699747e3d323f66d4 (patch) | |
tree | 42b3eb94cffa62ecbb77adfa1283dbfe1cf57518 | |
parent | e19519fa0aa4e5edff8ad008043aee6f14fa317f (diff) | |
download | gpsd-686eaea63c44399dee5e80b699747e3d323f66d4.tar.gz |
Add driver_skytraq.c.
It grabs packets, but does not decode any yet.
-rw-r--r-- | SConstruct | 1 | ||||
-rw-r--r-- | driver_skytraq.c | 88 | ||||
-rw-r--r-- | drivers.c | 4 | ||||
-rw-r--r-- | packet.c | 2 |
4 files changed, 94 insertions, 1 deletions
@@ -951,6 +951,7 @@ libgpsd_sources = [ "driver_rtcm2.c", "driver_rtcm3.c", "driver_sirf.c", + "driver_skytraq.c", "driver_superstar2.c", "driver_tsip.c", "driver_ubx.c", diff --git a/driver_skytraq.c b/driver_skytraq.c new file mode 100644 index 00000000..ea8e926f --- /dev/null +++ b/driver_skytraq.c @@ -0,0 +1,88 @@ +/* + * This is the gpsd driver for Skytraq GPSes operating in binary mode. + * + * This file is Copyright (c) 2016 by the GPSD project + * BSD terms apply: see the file COPYING in the distribution root for details. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <string.h> +#include <strings.h> +#include <math.h> +#include <ctype.h> +#include <unistd.h> + +#include "gpsd.h" +#include "bits.h" +#include "strfuncs.h" +#if defined(SKYTRAQ_ENABLE) + +#define HI(n) ((n) >> 8) +#define LO(n) ((n) & 0xff) + +/* + * No ACK/NAK? Just rety after 6 seconds + */ +#define SKY_RETRY_TIME 6 +#define SKY_CHANNELS 28 /* max channels allowed in format */ + +static gps_mask_t sky_parse(struct gps_device_t *, unsigned char *, size_t); + + +static gps_mask_t sky_parse(struct gps_device_t * session, unsigned char *buf, + size_t len) +{ + + if (len == 0) + return 0; + + buf += 4; + len -= 8; + // session->driver.sirf.lastid = buf[0]; + + /* could change if the set of messages we enable does */ + session->cycle_end_reliable = true; + + switch (buf[0]) { + default: + gpsd_log(&session->context->errout, LOG_PROG, + "Skytraq: Unknown packet id %d length %zd\n", + buf[0], len); + return 0; + } + return 0; +} + +static gps_mask_t skybin_parse_input(struct gps_device_t *session) +{ + if (session->lexer.type == SKY_PACKET) { + return sky_parse(session, session->lexer.outbuffer, + session->lexer.outbuflen); +#ifdef NMEA0183_ENABLE + } else if (session->lexer.type == NMEA_PACKET) { + return nmea_parse((char *)session->lexer.outbuffer, session); +#endif /* NMEA0183_ENABLE */ + } else + return 0; +} + +/* this is everything we export */ +/* *INDENT-OFF* */ +const struct gps_type_t driver_skytraq = +{ + .type_name = "Skytraq", /* full name of type */ + .packet_type = SKY_PACKET, /* associated lexer packet type */ + .flags = DRIVER_STICKY, /* remember this */ + .trigger = NULL, /* no trigger */ + .channels = SKY_CHANNELS, /* consumer-grade GPS */ + .probe_detect = NULL, /* no probe */ + .get_packet = generic_get, /* be prepared for Skytraq or NMEA */ + .parse_packet = skybin_parse_input,/* parse message packets */ + .rtcm_writer = gpsd_write, /* send RTCM data straight */ + .init_query = NULL, /* non-perturbing initial qury */ + .event_hook = NULL, /* lifetime event handler */ +}; +/* *INDENT-ON* */ +#endif /* defined( SKYTRAQ_ENABLE) && defined(BINARY_ENABLE) */ @@ -1719,6 +1719,7 @@ extern const struct gps_type_t driver_navcom; extern const struct gps_type_t driver_nmea2000; extern const struct gps_type_t driver_oncore; extern const struct gps_type_t driver_sirf; +extern const struct gps_type_t driver_skytraq; extern const struct gps_type_t driver_superstar2; extern const struct gps_type_t driver_tsip; extern const struct gps_type_t driver_ubx; @@ -1787,6 +1788,9 @@ static const struct gps_type_t *gpsd_driver_array[] = { #ifdef SIRF_ENABLE &driver_sirf, #endif /* SIRF_ENABLE */ +#ifdef SKYTRAQ_ENABLE + &driver_skytraq, +#endif /* SKYTRAQ_ENABLE */ #ifdef SUPERSTAR2_ENABLE &driver_superstar2, #endif /* SUPERSTAR2_ENABLE */ @@ -1749,7 +1749,7 @@ void packet_parse(struct gps_lexer_t *lexer) #endif /* SIRF_ENABLE */ #ifdef SKYTRAQ_ENABLE else if (lexer->state == SKY_RECOGNIZED) { - // packet_accept(lexer, SKY_PACKET); + packet_accept(lexer, SKY_PACKET); packet_discard(lexer); break; } |