diff --git a/src/tcxparser.cpp b/src/tcxparser.cpp index 5a3c53c6..c9abfb1b 100644 --- a/src/tcxparser.cpp +++ b/src/tcxparser.cpp @@ -56,6 +56,16 @@ Coordinates TCXParser::position() return pos; } +void TCXParser::heartRateBpm(Trackpoint &trackpoint) +{ + while (_reader.readNextStartElement()) { + if (_reader.name() == "Value") + trackpoint.setHeartRate(number()); + else + _reader.skipCurrentElement(); + } +} + void TCXParser::extensions(Trackpoint &trackpoint) { while (_reader.readNextStartElement()) { @@ -78,7 +88,7 @@ void TCXParser::trackpointData(Trackpoint &trackpoint) else if (_reader.name() == "Time") trackpoint.setTimestamp(time()); else if (_reader.name() == "HeartRateBpm") - trackpoint.setHeartRate(number()); + heartRateBpm(trackpoint); else if (_reader.name() == "Cadence") trackpoint.setCadence(number()); else if (_reader.name() == "Extensions") diff --git a/src/tcxparser.h b/src/tcxparser.h index 8a001d6e..b1490c65 100644 --- a/src/tcxparser.h +++ b/src/tcxparser.h @@ -26,6 +26,7 @@ private: void trackpointData(Trackpoint &trackpoint); void waypointData(Waypoint &waypoint); void extensions(Trackpoint &trackpoint); + void heartRateBpm(Trackpoint &trackpoint); Coordinates position(); qreal number(); QDateTime time();