Subversion Repositories public

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
88 andreas 1
/***************************************************************************
2
 *   Copyright (C) 2007 by Andreas Theofilu                             *
3
 *   andreas@theosys.at                                               *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation version 3 of the License.                *
8
 *                                                                         *
9
 *   This program is distributed in the hope that it will be useful,       *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 *   GNU General Public License for more details.                          *
13
 *                                                                         *
14
 *   You should have received a copy of the GNU General Public License     *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
19
 
20
#ifndef _DISASSEMBLE_H
21
#define _DISASSEMBLE_H
22
 
23
typedef struct
24
{
25
  int		   type;
26
  char             ident[7];       /* identifier            */
27
  position_type    posn;           /* position              */
28
  char             cmnt[41];       /* comment               */
29
  float32          dst;            /* proximity distance (meters) */
30
  uint8            smbl;           /* symbol id                   */
31
  uint8            dspl;           /* display option                */
32
  char *           wpt_ident;      /* null-terminated string      */
33
  char *           lnk_ident;      /* null-terminated string  */
34
  uint8            wpt_class;      /* class                   */
35
  unsigned char    subclass[21];   /* subclass                */
36
  uint8            color;          /* waypoint color               */
37
  uint8            attr;           /* attributes (see below)          1      */
38
  float32          alt;            /* altitude in meters              4      */
39
  float32          dpth;           /* depth in meters                 4      */
40
  char             state[3];       /* state                           2      */
41
  char             cc[3];          /* country code                    2      */
42
  char *           identity;          /* variable length string          1-51   */
43
  char *           comment;        /* waypoint user comment           1-51   */
44
  char *           facility;       /* facility name                   1-31   */
45
  char *           city;           /* city name                       1-25   */
46
  char *           addr;           /* address number                  1-51   */
47
  char *           cross_road;     /* intersecting road label         1-51   */
48
  uint8            dtyp;           /* data packet type (0x01 for D109) 1    */
49
  uint8            dspl_color;     /* display & color (see below)      1    */
50
  uint32           ete;            /* outbound link ete in seconds     4    */
51
  float32          temp;           /* temperature                      4    */
52
  time_type        time;           /* timestamp                        4    */
53
  sint16           idx;            /* proximity index                   */
54
} WAYPOINT;
55
 
56
typedef struct
57
{
58
  char             name[18];        /* category name */
59
} WPCATEGORY;
60
 
61
typedef struct
62
{
63
  int		        type;
64
  uint8                 nmbr;       /* route number            */
65
  char                  cmnt[21];   /* comment                 */
66
  char *                rte_ident;  /* null-terminated string  */
67
} ROUTE;
68
 
69
typedef struct
70
{
71
  int			type;
72
  uint16                klasse;        /* link class; see below           */
73
  uint8                 subclass[20]; /* sublcass                        */
74
  char *                ident;        /* variable length string          */
75
} ROUTE_LINK;
76
 
77
typedef struct
78
{
79
  int		    type;
80
  position_type     posn;      /* position                        */
81
  uint32            time;      /* time                            */
82
  bool              new_trk;   /* new track segment?              */
83
  float32           alt;      /* altitude in meters        */
84
  float32           dpth;     /* depth in meters           */
85
  float32           temp;
86
  uint8             heart_rate;
87
  float32           distance;
88
  uint8             cadence;
89
  bool              sensor;
90
} POINT;
91
 
92
typedef struct POINT_NODE
93
{
94
	int number;
95
	POINT *point;
96
	POINT_NODE *next;
97
} POINT_NODE;
98
 
99
typedef struct
100
{
101
  int		type;
102
  bool          dspl;           /* display on the map?        */
103
  uint8         color;          /* color (same as D108)       */
104
  char *        trk_ident;      /* null-terminated string     */
105
  uint16        index;   /* unique among all tracks received from device */
106
} TRACK;
107
 
