00001 /***************************************************************************** 00002 * 00003 * $RCSfile: common_8h-source.html,v $ 00004 * 00005 * GPS4Palm 00006 * Common Data Structure and Function Declarations 00007 * 00008 * This program is Copyright (C) 03/2003 Matthias Prinke 00009 * <matthias.prinke@surfeu.de> and covered by GNU's GPL. 00010 * In particular, this program is free software and comes WITHOUT 00011 * ANY WARRANTY. 00012 * 00013 * $Author: mp $ 00014 * 00015 * $Date: 2007-10-08 20:40:32 $ 00016 * 00017 * $Revision: 1.7.2.1 $ 00018 * 00019 * $Log: common_8h-source.html,v $ 00019 * Revision 1.7.2.1 2007-10-08 20:40:32 mp 00019 * updated for gps4palm V0.9.5 beta 00019 * 00020 * Revision 1.27 2005-05-13 18:30:10 mp 00021 * added AUTOPWROFF 00022 * 00023 * Revision 1.26 2005/04/20 21:16:23 mp 00024 * added gps_btaddr and host_btaddr, changed kVersion to 0x08 00025 * 00026 * Revision 1.25 2005/02/25 18:35:47 mp 00027 * added gPrefs.filecard, changed kVersion to 0x07 00028 * 00029 * Revision 1.24 2005/02/19 20:06:36 mp 00030 * changed kVersion to 0x06 00031 * 00032 * Revision 1.23 2005/02/19 20:04:55 mp 00033 * added FILENAMEMAXLEN, changed filename[32] to filename[FILENAMEMAXLEN] 00034 * 00035 * Revision 1.22 2005/02/06 14:56:47 mp 00036 * changed kVersion to 0x05, added serprefs to PrefsType 00037 * 00038 * Revision 1.21 2004/12/19 10:02:23 mp 00039 * changed kVersion from 0x03 to 0x04 00040 * 00041 * Revision 1.20 2004/12/07 17:12:29 mp 00042 * added field 'time' to GPSType 00043 * 00044 * Revision 1.19 2004/12/04 09:34:37 mp 00045 * modified ActTrackType 00046 * 00047 * Revision 1.18 2004/12/02 23:01:36 mp 00048 * added ActTrackType and TrkPrefsType 00049 * 00050 * Revision 1.17 2004/11/30 21:02:29 mp 00051 * added kTrkHdrDBType, kTrkHdrDBName, kTrkDBType, and kTrkDBName 00052 * 00053 * Revision 1.16 2004/11/27 10:33:15 mp 00054 * updated kVersion 00055 * 00056 * Revision 1.15 2004/11/25 17:00:13 mp 00057 * added approach_alert and approach_sound to PrefsType 00058 * 00059 * Revision 1.14 2004/11/20 15:54:39 mp 00060 * updated kVersion, added auto_wpt to PrefsType 00061 * 00062 * Revision 1.13 2004/11/11 21:37:05 mp 00063 * added Active Route 00064 * 00065 * Revision 1.12 2004/04/12 10:28:24 mp 00066 * modified kVersion 00067 * 00068 * Revision 1.11 2004/03/11 21:25:16 mp 00069 * added GPSType 00070 * 00071 * Revision 1.10 2004/03/10 17:20:06 mp 00072 * removed progressbar() prototype, added ActWayptType and gPrefs.act_wpt 00073 * 00074 * Revision 1.9 2004/02/27 16:21:32 mp 00075 * added database constants 00076 * 00077 * Revision 1.8 2004/01/18 11:44:22 mp 00078 * added POS_UTM 00079 * 00080 * Revision 1.7 2003/12/30 14:46:39 mp 00081 * modified defines to facilitate array indexing 00082 * 00083 * Revision 1.6 2003/12/27 17:37:59 mp 00084 * added map selection and map fetch states 00085 * 00086 * Revision 1.5 2003/11/20 20:51:07 mp 00087 * added units and mapprefs structures and encoding 00088 * 00089 * Revision 1.4 2003/11/16 17:46:14 mp 00090 * added MapParamType Struct 00091 * 00092 * Revision 1.3 2003/10/18 16:11:21 mp 00093 * renamed ImgInfoType to PrefsType 00094 * 00095 * Revision 1.2 2003/07/14 20:45:37 mp 00096 * Added kCreatorId, kPrefsId, and kVersion 00097 * 00098 * Revision 1.1.1.1 2003/07/14 18:59:29 mp 00099 * Imported GPS4Palm to CVS revision control. 00100 * 00101 * 00102 ****************************************************************************/ 00103 #ifndef COMMON_H 00104 #define COMMON_H 00105 #include <BtCommVdrv.h> 00106 00107 #define kCreatorId 'Gps4' 00108 #define kPrefsId 0x00 00109 #define kVersion 0x08 00110 00111 #define kWaypointDBType 'WAYP' 00112 #define kWaypointDBName "Waypoints-Gps4" 00113 #define kRouteDBType 'ROUT' 00114 #define kRouteDBName "Routes-Gps4" 00115 #define kTrkHdrDBType 'TRKH' /* Track Headers */ 00116 #define kTrkHdrDBName "Trkheaders-Gps4" 00117 #define kTrkDBType 'TRKP' /* Track Points */ 00118 #define kTrkDBName "Trkpoints-Gps4-" /* +number (6 hex digits) */ 00119 00120 #define APPROACH_DST 100 /**< default approach distance (m) */ 00121 #define AUTOPWROFF 1 /**< default Auto Power-Off state */ 00122 #define FILENAMEMAXLEN 64 /**< maximum filename length */ 00123 00124 /*-------*/ 00125 /* Units */ 00126 /*-------*/ 00127 00128 /* Position */ 00129 #define POS_D 0 /* Degrees */ 00130 #define POS_DM 1 /* Degrees and Minutes of Arc */ 00131 #define POS_DMS 2 /* Degrees, Minutes and Seconds of Arc */ 00132 #define POS_UTM 3 /* Universal Transverse Mercator */ 00133 00134 /* Distance */ 00135 #define DST_KM 0 /* km */ 00136 #define DST_MI 1 /* mile (1.609344 km) */ 00137 #define DST_NM 2 /* nautic mile (1.852 km) */ 00138 00139 /* Altitude */ 00140 #define ALT_M 0 /* m */ 00141 #define ALT_FT 1 /* feet (0.3048 m) */ 00142 00143 /* Speed */ 00144 #define SPD_KMH 0 /* km/h */ 00145 #define SPD_MS 1 /* m/s (3.6 km/h) */ 00146 #define SPD_MIH 2 /* mile/h (1.609344 km/h) */ 00147 #define SPD_KTS 3 /* knots (1.852 km/h) */ 00148 00149 00150 00151 /*-----------------*/ 00152 /* Map Preferences */ 00153 /*-----------------*/ 00154 00155 /* Download Policy */ 00156 #define DLD_A 1 /* download automatically */ 00157 #define DLD_Q 2 /* download after query */ 00158 #define DLD_O 3 /* download off */ 00159 00160 #define SEL_USER 1 /* user selected map */ 00161 #define SEL_AUTO 2 /* auto selected map */ 00162 00163 #define FETCH_READY 1 /* FetchMap can be started again */ 00164 #define FETCH_START 2 /* FetchMap has been started */ 00165 #define FETCH_STOP 3 /* FetchMap disabled */ 00166 00167 /* Units Data Structure */ 00168 typedef struct { 00169 UInt8 pos_unit; 00170 UInt8 dst_unit; 00171 UInt8 alt_unit; 00172 UInt8 spd_unit; 00173 } UnitsType; 00174 00175 /* Map Preferences Data Type */ 00176 typedef struct { 00177 UInt32 scale; 00178 UInt8 download; 00179 UInt8 select; 00180 UInt8 fetch; 00181 } MapPrefsType; 00182 00183 /* Active Waypoint Type */ 00184 typedef struct { 00185 UInt32 waypointID; /* waypoint ID (unique) */ 00186 Boolean valid; /* waypoint ID valid */ 00187 } ActWayptType; 00188 00189 /* Active Route Type */ 00190 typedef struct { 00191 UInt32 routeID; /* route ID (unique) */ 00192 Boolean valid; /* route ID valid */ 00193 UInt16 wpt_index; /* index of active waypoint in route */ 00194 } ActRouteType; 00195 00196 /* Active Track Type */ 00197 typedef struct { 00198 UInt32 trackID; /* track ID (unique) */ 00199 Boolean valid; /* track ID valid */ 00200 Boolean log_state; /* false: log disabled / true: log enabled */ 00201 } ActTrackType; 00202 00203 /* Track Log Preferences Type */ 00204 typedef struct { 00205 UInt16 mode; /* log mode (0: time / 1: distance) */ 00206 UInt16 ival; /* log interval (index) */ 00207 UInt16 wrap; /* when log DB full (0: stop / 1: wrap) */ 00208 } TrkPrefsType; 00209 00210 /* Serial Port Preferences Type */ 00211 typedef struct { 00212 UInt32 gps_port; /* GPS serial port or CncMgr Profile ID */ 00213 UInt32 gps_baud; /* GPS baud rate */ 00214 UInt8 gps_btaddr[btLibDeviceAddressSize]; /* GPS Bluetooth device address */ 00215 UInt32 host_port; /* Host serial port or CncMgr Profile ID */ 00216 UInt32 host_baud; /* Host baud rate */ 00217 UInt8 host_btaddr[btLibDeviceAddressSize]; /* GPS Bluetooth device address */ 00218 Boolean rts_ctrl; /* RTS controls multiplexer */ 00219 } SerPrefsType; 00220 00221 /* Preferences Data Structure */ 00222 typedef struct { 00223 Char filename[FILENAMEMAXLEN]; 00224 UInt32 filecard; /* file stream card/VFS volume */ 00225 Char imgtype[32]; 00226 UInt16 depth; 00227 UInt16 mag; 00228 UInt16 xofs; 00229 UInt16 yofs; 00230 UInt16 dx; 00231 UInt16 dy; 00232 UInt16 dw; 00233 UInt16 dh; 00234 UInt16 form; /* current form (mode) */ 00235 UInt16 pwroff; /* auto power-off */ 00236 Boolean auto_wpt; /* auto waypoint selection (route) */ 00237 Boolean approach_alert; /* approach alert */ 00238 Boolean approach_sound; /* approach sound */ 00239 UnitsType units; /* units preferences */ 00240 SerPrefsType serprefs; /* serial port preferences */ 00241 TrkPrefsType trk_log; /* track log preferences */ 00242 MapPrefsType mapprefs; /* map preferences */ 00243 ActWayptType act_wpt; /* active waypoint */ 00244 ActRouteType act_rte; /* active route */ 00245 ActTrackType act_trk; /* active track */ 00246 } PrefsType; 00247 00248 /* MapParamType Struct */ 00249 typedef struct { 00250 double lat; /* latitude */ 00251 double lon; /* longitude */ 00252 00253 UInt32 scale; /* map scale */ 00254 00255 UInt16 width; /* map width (px) */ 00256 UInt16 height; /* map height (px) */ 00257 00258 } MapParamType; 00259 00260 00261 /* GPSType Struct */ 00262 typedef struct { 00263 Boolean valid; /* GPS Status */ 00264 double lat; /* Latitude */ 00265 double lon; /* Longitude */ 00266 double sog; /* Speed Over Ground (in kts !!!) */ 00267 double cmg; /* Course Made Good */ 00268 UInt32 time; /* Palm epoch: seconds since 1904-01-01 12:00 */ 00269 } GPSType; 00270 00271 #endif