/*************************************************************************** * gps.h * * Copyright 2010 Steffen Pohle * steffen@gulpe.de ****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* * GPS Device Setup String: * SAMPLE: "serial:com1,19200" serial, comport 1, 19200 baud (windows) * SAMPLE: "serial:/dev/ttyS0,19200" serial, /dev/ttyS0, 19200 baud (linux) * SAMPLE: "file:gpsdata.save" read gps data from file * SAMPLE: "file:sim,gpsdata.save" read gps data from file, real time simulation * (needed for testing routeing) */ #ifndef _GPS_H_ #define _GPS_H_ #include #define GPS_DEVICELEN 256 #define GPS_ROUTEPOILEN 128 #define GPS_INBUFSIZE 2048 #define GPS_LINELEN 100 #define GPS_MAXSAT 32 #define GPS_KNOTEN2KMH 1.851984 #define GPS_LOOP_TIMEOUT 50 #define GPSF_LOG 0x0001 #define GPSF_ALL 0xFFFF enum { GPS_T_NONE, GPS_T_SERIAL, GPS_T_ANDROID, GPS_T_FILE }; struct gps_satelite { char deg_elev; int deg_north; char quality; }; struct gps_routepoidata { float lon; float lat; char name[GPS_ROUTEPOILEN]; // name[0] == 0 means no valid data }; struct gps_data { time_t time; float lon; float lat; float direction; float speed; char valid; char quality; char numofsatelites; float height; float hdop; struct gps_satelite sat[32]; struct gps_routepoidata poi; }; struct gps_routedata { time_t time; float lon; float lat; float speed; }; struct gps_route { struct gps_routedata *data; struct gps_routepoidata *pdata; int cnt; int max; int pcnt; int pmax; }; extern struct gps_route *gpsroute; extern int gpsflags; extern void gpsroute_exportgpx (struct gps_route *gr, char *filename); extern void gpsroute_free (struct gps_route *gr); extern struct gps_route *gpsroute_new (); extern void gpsroute_addpos (struct gps_route *gr, float lon, float lat, float speed, time_t t); extern void gpsroute_addpoi (struct gps_route *gr, float lon, float lat, char *text); extern void gps_set_device (char *device); extern char *gps_get_device (); extern void gps_start (); extern void gps_stop (); extern struct gps_data *gps_loop (); extern void gps_save_log (char *fname, char *text); extern void gps_load_log (char *fn); extern int gps_isrunning (); extern struct gps_data *gps_getposition (); /* * implemention of each build, i.E. gtk_gps.c or wince_gps.c * other stuff will be put into the gtk_port.h, wince_port.h files. */ extern void gps_serial_settings (); extern int gps_serial_device_open (); extern void gps_serial_device_close (); extern int gps_serial_device_read (char *ptr, int ptrsize); enum { GPSF_NONE, GPSF_PAUSE, GPSF_INIT, GPSF_RUN, GPSF_END }; extern int gps_file_device_open (); extern void gps_file_device_close (); extern int gps_file_device_read (char *ptr, int ptrsize); extern int gps_file_get_state (); extern void gps_file_set_state (int state); extern void gps_file_set_pos (int newpos); extern int gps_file_get_pos (); extern int gps_file_get_size (); #ifdef ANDROID extern int gps_android_device_open (); extern void gps_android_device_close (); extern int gps_android_device_read (char *ptr, int ptrsize); #endif #endif