108
typedef struct
109
{
110
  int		type;
111
  sint16        wn;    /* week number                          (weeks)    */
112
  float32       toa;   /* almanac data reference time              (s)    */
113
  float32       af0;   /* clock correction coefficient             (s)    */
114
  float32       af1;   /* clock correction coefficient           (s/s)    */
115
  float32       e;     /* eccentricity                             (-)    */
116
  float32       sqrta; /* square root of semi-major axis (a)  (m**1/2)    */
117
  float32       m0;    /* mean anomaly at reference time           (r)    */
118
  float32       w;     /* argument of perigee                      (r)    */
119
  float32       omg0;  /* right ascension                          (r)    */
120
  float32       odot;  /* rate of right ascension                (r/s)    */
121
  float32       i;     /* inclination angle                        (r)    */
122
  uint8         hlth;  /* almanac health                                 */
123
  char          svid;  /* satellite id                                   */
124
} ALMANAC;
125
 
126
typedef struct
127
{
128
  uint8     month;            /* month  (1-12)                  */
129
  uint8     day;              /* day    (1-31)                  */
130
  uint16    year;             /* year   (1990 means 1990)       */
131
  sint16    hour;             /* hour   (0-23)                  */
132
  uint8     minute;           /* minute (0-59)                  */
133
  uint8     second;           /* second (0-59)                  */
134
} DATETIME;
135
 
136
typedef struct
137
{
138
  int		    type;
139
  time_type         takeoff_time;
140
  time_type         landing_time;
141
  position_type     takeoff_posn;
142
  position_type     landing_posn;
143
  uint32            night_time;
144
  uint32            num_landings;
145
  float32           max_speed;
146
  float32           max_alt;
147
  float32           distance;
148
  bool              cross_country_flag;
149
  char *            departure_name;
150
  char *            departure_ident;
151
  char *            arrival_name;
152
  char *            arrival_ident;
153
  char *            ac_id;
154
} FLIGHTBOOK;
155
 
156
typedef struct
157
{
158
  float32               alt;        /* alt above WGS 84 ellipsoid (m)        */
159
  float32               epe;        /* est. position error, 2 sigma (m)      */
160
  float32               eph;        /* epe, but horizontal only (meters)     */
161
  float32               epv;        /* epe, but vertical only (meters)       */
162
  sint16                fix;        /* type of position fix                  */
163
  float64               tow;        /* time of week (seconds)                */
164
  radian_position_type  posn;       /* latitude and longitude (radians)      */
165
  float32               east;       /* velocity east  (meters/second)        */
166
  float32               north;      /* velocity north (meters/second)        */
167
  float32               up;         /* velocity up    (meters/second)        */
168
  float32               msl_hght;   /* ht. of WGS 84 ellipsoid above MSL (m) */
169
  sint16                leap_scnds; /* diff between GPS and UTC (seconds)    */
170
  sint32                wn_days;    /* week number days                      */
171
} PVT;
172
 
173
typedef struct
174
{
175
  int		   type;
176
  uint32           start_time;
177
  uint32           total_time;      /* In hundredths of a second */
178
  float32          total_distance;  /* In meters */
179
  position_type    begin;           /* Invalid if lat and lon are 0x7fffffff */
180
  position_type    end;             /* Invalid if lat and lon are 0x7fffffff */
181
  uint16           calories;
182
  uint8            track_index;     /* See below */
183
  uint32           index;
184
  float32          max_speed;
185
  uint8            avg_heart_rate;
186
  uint8            max_heart_rate;
187
  uint8            intensity;
188
  uint8            avg_cadence;
189
  uint8            trigger_method;
190
} LAP;
191
 
192
typedef struct LAP_NODE
193
{
194
	LAP *lap;
195
	LAP_NODE *next;
196
} LAP_NODE;
197
 
