/polarhrm

Unmaintained copy of https://code.google.com/archive/p/polarhrm/

Primary LanguageC++GNU General Public License v3.0GPL-3.0

requirements
==================

libarys installed:
	#apt-get install libxml2
	#apt-get install "libusb-0.1-4"


getting started (IRDA)
==================

before using the software be sure that you have a porpper configured 
Irda device.
You can test this by running 
	# irdadump 
and place your polar watch to the transceiver.

more information avaible 
http://code.google.com/p/polarhrm/wiki/IRDA_Information


do not install the software, just compile and execute it.
(I don t have expirience with uninstalling sections in makefile, so please don t 
call make install or make unistall for now)



configure the command line interface (cli)
==================

first go to src/cli/polarhrm_config.h and edit the 
MYPATH value to a writable directory

then run
	./configure
	make
	cd src
	$./polarhrm s625x

or 
	$./polarhrm rs800cx

NEW:
	$./polarhrm rcx5

note: you may get an error when building "no route to target" at the end of make 
command.
however, check the src dir if the binaries are built.

Note: the rcx5 uses a driver based on libusb.
      to access the device without root privelegs create a udev rule
      /etc/udev/rules.d/99-hid.rules 

SUBSYSTEM=="usb", ATTRS{idVendor}=="0da4", ATTRS{idProduct}=="0004", MODE="0666"

for details see https://github.com/samop/Polar-Flowlink-linux/tree/master/udev



supported functions:

*)connect the watch (s625X / rs800cx / rcx5)
*)transfer all sessions to the computer (s625X / rs800cx / rcx5)
*)dump raw data to files (s625X / rs800cx / rcx5)
*)parse all knowen data, and print them to screen (s625X / rs800cx / rcx5)
*)write HRM file (s625X / rs800cx)
*)write GPX file (rs800cx)

to read an existing dump file run 

./polarhrm s625x -r /home/thomas/praw/2011-7-22_8_46.dump

or

./polarhrm rs800cx -r /path/to/dumpfile.dump

./polarhrm rcx5 -r /path/to/dumpfile.dump



todos
==================

*overwrite existing files
setup a switch to overwrite existing files. snap in at the file creation
 function and force overwirte without creating a new session file number.
it might be a bit difficult to identify that a session at a day is gets 
overwritten exactly.

*make hrm dynamic
make the hrm file dynamic and remove static values.

*what is calculated by PPP software?
it figured out that some values are stored in ppp software and calculated by 
ppp software such as hr minimum.

*delete single sessions(s625X)
deleting single sessions does not work for now.
(it is a bit more complex communication watch and ppp software)
see the s625x comm

*limit zones and Sportzones(s625X)
handle limit zones and sportzones correct.
limit zones: there are 3 zones, accourding to polar hrm spec the 3rd limit zone
 gets used as summery. the question is, how does the exercise number and the 
 exercise type have impact on the 3rd setting.
at the watch settings it is possible to set up all 3 limits but the hrm 
shows 1 and 2 and 3 theresold summery so what?

*create an Interface
create an interface for external programms. thinking on sockets AF_UNIX, or pipes
found a good tutorial http://www.gidforums.com/t-3369.html
not much to do, just set up a switch -i --interface for XML and don t do any 
additional pinting. language for communication could be xml
GUI(java, gtk++, wx, python ...) pytrainer, sportstracker, goldencheetah
gui windows can be found at polar4linux
-> acctually have split the code to a libary and a cli so that other apps could
 use the lib functions.


*MORE SAMPLE DATA is needed!
cycling with power raw format(s625X)
interval tranining (s625x)

rs800cx sessions with s3 footpod



test.cpp:
==================

	just for testing objects & code snippets




Development
==================

your watch is not supported by now and you want to implement it?
here I wirte some ideas of the concept to add a new device:

	connection type:
		the watch uses some transfer method to get data out ouf the watch.
		as far as I know soniclink, IR and IRda connections have allready been 
		implemented. (various projects)
		new devices use other connection type such as flowlink. 
		(there is also a project focusing on this)

		polarhrm wants to bring all the different connection types and devices
		together and create a usful libary for gui applications.

		userspace drivers for irda and datalink are avaible but the class model of 
		polarhrm gives the opportunity to add other application drivers.

		see the apstract driver class
		on the wiki I have put a list of devices that use IRDA, if you got one
		of this devices it takes not long to add an implemantation


	devices:
		each device has its own dir to put related source
		classes used for all watches are in watch folder

		a new device should inheritance the apstract watch class
		communication should be seperated from parsing
		parsing should result in standard watch objects

		for saving a hrm file it should use the watch/hrmfile class 
		if the device requires special output it should be implemented
		in the hrm class with a if cause (if monitor=number) because other 
		devices could also need this implementation in future
		
		getting data out of the watch
			TODO see wiki
			
		parsing data
			once you have a dump of raw data you can go starting the parsing
			the best is to do step by step.
			try to find if some of the allready knowen parsing funcitons work.
			look at bcd coded values. 
			make small sessions that have only minor changes. 
			 eg. set HR record interval highest value.
			edit only one setting at once. 

			compare the dump files with tools, and write the session parsing function.

			tools I use:	meld (gnome),
					vbindiff (command line), 

			simple helping script to show changes across serveral sessions files.

		#!/bin/sh
		./polarhrm rs800cx -r /home/thomas/praw/rs800_session01.dump > output.txt
		./polarhrm rs800cx -r /home/thomas/praw/rs800_session02.dump >> output.txt 
		./polarhrm rs800cx -r /home/thomas/praw/rs800_session03.dump >> output.txt 
		cat output.txt

		and then call it ./myscript.sh|grep "?? byte 50"