Skip to content

Commit

Permalink
Merge pull request #354 from juanro49/master
Browse files Browse the repository at this point in the history
Add some info to exported tcx file
  • Loading branch information
piggz authored Apr 12, 2024
2 parents 477c46e + ed1765d commit 9110bcc
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions daemon/src/bipactivitydetailparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,38 @@ QString BipActivityDetailParser::toTCX()
out << "<Activities>" << endl;
out << "<Activity Sport=\"" + ActivityKind::toString(m_summary.activityKind()) + "\">" << endl;
out << "<Id>" << m_summary.name() << "</Id>" << endl;
out << "<Lap StartTime=\"" << m_summary.startTime().toTimeSpec(Qt::OffsetFromUTC).toString(Qt::ISODate) << "\">" << endl;

//TotalTimeSeconds
ActivitySummary::meta m = m_summary.metaData("activeSeconds");
if (m.key == "activeSeconds") {
out << "<TotalTimeSeconds>" << m.value << "</TotalTimeSeconds>" << endl;
}

ActivitySummary::meta m = m_summary.metaData("caloriesBurnt");
//DistanceMeters
m = m_summary.metaData("distanceMeters");
if (m.key == "distanceMeters") {
out << "<DistanceMeters>" << m.value << "</DistanceMeters>" << endl;
}

//Calories
m = m_summary.metaData("caloriesBurnt");
if (m.key == "caloriesBurnt") {
out << "<Calories>" << m.value << "</Calories>" << endl;
}

out << "<Lap StartTime=\"" << m_summary.startTime().toTimeSpec(Qt::OffsetFromUTC).toString(Qt::ISODate) << "\">" << endl;
//AverageHeartRateBpm
m = m_summary.metaData("averageHR");
if (m.key == "averageHR") {
out << "<AverageHeartRateBpm><Value>" << m.value << "</Value></AverageHeartRateBpm>" << endl;
}

//MaximumHeartRateBpm
m = m_summary.metaData("maxHR");
if (m.key == "maxHR") {
out << "<MaximumHeartRateBpm><Value>" << m.value << "</Value></MaximumHeartRateBpm>" << endl;
}

out << "<Track>" << endl;

foreach(ActivityCoordinate pos, m_activityTrack) {
Expand All @@ -330,7 +355,19 @@ QString BipActivityDetailParser::toTCX()
out << "<HeartRateBpm xsi:type=\"HeartRateInBeatsPerMinute_t\"><Value>" << pos.heartRate() << "</Value></HeartRateBpm>" << endl;
out << "</Trackpoint>" << endl;
}

out << "</Track>" << endl;

//Steps
m = m_summary.metaData("steps");
if (m.key == "steps") {
out << "<Extensions>" << endl;
out << " <LX xmlns=\"http://www.garmin.com/xmlschemas/ActivityExtension/v2\">" << endl;
out << " <Steps>" << m.value << "</Steps>" << endl;
out << " </LX>" << endl;
out << "</Extensions>" << endl;
}

out << "</Lap>" << endl;

//Creator
Expand Down

0 comments on commit 9110bcc

Please sign in to comment.