198
typedef struct
199
{
200
  int			       type;
201
  uint32                       num_valid_steps;
202
  struct {
203
    char                       custom_name[17];
204
    float32                    target_custom_zone_low;
205
    float32                    target_custom_zone_high;
206
    uint16                     duration_value;
207
    uint8                      intensity;
208
    uint8                      duration_type;
209
    uint8                      target_type;
210
    uint8                      target_value;
211
  }                            steps[20];
212
  char                         name[17];
213
  uint8                        sport_type;
214
  char                         workout_name[17];
215
  time_type                    day;
216
  uint32                       max_workouts;
217
  uint32                       max_unscheduled_workouts;
218
  uint32                       max_occurrences;
219
} WORKOUT;
220
 
221
typedef struct
222
{
223
  int				type;
224
  uint32                       track_index;
225
  uint32                       first_lap_index;
226
  uint32                       last_lap_index;
227
  uint8                        sport_type;
228
  uint8                        program_type;
229
  uint8                        multisport;
230
  struct {
231
    uint32                     time;
232
    float32                    distance;
233
  }                            virtual_partner;
234
  WORKOUT                      workout;
235
} RUN;
236
 
237
typedef struct RUN_NODE
238
{
239
	RUN *run;
240
	RUN_NODE *next;
241
} RUN_NODE;
242
 
243
typedef struct
244
{
245
  int			       type;
246
  struct {
247
    struct {
248
      uint8                    low_heart_rate;
249
      uint8                    high_heart_rate;
250
    }                          heart_rate_zones[5];
251
    struct {
252
      float32                  low_speed;
253
      float32                  high_speed;
254
      char                     name[17];
255
    }                          speed_zones[10];
256
    float32                    gear_weight;
257
    uint8                      max_heart_rate;
258
  }                            activities[3];
259
  float32                      weight;
260
  uint16                       birth_year;
261
  uint8                        birth_month;
262
  uint8                        birth_day;
263
  uint8                        gender;
264
} FITNESS;
265
 
266
typedef struct
267
{
268
  int				type;
269
  uint16                       index;
270
  char                         course_name[17];
271
  uint16                       track_index;
272
  uint16                       course_index;
273
  uint16                       lap_index;
274
  uint32                       total_time;
275
  float32                      total_dist;
276
  position_type                begin;
277
  position_type                end;
278
  uint8                        avg_heart_rate;
279
  uint8                        max_heart_rate;
280
  uint8                        intensity;
281
  uint8                        avg_cadence;
282
  time_type                    track_point_time;
283
  uint8                        point_type;
284
  uint32                       max_courses;
285
  uint32                       max_course_laps;
286
  uint32                       max_course_pnt;
287
  uint32                       max_course_trk_pnt;
288
} COURSE;
289
 
