/sportwatcher/trunk/libgarmin/byte_util.c |
---|
66,14 → 66,19 |
char * |
get_string ( garmin_packet * p, int * offset ) |
{ |
char * start = (char *)(p->packet.data + *offset); |
char * cursor = start; |
int allow = garmin_packet_size(p) - *offset; |
char * start; |
char * cursor; |
int allow; |
char * ret = NULL; |
int bytes = 0; |
/* early exit */ |
if (!p || !offset) return NULL; |
start = (char *)(p->packet.data + *offset); |
cursor = start; |
allow = garmin_packet_size(p) - *offset; |
if ( allow <= 0 ) return NULL; |
/* OK, we have space to work with. */ |
102,6 → 107,8 |
char * ret = NULL; |
int bytes = 0; |
if (!buf) return NULL; |
do { bytes++; } while ( *cursor++ ); |
ret = malloc(bytes); |
/sportwatcher/trunk/libgarmin/protocol.c |
---|
13,6 → 13,8 |
uint16 protocol, |
uint16 * datatypes ) |
{ |
if (!garmin) |
return; |
/* Unknown protocols and their data types are ignored. */ |
switch ( protocol ) { |
175,6 → 177,7 |
char ** pos; |
char ** ret = NULL; |
if (!one || !two) return ret; |
for ( pos = one, n1 = 0; pos && *pos; pos++, n1++ ); |
for ( pos = two, n2 = 0; pos && *pos; pos++, n2++ ); |
199,10 → 202,13 |
{ |
garmin_data * d = NULL; |
garmin_packet p; |
link_protocol link = garmin->protocol.link; |
link_protocol link; |
garmin_pid ppid; |
char hv0[256]; |
if (!garmin) return NULL; |
link = garmin->protocol.link; |
if ( garmin_read(garmin,&p) > 0 ) { |
ppid = garmin_gpid(link,garmin_packet_id(&p)); |
if ( ppid == pid ) { |
232,7 → 238,7 |
garmin_data * d = NULL; |
garmin_list * l = NULL; |
garmin_packet p; |
link_protocol link = garmin->protocol.link; |
link_protocol link; |
int done = 0; |
int expected = 0; |
int got = 0; |
239,6 → 245,9 |
garmin_pid ppid; |
char hv0[256]; |
if (!garmin) return NULL; |
link = garmin->protocol.link; |
if ( garmin_read(garmin,&p) > 0 ) { |
ppid = garmin_gpid(link,garmin_packet_id(&p)); |
if ( ppid == Pid_Records ) { |
309,7 → 318,7 |
garmin_data * d = NULL; |
garmin_list * l = NULL; |
garmin_packet p; |
link_protocol link = garmin->protocol.link; |
link_protocol link; |
int expected = 0; |
int got = 0; |
int state = 0; |
316,6 → 325,9 |
garmin_pid ppid; |
char hv0[256]; |
if (!garmin) return NULL; |
link = garmin->protocol.link; |
if ( garmin_read(garmin,&p) > 0 ) { |
ppid = garmin_gpid(link,garmin_packet_id(&p)); |
if ( ppid == Pid_Records ) { |
419,7 → 431,7 |
garmin_data * d = NULL; |
garmin_list * l = NULL; |
garmin_packet p; |
link_protocol link = garmin->protocol.link; |
link_protocol link; |
int expected = 0; |
int got = 0; |
garmin_pid ppid; |
426,6 → 438,9 |
int state = 0; |
char hv0[256]; |
if (!garmin) return NULL; |
link = garmin->protocol.link; |
if ( garmin_read(garmin,&p) > 0 ) { |
ppid = garmin_gpid(link,garmin_packet_id(&p)); |
if ( ppid == Pid_Records ) { |
544,6 → 559,7 |
uint16 data; |
uint16 * datatypes; |
if (!garmin) return; |
/* Send the product request */ |
garmin_packetize(&p,L000_Pid_Product_Rqst,0,NULL); |
garmin_write(garmin,&p); |
623,6 → 639,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_Transfer_Wpt) != 0 ) { |
d = garmin_read_records(garmin, |
Pid_Wpt_Data, |
642,6 → 660,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_Transfer_Wpt_Cats) != 0 ) { |
d = garmin_read_records(garmin, |
Pid_Wpt_Cat, |
661,6 → 681,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_Transfer_Rte) != 0 ) { |
d = garmin_read_records2(garmin, |
Pid_Rte_Hdr, |
682,6 → 704,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_Transfer_Rte) != 0 ) { |
d = garmin_read_records3(garmin, |
Pid_Rte_Hdr, |
705,6 → 729,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_Transfer_Trk) != 0 ) { |
d = garmin_read_records(garmin, |
Pid_Trk_Data, |
724,6 → 750,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_Transfer_Trk) != 0 ) { |
d = garmin_read_records2(garmin, |
Pid_Trk_Hdr, |
756,6 → 784,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_Transfer_Prx) != 0 ) { |
d = garmin_read_records(garmin, |
Pid_Prx_Wpt_Data, |
775,6 → 805,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_Transfer_Alm) != 0 ) { |
d = garmin_read_records(garmin, |
Pid_Almanac_Data, |
794,6 → 826,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
d = garmin_read_singleton(garmin, |
Pid_Date_Time_Data, |
garmin->datatype.date_time); |
811,6 → 845,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_FlightBook_Transfer) ) { |
d = garmin_read_records(garmin, |
Pid_FlightBook_Record, |
830,6 → 866,8 |
{ |
garmin_data * d; |
if (!garmin) return NULL; |
d = garmin_read_singleton(garmin, |
Pid_Position_Data, |
garmin->datatype.position); |
847,6 → 885,8 |
{ |
garmin_data * d; |
if (!garmin) return NULL; |
d = garmin_read_singleton(garmin, |
Pid_Pvt_Data, |
garmin->datatype.pvt); |
864,6 → 904,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_Transfer_Laps) != 0 ) { |
d = garmin_read_records(garmin,Pid_Lap,garmin->datatype.lap); |
} |
882,6 → 924,8 |
garmin_data * d = NULL; |
garmin_list * l = NULL; |
if (!garmin) return NULL; |
/* Read the runs, then the laps, then the track log. */ |
if ( garmin_send_command(garmin,Cmnd_Transfer_Runs) != 0 ) { |
907,6 → 951,8 |
garmin_data * d = NULL; |
garmin_list * l = NULL; |
if (!garmin) return NULL; |
/* Read the workouts, then the workout occurrences */ |
if ( garmin_send_command(garmin,Cmnd_Transfer_Workouts) != 0 ) { |
932,6 → 978,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
/* Read the workouts, then the workout occurrences */ |
if ( garmin_send_command(garmin,Cmnd_Transfer_Workout_Occurrences) != 0 ) { |
953,6 → 1001,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_Transfer_Fitness_User_Profile) != 0 ) { |
d = garmin_read_singleton(garmin, |
Pid_Fitness_User_Profile, |
972,6 → 1022,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_Transfer_Workout_Limits) != 0 ) { |
d = garmin_read_singleton(garmin, |
Pid_Workout_Limits, |
992,6 → 1044,8 |
garmin_data * d = NULL; |
garmin_list * l = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_Transfer_Courses) != 0 ) { |
d = garmin_alloc_data(data_Dlist); |
l = d->data; |
1016,6 → 1070,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_Transfer_Course_Laps) != 0 ) { |
d = garmin_read_records(garmin, |
Pid_Course_Lap, |
1037,6 → 1093,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_Transfer_Course_Points) != 0 ) { |
d = garmin_read_records(garmin, |
Pid_Course_Point, |
1056,6 → 1114,8 |
{ |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_Transfer_Course_Limits) != 0 ) { |
d = garmin_read_singleton(garmin, |
Pid_Course_Limits, |
1077,6 → 1137,8 |
garmin_datatype data; |
garmin_data * d = NULL; |
if (!garmin) return NULL; |
if ( garmin_send_command(garmin,Cmnd_Transfer_Course_Tracks) != 0 ) { |
if ( garmin->datatype.course.track.header != data_Dnil ) { |
1111,6 → 1173,8 |
{ |
garmin_data * data = NULL; |
if (!garmin) return NULL; |
#define CASE_PROTOCOL(x) \ |
case appl_A##x: \ |
if ( garmin->verbose != 0 ) { \ |
1158,6 → 1222,8 |
{ |
garmin_data * data = NULL; |
if (!garmin) return NULL; |
#define CASE_WHAT(x,y) \ |
case GET_##x: data = garmin_read_via(garmin,garmin->protocol.y); break |
1188,6 → 1254,8 |
int garmin_init(garmin_unit *garmin, int verbose) |
{ |
if (!garmin) return 0; |
memset(garmin, 0, sizeof(garmin_unit)); |
garmin->verbose = verbose; |
garmin->usb.fd = -1; |
/sportwatcher/trunk/libgarmin/usb_comm.c |
---|
65,6 → 65,9 |
int garmin_close(garmin_unit *garmin) |
{ |
if (!garmin) |
return 1; |
if (method && garmin->usb.fd != -1) |
{ |
if (isatty(garmin->usb.fd)) |
108,6 → 111,9 |
char hv0[1024]; |
struct termios tp; |
if (!garmin) |
return 0; |
if (method && garmin->usb.fd == -1) |
{ |
/* check for USB serial drivers -- very Linux-specific */ |
247,6 → 253,9 |
{ |
unsigned int rate; |
if (!garmin) |
return 0; |
if (speed < 300) |
rate = B0; |
else if (speed < 1200) |
291,6 → 300,7 |
uint8 garmin_packet_type(garmin_packet *p) |
{ |
if (!p) return 0; |
return p->packet.type; |
} |
297,6 → 307,7 |
uint16 garmin_packet_id(garmin_packet *p) |
{ |
if (!p) return 0; |
return get_uint16(p->packet.id); |
} |
303,6 → 314,7 |
uint32 garmin_packet_size(garmin_packet *p) |
{ |
if (!p) return 0; |
return get_uint32(p->packet.size); |
} |
309,6 → 321,7 |
uint8 *garmin_packet_data(garmin_packet *p) |
{ |
if (!p) return 0; |
return p->packet.data; |
} |
317,6 → 330,8 |
{ |
int ok = 0; |
if (!p) return 0; |
if (size + PACKET_HEADER_SIZE < sizeof(garmin_packet)) |
{ |
p->packet.type = GARMIN_PROTOCOL_APP; |
356,6 → 371,8 |
int ok = 0; |
char hv0[1024]; |
if (!garmin) return 0; |
if (garmin->usb.fd == -1 && garmin->usb.handle == NULL) |
garmin_open(garmin); |
465,6 → 482,9 |
int r = -1; |
int s = garmin_packet_size(p) + PACKET_HEADER_SIZE; |
if (!garmin) |
return 0; |
if (garmin->usb.fd == -1 && garmin->usb.handle == NULL) |
garmin_open(garmin); |
516,6 → 536,9 |
int sel_ret = 0; |
int ok = 0; |
if (!garmin) |
return 0; |
garmin_packetize(&p, Pid_Start_Session, 0, NULL); |
p.packet.type = GARMIN_PROTOCOL_USB; |
551,6 → 574,9 |
char hex[128]; |
char dec[128]; |
if (!p) |
return; |
s = garmin_packet_size(p); |
switch ( dir ) |
/sportwatcher/trunk/libgarmin/run.c |
---|
17,6 → 17,8 |
int ok = 1; |
if (!run) return 0; |
switch ( run->type ) { |
case data_D1000: |
d1000 = run->data; |
55,6 → 57,8 |
int ok = 1; |
if (!lap) return 0; |
switch ( lap->type ) { |
case data_D1001: |
d1001 = lap->data; |
87,6 → 91,8 |
int ok = 1; |
if (!lap) return 0; |
switch ( lap->type ) { |
case data_D1001: |
d1001 = lap->data; |
120,6 → 126,8 |
/* Look for a data_D311 with an index that matches. */ |
if (!points) return NULL; |
for ( n = points->head; n != NULL; n = n->next ) { |
if ( n->data != NULL ) { |
switch ( n->data->type ) { |
184,6 → 192,8 |
char filepath[BUFSIZ]; |
struct tm * tbuf; |
if (!garmin) return; |
if ( (filedir = getenv("GARMIN_SAVE_RUNS")) != NULL ) { |
filedir = realpath(filedir,path); |
if ( filedir == NULL ) { |
/sportwatcher/trunk/libgarmin/datatype.c |
---|
12,6 → 12,9 |
{ |
garmin_data * d = malloc(sizeof(garmin_data)); |
if (!d) |
return NULL; |
d->type = type; |
#define CASE_DATA(x) \ |
87,7 → 90,9 |
{ |
garmin_list * l; |
l = calloc(1,sizeof(garmin_list)); |
if ((l = calloc(1,sizeof(garmin_list))) == NULL) |
return NULL; |
l->id = ++gListId; |
return l; |
97,24 → 102,34 |
garmin_list * |
garmin_list_append ( garmin_list * list, garmin_data * data ) |
{ |
garmin_list * l = list; |
garmin_list_node * n; |
garmin_list * l = list; |
garmin_list_node * n; |
if ( data != NULL ) { |
if ( l == NULL ) l = garmin_alloc_list(); |
n = malloc(sizeof(garmin_list_node)); |
if ( data != NULL ) |
{ |
if ( l == NULL ) |
{ |
if ((l = garmin_alloc_list()) == NULL) |
return NULL; |
} |
n->data = data; |
n->next = NULL; |
if ((n = malloc(sizeof(garmin_list_node))) == NULL) |
return NULL; |
if ( l->head == NULL ) l->head = n; |
if ( l->tail != NULL ) l->tail->next = n; |
l->tail = n; |
n->data = data; |
n->next = NULL; |
l->elements++; |
} |
if ( l->head == NULL ) |
l->head = n; |
return l; |
if ( l->tail != NULL ) |
l->tail->next = n; |
l->tail = n; |
l->elements++; |
} |
return l; |
} |
/sportwatcher/trunk/libgarmin/command.c |
---|
13,6 → 13,9 |
{ |
int ret = 0; |
if (!garmin) |
return 0; |
switch ( cmd ) { |
case Cmnd_Abort_Transfer: |
case Cmnd_Turn_Off_Pwr: |
127,6 → 130,9 |
uint16 p = 0; |
uint8 b[2]; |
if (!garmin) |
return 0; |
/* Determine the packet ID based on the link protocol. */ |
switch ( garmin->protocol.link ) { |
213,6 → 219,9 |
garmin_packet packet; |
int ret = 0; |
if (!garmin) |
return 0; |
if ( garmin_command_supported(garmin,cmd) && |
garmin_make_command_packet(garmin,cmd,&packet) ) { |
ret = garmin_write(garmin,&packet); |
/sportwatcher/trunk/libgarmin/pack.c |
---|
34,6 → 34,9 |
static void |
garmin_pack_d100 ( D100 * wpt, uint8 ** pos ) |
{ |
if (!wpt || !pos) |
return; |
PUTSTR(wpt->ident); |
PUTPOS(wpt->posn); |
SKIP(4); |
48,6 → 51,9 |
static void |
garmin_pack_d101 ( D101 * wpt, uint8 ** pos ) |
{ |
if (!wpt || !pos) |
return; |
PUTSTR(wpt->ident); |
PUTPOS(wpt->posn); |
SKIP(4); |
64,6 → 70,9 |
static void |
garmin_pack_d102 ( D102 * wpt, uint8 ** pos ) |
{ |
if (!wpt || !pos) |
return; |
PUTSTR(wpt->ident); |
PUTPOS(wpt->posn); |
SKIP(4); |
80,6 → 89,9 |
static void |
garmin_pack_d103 ( D103 * wpt, uint8 ** pos ) |
{ |
if (!wpt || !pos) |
return; |
PUTSTR(wpt->ident); |
PUTPOS(wpt->posn); |
SKIP(4); |
96,6 → 108,9 |
static void |
garmin_pack_d104 ( D104 * wpt, uint8 ** pos ) |
{ |
if (!wpt || !pos) |
return; |
PUTSTR(wpt->ident); |
PUTPOS(wpt->posn); |
SKIP(4); |
113,6 → 128,9 |
static void |
garmin_pack_d105 ( D105 * wpt, uint8 ** pos ) |
{ |
if (!wpt || !pos) |
return; |
PUTPOS(wpt->posn); |
PUTU16(wpt->smbl); |
PUTVST(wpt->wpt_ident); |
126,6 → 144,9 |
static void |
garmin_pack_d106 ( D106 * wpt, uint8 ** pos ) |
{ |
if (!wpt || !pos) |
return; |
PUTU8(wpt->wpt_class); |
PUTSTR(wpt->subclass); |
PUTPOS(wpt->posn); |
142,6 → 163,9 |
static void |
garmin_pack_d107 ( D107 * wpt, uint8 ** pos ) |
{ |
if (!wpt || !pos) |
return; |
PUTSTR(wpt->ident); |
PUTPOS(wpt->posn); |
SKIP(4); |
160,6 → 184,9 |
static void |
garmin_pack_d108 ( D108 * wpt, uint8 ** pos ) |
{ |
if (!wpt || !pos) |
return; |
PUTU8(wpt->wpt_class); |
PUTU8(wpt->color); |
PUTU8(wpt->dspl); |
188,6 → 215,9 |
static void |
garmin_pack_d109 ( D109 * wpt, uint8 ** pos ) |
{ |
if (!wpt || !pos) |
return; |
PUTU8(wpt->dtyp); |
PUTU8(wpt->wpt_class); |
PUTU8(wpt->dspl_color); |
217,6 → 247,9 |
static void |
garmin_pack_d110 ( D110 * wpt, uint8 ** pos ) |
{ |
if (!wpt || !pos) |
return; |
PUTU8(wpt->dtyp); |
PUTU8(wpt->wpt_class); |
PUTU8(wpt->dspl_color); |
249,6 → 282,9 |
static void |
garmin_pack_d120 ( D120 * cat, uint8 ** pos ) |
{ |
if (!cat || !pos) |
return; |
PUTSTR(cat->name); |
} |
260,6 → 296,9 |
static void |
garmin_pack_d150 ( D150 * wpt, uint8 ** pos ) |
{ |
if (!wpt || !pos) |
return; |
PUTSTR(wpt->ident); |
PUTSTR(wpt->cc); |
PUTU8(wpt->wpt_class); |
279,6 → 318,9 |
static void |
garmin_pack_d151 ( D151 * wpt, uint8 ** pos ) |
{ |
if (!wpt || !pos) |
return; |
PUTSTR(wpt->ident); |
PUTPOS(wpt->posn); |
SKIP(4); |
301,6 → 343,9 |
static void |
garmin_pack_d152 ( D152 * wpt, uint8 ** pos ) |
{ |
if (!wpt || !pos) |
return; |
PUTSTR(wpt->ident); |
PUTPOS(wpt->posn); |
SKIP(4); |
323,6 → 368,9 |
static void |
garmin_pack_d154 ( D154 * wpt, uint8 ** pos ) |
{ |
if (!wpt || !pos) |
return; |
PUTSTR(wpt->ident); |
PUTPOS(wpt->posn); |
SKIP(4); |
346,6 → 394,9 |
static void |
garmin_pack_d155 ( D155 * wpt, uint8 ** pos ) |
{ |
if (!wpt || !pos) |
return; |
PUTSTR(wpt->ident); |
PUTPOS(wpt->posn); |
SKIP(4); |
370,6 → 421,9 |
static void |
garmin_pack_d200 ( D200 * hdr, uint8 ** pos ) |
{ |
if (!hdr) |
return; |
PUTU8(*hdr); |
} |
381,6 → 435,9 |
static void |
garmin_pack_d201 ( D201 * hdr, uint8 ** pos ) |
{ |
if (!hdr || !pos) |
return; |
PUTU8(hdr->nmbr); |
PUTSTR(hdr->cmnt); |
} |
393,6 → 450,9 |
static void |
garmin_pack_d202 ( D202 * hdr, uint8 ** pos ) |
{ |
if (!hdr || !pos) |
return; |
PUTVST(hdr->rte_ident); |
} |
404,6 → 464,9 |
static void |
garmin_pack_d210 ( D210 * link, uint8 ** pos ) |
{ |
if (!link || !pos) |
return; |
PUTU16(link->class); |
PUTSTR(link->subclass); |
PUTVST(link->ident); |
417,6 → 480,9 |
static void |
garmin_pack_d300 ( D300 * point, uint8 ** pos ) |
{ |
if (!point || !pos) |
return; |
PUTPOS(point->posn); |
PUTU32(point->time); |
PUTU8(point->new_trk); |
430,6 → 496,9 |
static void |
garmin_pack_d301 ( D301 * point, uint8 ** pos ) |
{ |
if (!point || !pos) |
return; |
PUTPOS(point->posn); |
PUTU32(point->time); |
PUTF32(point->alt); |
445,6 → 514,9 |
static void |
garmin_pack_d302 ( D302 * point, uint8 ** pos ) |
{ |
if (!point || !pos) |
return; |
PUTPOS(point->posn); |
PUTU32(point->time); |
PUTF32(point->alt); |
461,6 → 533,9 |
static void |
garmin_pack_d303 ( D303 * point, uint8 ** pos ) |
{ |
if (!point || !pos) |
return; |
PUTPOS(point->posn); |
PUTU32(point->time); |
PUTF32(point->alt); |
475,6 → 550,9 |
static void |
garmin_pack_d304 ( D304 * point, uint8 ** pos ) |
{ |
if (!point || !pos) |
return; |
PUTPOS(point->posn); |
PUTU32(point->time); |
PUTF32(point->alt); |
492,6 → 570,9 |
static void |
garmin_pack_d310 ( D310 * hdr, uint8 ** pos ) |
{ |
if (!hdr || !pos) |
return; |
PUTU8(hdr->dspl); |
PUTU8(hdr->color); |
PUTVST(hdr->trk_ident); |
505,6 → 586,9 |
static void |
garmin_pack_d311 ( D311 * hdr, uint8 ** pos ) |
{ |
if (!hdr) |
return; |
PUTU16(hdr->index); |
} |
516,6 → 600,9 |
static void |
garmin_pack_d312 ( D312 * hdr, uint8 ** pos ) |
{ |
if (!hdr) |
return; |
PUTU8(hdr->dspl); |
PUTU8(hdr->color); |
PUTVST(hdr->trk_ident); |
529,6 → 616,9 |
static void |
garmin_pack_d400 ( D400 * prx, uint8 ** pos ) |
{ |
if (!prx) |
return; |
garmin_pack_d100(&prx->wpt,pos); |
SKIP(sizeof(D100)); |
PUTF32(prx->dst); |
542,6 → 632,9 |
static void |
garmin_pack_d403 ( D403 * prx, uint8 ** pos ) |
{ |
if (!prx) |
return; |
garmin_pack_d103(&prx->wpt,pos); |
SKIP(sizeof(D103)); |
PUTF32(prx->dst); |
555,6 → 648,9 |
static void |
garmin_pack_d450 ( D450 * prx, uint8 ** pos ) |
{ |
if (!prx) |
return; |
PUTU32(prx->idx); |
garmin_pack_d150(&prx->wpt,pos); |
SKIP(sizeof(D150)); |
569,6 → 665,9 |
static void |
garmin_pack_d500 ( D500 * alm, uint8 ** pos ) |
{ |
if (!alm) |
return; |
PUTU16(alm->wn); |
PUTF32(alm->toa); |
PUTF32(alm->af0); |
590,6 → 689,9 |
static void |
garmin_pack_d501 ( D501 * alm, uint8 ** pos ) |
{ |
if (!alm) |
return; |
PUTU16(alm->wn); |
PUTF32(alm->toa); |
PUTF32(alm->af0); |
612,6 → 714,9 |
static void |
garmin_pack_d550 ( D550 * alm, uint8 ** pos ) |
{ |
if (!alm) |
return; |
PUTU8(alm->svid); |
PUTU16(alm->wn); |
PUTF32(alm->toa); |
634,6 → 739,9 |
static void |
garmin_pack_d551 ( D551 * alm, uint8 ** pos ) |
{ |
if (!alm) |
return; |
PUTU8(alm->svid); |
PUTU16(alm->wn); |
PUTF32(alm->toa); |
657,6 → 765,9 |
static void |
garmin_pack_d600 ( D600 * dt, uint8 ** pos ) |
{ |
if (!dt) |
return; |
PUTU8(dt->month); |
PUTU8(dt->day); |
PUTU16(dt->year); |
673,6 → 784,9 |
static void |
garmin_pack_d650 ( D650 * fbr, uint8 ** pos ) |
{ |
if (!fbr) |
return; |
PUTU32(fbr->takeoff_time); |
PUTU32(fbr->landing_time); |
PUTPOS(fbr->takeoff_posn); |
709,6 → 823,9 |
static void |
garmin_pack_d800 ( D800 * pvt, uint8 ** pos ) |
{ |
if (!pvt) |
return; |
PUTF32(pvt->alt); |
PUTF32(pvt->epe); |
PUTF32(pvt->eph); |
732,6 → 849,9 |
static void |
garmin_pack_d906 ( D906 * lap, uint8 ** pos ) |
{ |
if (!lap) |
return; |
PUTU32(lap->start_time); |
PUTU32(lap->total_time); |
PUTF32(lap->total_distance); |
753,6 → 873,9 |
static void |
garmin_pack_d1000 ( D1000 * run, uint8 ** pos ) |
{ |
if (!run) |
return; |
PUTU32(run->track_index); |
PUTU32(run->first_lap_index); |
PUTU32(run->last_lap_index); |
772,6 → 895,9 |
static void |
garmin_pack_d1001 ( D1001 * lap, uint8 ** pos ) |
{ |
if (!lap) |
return; |
PUTU32(lap->index); |
PUTU32(lap->start_time); |
PUTU32(lap->total_time); |
795,6 → 921,9 |
{ |
int i; |
if (!wkt) |
return; |
PUTU32(wkt->num_valid_steps); |
for ( i = 0; i < 20; i++ ) { |
PUTSTR(wkt->steps[i].custom_name); |
819,6 → 948,9 |
static void |
garmin_pack_d1003 ( D1003 * occ, uint8 ** pos ) |
{ |
if (!occ) |
return; |
PUTSTR(occ->workout_name); |
PUTU32(occ->day); |
} |
834,6 → 966,9 |
int i; |
int j; |
if (!prof) |
return; |
for ( i = 0; i < 3; i++ ) { |
for ( j = 0; j < 5; j++ ) { |
PUTU8(prof->activities[i].heart_rate_zones[j].low_heart_rate); |
864,6 → 999,9 |
static void |
garmin_pack_d1005 ( D1005 * limits, uint8 ** pos ) |
{ |
if (!limits) |
return; |
PUTU32(limits->max_workouts); |
PUTU32(limits->max_unscheduled_workouts); |
PUTU32(limits->max_occurrences); |
877,6 → 1015,9 |
static void |
garmin_pack_d1006 ( D1006 * course, uint8 ** pos ) |
{ |
if (!course) |
return; |
PUTU16(course->index); |
SKIP(2); |
PUTSTR(course->course_name); |
891,6 → 1032,9 |
static void |
garmin_pack_d1007 ( D1007 * lap, uint8 ** pos ) |
{ |
if (!lap) |
return; |
PUTU16(lap->course_index); |
PUTU16(lap->lap_index); |
PUTU32(lap->total_time); |
911,6 → 1055,9 |
static void |
garmin_pack_d1008 ( D1008 * wkt, uint8 ** pos ) |
{ |
if (!wkt) |
return; |
garmin_pack_d1002((D1002 *)wkt,pos); |
} |
922,6 → 1069,9 |
static void |
garmin_pack_d1009 ( D1009 * run, uint8 ** pos ) |
{ |
if (!run) |
return; |
PUTU16(run->track_index); |
PUTU16(run->first_lap_index); |
PUTU16(run->last_lap_index); |
942,6 → 1092,9 |
static void |
garmin_pack_d1010 ( D1010 * run, uint8 ** pos ) |
{ |
if (!run) |
return; |
PUTU32(run->track_index); |
PUTU32(run->first_lap_index); |
PUTU32(run->last_lap_index); |
962,6 → 1115,9 |
static void |
garmin_pack_d1011 ( D1011 * lap, uint8 ** pos ) |
{ |
if (!lap) |
return; |
PUTU16(lap->index); |
SKIP(2); |
PUTU32(lap->start_time); |
986,6 → 1142,9 |
static void |
garmin_pack_d1012 ( D1012 * point, uint8 ** pos ) |
{ |
if (!point) |
return; |
PUTSTR(point->name); |
SKIP(1); |
PUTU16(point->course_index); |
1002,6 → 1161,9 |
static void |
garmin_pack_d1013 ( D1013 * limits, uint8 ** pos ) |
{ |
if (!limits) |
return; |
PUTU32(limits->max_courses); |
PUTU32(limits->max_course_laps); |
PUTU32(limits->max_course_pnt); |
1016,6 → 1178,9 |
static void |
garmin_pack_d1015 ( D1015 * lap, uint8 ** pos ) |
{ |
if (!lap) |
return; |
PUTU16(lap->index); |
SKIP(2); |
PUTU32(lap->start_time); |
1048,6 → 1213,9 |
{ |
garmin_list_node * node; |
if (!list) |
return; |
PUTU32(list->id); |
PUTU32(list->elements); |
for ( node = list->head; node != NULL; node = node->next ) { |
1260,7 → 1428,7 |
uint32 bytes = 0; |
char hv0[256]; |
if ( garmin_data_size(data) == 0 ) return 0; |
if ( !data || garmin_data_size(data) == 0 ) return 0; |
/* OK, we must know how to serialize this data. Let's go for it. */ |