diff options
author | Robert Norris <rw_norris@hotmail.com> | 2017-02-14 21:30:25 +0000 |
---|---|---|
committer | Fred Wright <fw@fwright.net> | 2017-02-17 14:46:05 -0800 |
commit | 92e30abaa3f7fb298d05ebe207c16f7096d0c15a (patch) | |
tree | d55dc7876efef57847e635afb80efd0274cfa3fb /gpsd.h | |
parent | b8890ecae932892fd8e6fc45a3f003c937d3f82f (diff) | |
download | gpsd-92e30abaa3f7fb298d05ebe207c16f7096d0c15a.tar.gz |
Windows libgps support
Add Windows versions for network functions and disable unused features.
Add detection of various headers and functions that aren't available in
Windows. Note that netlib_localsocket() has no functional implementation
on Windows, but it isn't to be used on that platform and it's not part of
libgps anyway.
Using send() rather than write() seems to work on Windows.
For Windows need to ensure networking is initialised on opening of sockets
(and then correspondingly shutdown upon closing).
Note that within gpsd.h the termios structures and serial related functions
are removed from the Windows build. These are only accessed in serial.c by
gpsd, so since the Windows build is only generating libgps there is
currently no need to modify serial.c.
And for os_compat.h, daemon() is simply disabled under Windows as it's not
used within libgps.
TESTED:
Confirmed compiles under a cross compiler.
Manual build and run of test_libgps on Windows which successfully connects
to a host running GPSD
Manual build DLL version and link with a Windows version of a program
(Viking) that then successfully connects and monitors positions from GPSD
Otherwise no effect on current supported systems.
'scons build-all check' - passes.
Signed-off-by: Fred Wright <fw@fwright.net>
Diffstat (limited to 'gpsd.h')
-rw-r--r-- | gpsd.h | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -17,11 +17,16 @@ extern "C" { #include <stdbool.h> #include <stdint.h> #include <stdio.h> +#include "gpsd_config.h" +#ifdef HAVE_TERMIOS_H #include <termios.h> +#endif +#ifdef HAVE_WINSOCK2_H +#include <winsock2.h> /* for fd_set */ +#endif #include <time.h> /* for time_t */ #include "gps.h" -#include "gpsd_config.h" #include "os_compat.h" /* @@ -361,11 +366,13 @@ struct gps_type_t { void (*init_query)(struct gps_device_t *session); void (*event_hook)(struct gps_device_t *session, event_t event); #ifdef RECONFIGURE_ENABLE +#ifdef HAVE_TERMIOS_H bool (*speed_switcher)(struct gps_device_t *session, speed_t speed, char parity, int stopbits); void (*mode_switcher)(struct gps_device_t *session, int mode); bool (*rate_switcher)(struct gps_device_t *session, double rate); double min_cycle; +#endif /* HAVE_TERMIOS_H */ #endif /* RECONFIGURE_ENABLE */ #ifdef CONTROLSEND_ENABLE ssize_t (*control_send)(struct gps_device_t *session, char *buf, size_t buflen); @@ -472,7 +479,9 @@ struct gps_device_t { sourcetype_t sourcetype; servicetype_t servicetype; int mode; +#ifdef HAVE_TERMIOS_H struct termios ttyset, ttyset_old; +#endif #ifndef FIXED_PORT_SPEED unsigned int baudindex; #endif /* FIXED_PORT_SPEED */ @@ -822,9 +831,11 @@ extern ssize_t gpsd_serial_write(struct gps_device_t *, const char *, const size_t); extern bool gpsd_next_hunt_setting(struct gps_device_t *); extern int gpsd_switch_driver(struct gps_device_t *, char *); +#ifdef HAVE_TERMIOS_H extern void gpsd_set_speed(struct gps_device_t *, speed_t, char, unsigned int); extern speed_t gpsd_get_speed(const struct gps_device_t *); extern speed_t gpsd_get_speed_old(const struct gps_device_t *); +#endif /* HAVE_TERMIOS_H */ extern int gpsd_get_stopbits(const struct gps_device_t *); extern char gpsd_get_parity(const struct gps_device_t *); extern void gpsd_assert_sync(struct gps_device_t *); |