Subversion Repositories public

Rev

Rev 249 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 249 Rev 314
Line 18... Line 18...
18
 ***************************************************************************/
18
 ***************************************************************************/
19
 
19
 
20
#include <time.h>
20
#include <time.h>
21
#include <string.h>
21
#include <string.h>
22
#include <math.h>
22
#include <math.h>
-
 
23
#include <boost/concept_check.hpp>
23
#include "garmin.h"
24
#include "garmin.h"
24
#include "disassemble.h"
25
#include "disassemble.h"
25
 
26
 
26
#define Deg2Rad(n)	((n) * DEG_2_RAD)
27
#define Deg2Rad(n)	((n) * DEG_2_RAD)
27
 
28
 
Line 282... Line 283...
282
int arrDist[20];
283
int arrDist[20];
283
uint32 arrTime[20];
284
uint32 arrTime[20];
284
float32 oldAlt, arrAlt[20];
285
float32 oldAlt, arrAlt[20];
285
int distPos;
286
int distPos;
286
 
287
 
-
 
288
	if (!l || !l->head)
-
 
289
		return;
-
 
290
 
287
	for (n = l->head; n != NULL; n = n->next)
291
	for (n = l->head; n != NULL; n = n->next)
288
	{
292
	{
289
	   garmin_print_data(n->data);
293
	   garmin_print_data(n->data);
290
	}
294
	}
291
 
295
 
292
	// Here all data is into the struct and now we
296
	// Here all data is into the struct and now we
293
	// figure out some statistics
297
	// figure out some statistics
294
	akt = point_node;
298
	akt = point_node;
295
	pTime = 0;
299
	pTime = 0;
-
 
300
	stTime = 0;
296
	distPos = 0;
301
	distPos = 0;
297
	oldAlt = 0;
302
	oldAlt = 0;
298
	descend = 99999;
303
	descend = 99999;
299
 
304
 
300
	if (akt && akt->point)
305
	if (akt && akt->point)
Line 482... Line 487...
482
 
487
 
483
/* Support function to print a position type */
488
/* Support function to print a position type */
484
 
489
 
485
void disassemble::garmin_print_dpos (position_type *pos, double *lat, double *lon)
490
void disassemble::garmin_print_dpos (position_type *pos, double *lat, double *lon)
486
{
491
{
-
 
492
	if (!pos || !lat || !lon)
-
 
493
		return;
-
 
494
 
487
	if ( pos->lat != 0x7fffffff )
495
	if ( pos->lat != 0x7fffffff )
488
	   *lat = SEMI2DEG(pos->lat);
496
	   *lat = SEMI2DEG(pos->lat);
489
 
497
 
490
	if ( pos->lon != 0x7fffffff )
498
	if ( pos->lon != 0x7fffffff )
491
	   *lon = SEMI2DEG(pos->lon);
499
	   *lon = SEMI2DEG(pos->lon);
Line 498... Line 506...
498
*/
506
*/
499
 
507
 
500
char *disassemble::garmin_print_float32 (float32 f, char *ret)
508
char *disassemble::garmin_print_float32 (float32 f, char *ret)
501
{
509
{
502
	if (!ret)
510
	if (!ret)
503
	   return NULL;
511
	   return 0;
504
 
512
 
505
	if ( f > 100000000.0 || f < -100000000.0 )
513
	if ( f > 100000000.0 || f < -100000000.0 )
506
	    sprintf(ret, "%.9e",f);
514
	    sprintf(ret, "%.9e",f);
507
	else if ( f > 10000000.0 || f < -10000000.0 )
515
	else if ( f > 10000000.0 || f < -10000000.0 )
508
	   sprintf(ret, "%.1f",f);
516
	   sprintf(ret, "%.1f",f);
Line 536... Line 544...
536
   exactly from its decimal representation.
544
   exactly from its decimal representation.
537
*/
545
*/
538
 
546
 
539
char *disassemble::garmin_print_float64 (float64 f, char *ret)
547
char *disassemble::garmin_print_float64 (float64 f, char *ret)
540
{
548
{
-
 
549
	if (!ret)
-
 
550
		return 0;
-
 
551
 
541
	if ( f > 10000000000000000.0 || f < -10000000000000000.0 )
552
	if ( f > 10000000000000000.0 || f < -10000000000000000.0 )
542
	   sprintf(ret,"%.17e",f);
553
	   sprintf(ret,"%.17e",f);
543
	else if ( f > 1000000000000000.0 || f < -1000000000000000.0 )
554
	else if ( f > 1000000000000000.0 || f < -1000000000000000.0 )
544
	   sprintf(ret,"%.1f",f);
555
	   sprintf(ret,"%.1f",f);
545
	else if ( f > 100000000000000.0 || f < -100000000000000.0 )
556
	else if ( f > 100000000000000.0 || f < -100000000000000.0 )
Line 1730... Line 1741...
1730
/* garmin_print_data                                                         */
1741
/* garmin_print_data                                                         */
1731
/* ========================================================================= */
1742
/* ========================================================================= */
1732
 
1743
 
1733
void disassemble::garmin_print_data (garmin_data *d)
1744
void disassemble::garmin_print_data (garmin_data *d)
1734
{
1745
{
1735
	if (!d)
1746
	if (!d || !d->data)
1736
	   return;
1747
	   return;
1737
 
1748
 
1738
#define CASE_PRINT(x) \
1749
#define CASE_PRINT(x) \
1739
  case data_D##x: garmin_print_d##x((D##x *)d->data); break
1750
  case data_D##x: garmin_print_d##x((D##x *)d->data); break
1740
 
1751