HXM Tracker
This is a heart rate and location tracker software for N900 and Zephyr HXM
Bluetooth heart rate belt. The application hxmtracker can be found from
maemo.org extras-devel. The application simply tracks the heart rate
signals coming from Zephyr HXM BT and coordinates coming from N900 GPS
module. The application writes this information to a file.
Usage
Install software using App Manager in your N900. It can be installed
under scratchbox but will not fully work there (because in scratcbox
there is no GPS). The application is written in Python. In addition to
standard Python, you will need bluetooth (Bluez) and location
libraries.
Wear the Zephyr HXM BT heart rate belt. Be sure to moisture the pads on
the belt and your skin carefully. The pads seem to dry quickly if you
are not exercising actively. Enable the bluetooth from your N900 if it
is not yet enabled. Launch the application HXM Tracker and press
Connect. The application searches available bluetooth devices and tries
to connect to the first which name starts with HXM. You can also have a
file .hxmpref.txt in your home directory where you can write the mac
address of the belt. In this case, the application only tries to
connect to the device specified in the file. The .hxmpref.txt file
should contain only one line of text (name, mac-address) and should
look like this:
HXM_JARI, 00:07:80:87:2D:EF
The mac address of your Zephyr HXM BT belt can be found by pairing the
Zephyr HXM NT with your N900 and by going to Settings -> Bluetooth
-> Devices, and by selecting HXMnnnnn and pressing Edit. There you
can see the mac address displayed.
If the Zephyr HXM BT belt is found, the application starts to log the
heart rate and current location to a file. The current heart rate is
displayed on the screen. On the upper right corner there is the Zephyr
HXM belt battery indicator. When you have finished your exercise, press
disconnect button.

Displaying the data
The application creates .hxmlog.txt (in your home directory) file that
contains data from the Zephyr HXM belt. There is also .coord.xml file,
that contains the heart rate and location data in xml format. This file
can be read using for example following script.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<title>
Map Demo for N900 and HXM
</title>
<script src="http://maps.google.com/maps?file=api&v=2&
key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA"
type="text/javascript">
</script>
<script type="application/javascript">
function loadCoords() {
xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.onload = drawMap;
xmlDoc.load(".coord.xml");
}
// Create the marker and corresponding information window
function createInfoMarker(point, address) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(address);
});
return marker;
}
function drawMap() {
var labels = xmlDoc.getElementsByTagName('coord');
var lat = 0;
var lon = 0;
var sykeTaulu = [];
var aikaTaulu = [];
var k = 0;
if (GBrowserIsCompatible()) {
var listArr = [];
for (i = 0; i < labels.length; i++) {
lat = labels[i].childNodes[0].firstChild.nodeValue;
lon = labels[i].childNodes[1].firstChild.nodeValue;
syke = labels[i].childNodes[2].firstChild.nodeValue;
aika = labels[i].childNodes[3].firstChild.nodeValue;
sykeTaulu[i] = syke;
aikaTaulu[i] = aika;
listArr[i] = new GLatLng(lat, lon);
}
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(listArr[0], 17);
var mapTypeControl = new GMapTypeControl();
var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10, 10));
var bottomRight = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10, 10));
map.addControl(mapTypeControl, topRight);
GEvent.addListener(map, "dblclick", function() {
map.removeControl(mapTypeControl);
map.addControl(new GMapTypeControl(), bottomRight);
});
map.addControl(new GSmallMapControl());
var polyline2 = new GPolyline(listArr, "#ffff00", 10);
map.addOverlay(polyline2);
// Create markers out of every tenth observation
for (i=0; i < labels.length; i=i+50) {
msg = "HB = " + sykeTaulu[i] + " at " + aikaTaulu[i];
var marker = createInfoMarker(listArr[i], msg);
map.addOverlay(marker);
}
}
}
</script>
</head>
<body id='updateTarget' onunload="GUnload()">
<p>
<a href="javascript:loadCoords()">Click here to load coordinates from xml file.</a>
</p>
<div id="map_canvas" style="width: 800px; height: 600px">
</div>
<div id="message">
</div>
</body>
</html>
Put this script to for example maps.html file in your home directory
and open it with Firefox. Press Click here to load the coordinates from
xml file. You may get inaccurate location information for a few seconds
in the beginning, depending where you are exercising and what GPS
methods you are using. In general, if you use assisted GPS that uses
also your internet connection, you will get a GPS fix much faster. In
case of inaccurate data, you could delete those lines data from the xml
file.

The project pages in maemo.org can be found from https://garage.maemo.org/projects/hxmtracker/