Locus API, get heart rate value

Started by mzperx, January 05, 2017, 16:19:37

0 Members and 1 Guest are viewing this topic.

mzperx

Hi,

is it possible to retrieve the actual heart rate value from Locus API? I would like to extend the "Locus Map - add-on Wearables" to see the actual heart rate on the watch.
  •  

Menion

Hello,

to fill track recording screen on watches is used this method: https://github.com/asamm/locus-addon-wearables/blob/master/wear/src/main/java/com/asamm/locus/addon/wearables/gui/TrackRecordActivity.java#L189

Here is a key object : TrackStats . This object contains also Heart rate values, see here: https://github.com/asamm/locus-api/blob/master/locus-api/src/main/java/locus/api/objects/extra/TrackStats.java#L376 , so you may simple use getHrmAvg() or getHrmMax() functions. Value '0' means that no HRM was recorded yet.
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

mzperx

Hello Menion,

thank you for your fast reply!
I have already found the function and the object and I have already added hrmAvg and hrmMax to my fork of the add-on, but I would like to add the actual heart rate value too (the actual heart beatings) this is what I have referred to in my first post.
I have found neither UpdateContainer nor TrackStats contains this value this is why I think I should extend they with this value. But the question is how can I obtain the actual heart rate value. Is it supported by Locus API?
  •  

Menion

Ah sorry, my bad.

All current sensor data are attached to current users location. So from received UpdateContainer object, just get Location with

container.getLocMyLocation()

In this location object are then all sensor data, so something like
if (myLocation.hasSensorHeartRate()) {
  myLocation.getSensorHeartRate();
}


More here:
https://github.com/asamm/locus-api/blob/master/locus-api/src/main/java/locus/api/objects/extra/Location.java#L762

Simply:
TrackStats - container for complete statistics of currently recording track
Location - object that has not just users location at certain time, but also sensor values at this time
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

mzperx

Thank you I think this is what I'm looking for, I will try it!
  •