read heart rate
This commit is contained in:
parent
7af52b4fbf
commit
63f54a9355
@ -7,6 +7,7 @@ module Track
|
|||||||
elevation,
|
elevation,
|
||||||
cadence,
|
cadence,
|
||||||
power,
|
power,
|
||||||
|
heartRate,
|
||||||
time,
|
time,
|
||||||
parse,
|
parse,
|
||||||
Track.length,
|
Track.length,
|
||||||
@ -78,6 +79,11 @@ elToPoint c =
|
|||||||
>>= element (tpxNS "cad")
|
>>= element (tpxNS "cad")
|
||||||
>>= child
|
>>= child
|
||||||
>>= content
|
>>= content
|
||||||
|
hr =
|
||||||
|
gpxtpx
|
||||||
|
>>= element (tpxNS "hr")
|
||||||
|
>>= child
|
||||||
|
>>= content
|
||||||
power =
|
power =
|
||||||
gpxtpx
|
gpxtpx
|
||||||
>>= element (Name "PowerInWatts" (Just "http://www.garmin.com/xmlschemas/PowerExtension/v1") Nothing)
|
>>= element (Name "PowerInWatts" (Just "http://www.garmin.com/xmlschemas/PowerExtension/v1") Nothing)
|
||||||
@ -96,7 +102,7 @@ elToPoint c =
|
|||||||
utime
|
utime
|
||||||
(listToMaybe cadence <&> asInt)
|
(listToMaybe cadence <&> asInt)
|
||||||
(listToMaybe power <&> asInt)
|
(listToMaybe power <&> asInt)
|
||||||
Nothing
|
(listToMaybe hr <&> asInt)
|
||||||
where
|
where
|
||||||
asFloat v = (read (Data.Text.unpack v) :: Float)
|
asFloat v = (read (Data.Text.unpack v) :: Float)
|
||||||
asInt v = (read (Data.Text.unpack v) :: Int)
|
asInt v = (read (Data.Text.unpack v) :: Int)
|
||||||
|
@ -51,6 +51,7 @@ onepointWithAttrs =
|
|||||||
<extensions><gpxtpx:TrackPointExtension>
|
<extensions><gpxtpx:TrackPointExtension>
|
||||||
<gpxtpx:speed>2.4</gpxtpx:speed>
|
<gpxtpx:speed>2.4</gpxtpx:speed>
|
||||||
<gpxtpx:cad>128</gpxtpx:cad>
|
<gpxtpx:cad>128</gpxtpx:cad>
|
||||||
|
<gpxtpx:hr>160</gpxtpx:hr>
|
||||||
<pwr:PowerInWatts>55</pwr:PowerInWatts>
|
<pwr:PowerInWatts>55</pwr:PowerInWatts>
|
||||||
<opentracks:accuracy_horizontal>3.216</opentracks:accuracy_horizontal><opentracks:distance>10.675</opentracks:distance>
|
<opentracks:accuracy_horizontal>3.216</opentracks:accuracy_horizontal><opentracks:distance>10.675</opentracks:distance>
|
||||||
<cluetrust:distance>32.025</cluetrust:distance>
|
<cluetrust:distance>32.025</cluetrust:distance>
|
||||||
@ -108,8 +109,8 @@ test4 =
|
|||||||
( \(p : _) ->
|
( \(p : _) ->
|
||||||
assertEqual
|
assertEqual
|
||||||
"handles attributes"
|
"handles attributes"
|
||||||
(Just 25.2, Just 128, Just 55, Data.Time.UTCTime (toEnum 60606) 27299.779)
|
(Just 25.2, Just 128, Just 55, Data.Time.UTCTime (toEnum 60606) 27299.779, Just 160)
|
||||||
(Track.elevation p, Track.cadence p, Track.power p, Track.time p)
|
(Track.elevation p, Track.cadence p, Track.power p, Track.time p, Track.heartRate p)
|
||||||
)
|
)
|
||||||
(Track.parse onepointWithAttrs)
|
(Track.parse onepointWithAttrs)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user