Skip to content

Commit

Permalink
Add TotalTimeSeconds, DistanceMeters, AverageHeartRateBpm and Maximum…
Browse files Browse the repository at this point in the history
…HeartRateBpm to tcx file
  • Loading branch information
juanro49 committed Mar 29, 2024
1 parent 62931bb commit ed1765d
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion daemon/src/bipactivitydetailparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,36 @@ QString BipActivityDetailParser::toTCX()
out << "<Id>" << m_summary.name() << "</Id>" << endl;
out << "<Lap StartTime=\"" << m_summary.startTime().toTimeSpec(Qt::OffsetFromUTC).toString(Qt::ISODate) << "\">" << endl;

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

//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;
}

//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 @@ -329,6 +355,7 @@ QString BipActivityDetailParser::toTCX()
out << "<HeartRateBpm xsi:type=\"HeartRateInBeatsPerMinute_t\"><Value>" << pos.heartRate() << "</Value></HeartRateBpm>" << endl;
out << "</Trackpoint>" << endl;
}

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

//Steps
Expand Down

0 comments on commit ed1765d

Please sign in to comment.