1 /********************************************************************
2 ** @source JEEPS application and data functions
3 **
4 ** @author Copyright (C) 1999 Alan Bleasby
5 ** @version 1.0
6 ** @modified Dec 28 1999 Alan Bleasby. First version
7 ** @modified Copyright (C) 2004, 2005, 2006 Robert Lipe
8 ** @modified Copyright (C) 2007 Achim Schumacher
9 ** @@
10 **
11 ** This library is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU Library General Public
13 ** License as published by the Free Software Foundation; either
14 ** version 2 of the License, or (at your option) any later version.
15 **
16 ** This library is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 ** Library General Public License for more details.
20 **
21 ** You should have received a copy of the GNU Library General Public
22 ** License along with this library; if not, write to the
23 ** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ** Boston, MA 02110-1301,  USA.
25 ********************************************************************/
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif
30 
31 #ifndef gpsapp_h
32 #define gpsapp_h
33 
34 
35 #include "garmin_gps.h"
36 
37 void VerifyPortClosed();
38 
39 int32  GPS_Init(const char *port);
40 
41 int32  GPS_A100_Get(const char *port, GPS_PWay **way, int (*cb)(int ct, GPS_PWay *));
42 int32 GPS_A101_Get(const char *port);
43 int32  GPS_A100_Send(const char *port, GPS_PWay *way, int32 n, int (*cb)(GPS_PWay *));
44 
45 int32  GPS_A200_Get(const char *port, GPS_PWay **way);
46 int32  GPS_A201_Get(const char *port, GPS_PWay **way);
47 int32  GPS_A200_Send(const char *port, GPS_PWay *way, int32 n);
48 int32  GPS_A201_Send(const char *port, GPS_PWay *way, int32 n);
49 
50 int32  GPS_A300_Get(const char *port, GPS_PTrack **trk, pcb_fn cb);
51 int32  GPS_A301_Get(const char *port, GPS_PTrack **trk, pcb_fn cb, int protoid);
52 int32  GPS_A300_Send(const char *port, GPS_PTrack *trk, int32 n);
53 int32  GPS_A301_Send(const char *port, GPS_PTrack *trk, int32 n, int protoid,
54                     gpsdevh *fd);
55 
56 int32  GPS_D300_Get(GPS_PTrack *trk, int32 entries, gpsdevh *h);
57 void   GPS_D300b_Get(GPS_PTrack *trk, UC *data);
58 void   GPS_D301b_Get(GPS_PTrack *trk, UC *data);
59 void   GPS_D302b_Get(GPS_PTrack *trk, UC *data);
60 void   GPS_D303b_Get(GPS_PTrack *trk, UC *data); /*D304*/
61 void   GPS_D310_Get(GPS_PTrack *trk, UC *s);
62 void   GPS_D311_Get(GPS_PTrack *trk, UC *s);
63 void   GPS_D300_Send(UC *data, GPS_PTrack trk, int32 *len);
64 void   GPS_D301_Send(UC *data, GPS_PTrack trk, int32 *len, int type);
65 void   GPS_D303_Send(UC *data, GPS_PTrack trk, int32 *len, int protoid);
66 void   GPS_D310_Send(UC *data, GPS_PTrack trk, int32 *len);
67 void   GPS_D311_Send(UC *data, GPS_PTrack trk, int32 *len);
68 
69 int32  GPS_A400_Get(const char *port, GPS_PWay **way);
70 int32  GPS_A400_Send(const char *port, GPS_PWay *way, int32 n);
71 
72 int32  GPS_A500_Get(const char *port, GPS_PAlmanac **alm);
73 int32  GPS_A500_Send(const char *port, GPS_PAlmanac *alm, int32 n);
74 
75 time_t GPS_A600_Get(const char *port);
76 time_t GPS_D600_Get(GPS_PPacket packet);
77 int32  GPS_A600_Send(const char *port, time_t Time);
78 void   GPS_D600_Send(GPS_PPacket *packet, time_t Time);
79 
80 int32  GPS_A700_Get(const char *port, double *lat, double *lon);
81 int32  GPS_A700_Send(const char *port, double lat, double lon);
82 void   GPS_D700_Get(GPS_PPacket packet, double *lat, double *lon);
83 void   GPS_D700_Send(GPS_PPacket *packet, double lat, double lon);
84 
85 int32  GPS_A800_On(const char *port, gpsdevh **fd);
86 int32  GPS_A800_Off(const char *port, gpsdevh **fd);
87 int32  GPS_A800_Get(gpsdevh **fd, GPS_PPvt_Data *packet);
88 void   GPS_D800_Get(GPS_PPacket packet, GPS_PPvt_Data *pvt);
89 
90 int32  GPS_A906_Get(const char *port, GPS_PLap **lap, pcb_fn cb);
91 void   GPS_D1011b_Get(GPS_PLap *Lap,UC *data); /*D906 D1001 D1015*/
92 
93 int32  GPS_A1006_Get(const char *port, GPS_PCourse **crs, pcb_fn cb);
94 int32  GPS_A1006_Send(const char *port, GPS_PCourse *crs, int32 n_crs,
95                       gpsdevh *fd);
96 void   GPS_D1006_Get(GPS_PCourse *crs, UC *p);
97 void   GPS_D1006_Send(UC *data, GPS_PCourse crs, int32 *len);
98 
99 int32  GPS_A1007_Get(const char *port, GPS_PCourse_Lap **clp, pcb_fn cb);
100 int32  GPS_A1007_Send(const char *port, GPS_PCourse_Lap *clp, int32 n_clp,
101                       gpsdevh *fd);
102 void   GPS_D1007_Get(GPS_PCourse_Lap *clp, UC *p);
103 void   GPS_D1007_Send(UC *data, GPS_PCourse_Lap clp, int32 *len);
104 
105 int32  GPS_A1008_Get(const char *port, GPS_PCourse_Point **cpt, pcb_fn cb);
106 int32  GPS_A1008_Send(const char *port, GPS_PCourse_Point *cpt, int32 n_cpt,
107                       gpsdevh *fd);
108 void   GPS_D1012_Get(GPS_PCourse_Point *cpt, UC *p);
109 void   GPS_D1012_Send(UC *data, GPS_PCourse_Point cpt, int32 *len);
110 
111 int32  GPS_A1009_Get(const char *port, GPS_PCourse_Limits limits);
112 void   GPS_D1013_Get(GPS_PCourse_Limits limits, UC *p);
113 
114 /* Unhandled documented protocols, as of:
115   Garmin Device Interface Specification, May 19, 2006, Drawing Number: 001-00063-00 Rev. C
116 A650  FlightBook Transfer Protocol
117 A1000  Run Transfer Protocol
118 	Capability A1000: D1009
119 		D1000 D1010
120 A1002  Workout Transfer Protocol
121 	Capability A1002: D1008
122 		D1002
123 	Capability A1003: D1003
124 A1004  Fitness User Profile Transfer Protocol
125 	Capability A1004: D1004
126 A1005  Workout Limits Transfer Protocol
127 	Capability A1005: D1005
128 */
129 /* Unimplemted and Undocumented, as listed from the following device/sw:
130 	GF305 3.70
131 
132 Capability A601: D601
133 Capability A801: D801
134 
135 Capability A902:
136 Capability A903:
137 Capability A907: D907 D908 D909 D910
138 Capability A918: D918
139 Capability A1013: D1014
140 */
141 
142 const char * Get_Pkt_Type(US p, US d0, const char **xinfo);
143 
144 void GPS_Prepare_Track_For_Device(GPS_PTrack **trk, int32 *n);
145 
146 #endif
147 
148 #ifdef __cplusplus
149 }
150 #endif
151