290
class disassemble
291
{
292
	public:
293
	   disassemble();
294
	   ~disassemble();
295
	   void destroy();
296
	   void garmin_print_data (garmin_data *d);
297
 
298
	   LAP_NODE *addLap ();
299
	   LAP_NODE *getLapNode () { return lap_node; }
300
	   LAP *getLap(int index);
301
 
302
	   RUN_NODE *addRun ();
303
	   RUN_NODE *getRunNode () { return run_node; }
304
 
305
	   POINT_NODE *addPoint();
306
	   POINT_NODE *getPointNode() { return point_node; }
307
	   POINT *getPoint(int number);
308
	   POINT *getPoint(uint32 time);
309
 
310
	protected:
311
	   void garmin_print_dlist (garmin_list *l);
312
	   char *garmin_print_dtime (uint32 t);
313
	   void garmin_print_dpos (position_type *pos, double *lat, double *lon);
314
	   char *garmin_print_float32 (float32 f, char *ret);
315
	   char *garmin_print_float64 (float64 f, char *ret);
316
	   char *garmin_print_dfloat32 (float32 f, char *ret);
317
	   char *garmin_print_ddist (uint32 dur, char *ret);
318
 
319
	private:
320
	   void garmin_print_d100 (D100 *x);
321
	   void garmin_print_d101 (D101 *x);
322
	   void garmin_print_d102 (D102 *x);
323
	   void garmin_print_d103 (D103 *x);
324
	   void garmin_print_d104 (D104 *x);
325
	   void garmin_print_d105 (D105 *x);
326
	   void garmin_print_d106 (D106 *x);
327
	   void garmin_print_d107 (D107 *x);
328
	   void garmin_print_d108 (D108 *x);
329
	   void garmin_print_d109 (D109 *x);
330
	   void garmin_print_d110 (D110 *x);
331
	   void garmin_print_d120 (D120 *x);
332
	   void garmin_print_d150 (D150 *x);
333
	   void garmin_print_d151 (D151 *x);
334
	   void garmin_print_d152 (D152 *x);
335
	   void garmin_print_d154 (D154 *x);
336
	   void garmin_print_d155 (D155 *x);
337
	   void garmin_print_d200 (D200 *x);
338
	   void garmin_print_d201 (D201 *x);
339
	   void garmin_print_d202 (D202 *x);
340
	   void garmin_print_d210 (D210 *x);
341
	   void garmin_print_d300 (D300 *p);
342
	   void garmin_print_d301 (D301 *p);
343
	   void garmin_print_d302 (D302 *p);
344
	   void garmin_print_d303 (D303 *p);
345
	   void garmin_print_d304 (D304 *p);
346
	   void garmin_print_d310 (D310 *x);
347
	   void garmin_print_d311 (D311 *h);
348
	   void garmin_print_d312 (D312 *h);
349
	   void garmin_print_d400 (D400 *x);
350
	   void garmin_print_d403 (D403 *x);
351
	   void garmin_print_d450 (D450 *x);
352
	   void garmin_print_d500 (D500 *x);
353
	   void garmin_print_d501 (D501 *x);
354
	   void garmin_print_d550 (D550 *x);
355
	   void garmin_print_d551 (D551 *x);
356
	   void garmin_print_d600 (D600 *x);
357
	   void garmin_print_d650 (D650 *x);
358
	   void garmin_print_d700 (D700 *x);
359
	   void garmin_print_d800 (D800 *x);
360
	   void garmin_print_d906 (D906 *x);
361
	   void garmin_print_d1000 (D1000 *x);
362
	   void garmin_print_d1001 (D1001 *x);
363
	   void garmin_print_d1002 (D1002 *x);
364
	   void garmin_print_d1003 (D1003 *x);
365
	   void garmin_print_d1004 (D1004 *d);
366
	   void garmin_print_d1005 (D1005 *limits);
367
	   void garmin_print_d1006 (D1006 *x);
368
	   void garmin_print_d1007 (D1007 *x);
369
	   void garmin_print_d1008 (D1008 *w);
370
	   void garmin_print_d1009 (D1009 *x);
371
	   void garmin_print_d1010 (D1010 *x);
372
	   void garmin_print_d1011 (D1011 *x);
373
	   void garmin_print_d1012 (D1012 *x);
374
	   void garmin_print_d1013 (D1013 *x);
375
	   void garmin_print_d1015 (D1015 *x);
376
 
377
	private:
378
	   WAYPOINT waypoint;
379
	   WPCATEGORY wpcategory;
380
	   int route_header;
381
	   ROUTE route;
382
	   ROUTE_LINK route_link;
383
	   POINT point;
384
	   POINT_NODE *point_node;
385
	   TRACK track;
386
	   ALMANAC almanac;
387
	   DATETIME datetime;
388
	   FLIGHTBOOK flightbook;
389
	   radian_position_type rpt;
390
	   PVT pvt;
391
	   LAP lap;
392
	   LAP_NODE *lap_node;
393
	   RUN run;
394
	   RUN_NODE *run_node;
395
	   WORKOUT workout;
396
	   FITNESS fitness;
397
	   COURSE course;
398
};
399
 
400
#endif