/* Output something interesing when we can for route and trackpoints */ static void kml_output_description(const waypoint *pt) { char *alt_units; double alt; if (!trackdata) { return; } alt = fmt_distance(pt->altitude, &alt_units); kml_write_xml(1, "<description><![CDATA[\n"); kml_write_xml(1, "<table>\n"); TD("Longitude: %f", pt->longitude); TD("Latitude: %f", pt->latitude); if (pt->altitude != unknown_alt) TD2("Altitude: %.3f %s", alt, alt_units); if (pt->heartrate) TD("Heart rate: %d", pt->heartrate); if (pt->cadence) TD("Cadence: %d", pt->cadence); /* Which unit is this temp in? C? F? K? */ if WAYPT_HAS(pt, temperature) TD("Temperature: %.1f", pt->temperature); if WAYPT_HAS(pt, depth) { char *depth_units; double depth = fmt_distance(pt->depth, &depth_units); TD2("Depth: %.1f %s", depth, depth_units); }
void ROUND(int i, u32* d0, u32* d1, u32* d2, u32* d3, u32 s0, u32 s1, u32 s2, u32 s3, const u32 rk[/*44*/]) { *d0 = TD0(s0) ^ TD1(s3) ^ TD2(s2) ^ TD3(s1) ^ rk[4 * i]; *d1 = TD0(s1) ^ TD1(s0) ^ TD2(s3) ^ TD3(s2) ^ rk[4 * i + 1]; *d2 = TD0(s2) ^ TD1(s1) ^ TD2(s0) ^ TD3(s3) ^ rk[4 * i + 2]; *d3 = TD0(s3) ^ TD1(s2) ^ TD2(s1) ^ TD3(s0) ^ rk[4 * i + 3]; }
void ROUND(int i, u32* d0, u32* d1, u32* d2, u32* d3, u32 s0, u32 s1, u32 s2, u32 s3, const u32 rk[/*44*/]) { *d0 = TD0(s0) ^ TD1(s3) ^ TD2(s2) ^ TD3(s1) ^ rk[4 * i]; *d1 = TD0(s1) ^ TD1(s0) ^ TD2(s3) ^ TD3(s2) ^ rk[4 * i + 1]; *d2 = TD0(s2) ^ TD1(s1) ^ TD2(s0) ^ TD3(s3) ^ rk[4 * i + 2]; *d3 = TD0(s3) ^ TD1(s2) ^ TD2(s1) ^ TD3(s0) ^ rk[4 * i + 3]; /* *d0 = TE0(s0) ^ TE1(s1) ^ TE2(s2) ^ TE3(s3) ^ rk[4 * i]; *d1 = TE0(s1) ^ TE1(s2) ^ TE2(s3) ^ TE3(s0) ^ rk[4 * i + 1]; *d2 = TE0(s2) ^ TE1(s3) ^ TE2(s0) ^ TE3(s1) ^ rk[4 * i + 2]; *d3 = TE0(s3) ^ TE1(s0) ^ TE2(s1) ^ TE3(s2) ^ rk[4 * i + 3]; */ //printf("i=%d rk %#x,%#x,%#x,%#x\n",i,rk[4 * i], rk[4 * i + 1], rk[4 * i + 2], rk[4 * i + 3]); //printf("d0 %d\n", *d0); }
/* * Output the track summary. */ static void kml_output_trkdescription(const route_head *header, computed_trkdata *td) { char *max_alt_units; double max_alt; char *min_alt_units; double min_alt; char *distance_units; double distance; if (!td || !trackdata) { return; } max_alt = fmt_distance(td->max_alt, &max_alt_units); min_alt = fmt_distance(td->min_alt, &min_alt_units); distance = fmt_distance(td->distance_meters, &distance_units); kml_write_xml(0, "<Snippet/>\n"); kml_write_xml(1, "<description>\n"); kml_write_xml(1, "<![CDATA[<table>\n"); if (header->rte_desc) { TD("<b>Description</b> %s", header->rte_desc); } TD2("<b>Distance</b> %.1f %s", distance, distance_units); if (min_alt != unknown_alt) { TD2("<b>Min Alt</b> %.3f %s", min_alt, min_alt_units); } if (max_alt != unknown_alt) { TD2("<b>Max Alt</b> %.3f %s", max_alt, max_alt_units); } if (td->min_spd) { char *spd_units; double spd = fmt_speed(td->min_spd, &spd_units); TD2("<b>Min Speed</b> %.1f %s", spd, spd_units); } if (td->max_spd) { char *spd_units; double spd = fmt_speed(td->max_spd, &spd_units); TD2("<b>Max Speed</b> %.1f %s", spd, spd_units); } if (td->max_spd && td->start && td->end) { char *spd_units; time_t elapsed = td->end - td->start; double spd = fmt_speed(td->distance_meters / elapsed, &spd_units); if (spd > 1.0) { TD2("<b>Avg Speed</b> %.1f %s", spd, spd_units); } } if (td->avg_hrt) { TD("<b>Avg Heart Rate</b> %.1f bpm", td->avg_hrt); } if (td->min_hrt < td->max_hrt) { TD("<b>Min Heart Rate</b> %d bpm", td->min_hrt); } if (td->max_hrt) { TD("<b>Max Heart Rate</b> %d bpm", td->max_hrt); } if (td->avg_cad) { TD("<b>Avg Cadence</b> %.1f rpm", td->avg_cad); } if (td->max_cad) { TD("<b>Max Cadence</b> %d rpm", td->max_cad); } if (td->start && td->end) { char time_string[64]; xml_fill_in_time(time_string, td->start, 0, XML_LONG_TIME); TD("<b>Start Time</b> %s ", time_string); xml_fill_in_time(time_string, td->end, 0, XML_LONG_TIME); TD("<b>End Time</b> %s ", time_string); } kml_write_xml(-1, "</table>]]>\n"); kml_write_xml(-1, "</description>\n"); /* We won't always have times. Garmin saved tracks, for example... */ if (td->start && td->end) { char time_string[64]; kml_write_xml(1, "<TimeSpan>\n"); xml_fill_in_time(time_string, td->start, 0, XML_LONG_TIME); kml_write_xml(0, "<begin>%s</begin>\n", time_string); xml_fill_in_time(time_string, td->end, 0, XML_LONG_TIME); kml_write_xml(0, "<end>%s</end>\n", time_string); kml_write_xml(-1, "</TimeSpan>\n"); } }