openambitproject / openambit

openambit
281 stars 82 forks source link

Sync service or documentation? #110

Closed ghost closed 5 years ago

ghost commented 8 years ago

I'd like to transfer GPS and HRM data from the watch (ambit3 run) directly to an Ubuntu server. What I'd really like is a service, which auto syncs with the watch when USB is plugged in, and pushes the data to my own service probably through socket connection. I have zero C knowledge, and I think I would do more harm than good if I'd start to write code on that language. Is it possible to do something like this? If it is not already implemented, is there any documentation available I could use to develop it somehow?

landas commented 7 years ago

If you are still interested a year after your post, I could help you with some information on how you can achieve it. But it will require some research from you.

You could reveice the data as movescount do it http (I can tell you how if interested), or you could use the xml-log files in ~/openambit folder (this is the most easy way to do it)

There will be no user friendly way to do it using the openambit software only.

ghost commented 7 years ago

@landas Yes I am still interested. Is it really possible to do this with simple HTTP requests? That would be great!

landas commented 7 years ago

1) You have to download / clone the latest version from github, and build it in Debug mode as described here: https://github.com/openambitproject/openambit/blob/master/README.rst#build-procedure (this is because of SSL verification is turned off in Debug mode in the latest version)

2) Setup apache (or another web-server) with a virtual host accepting uiservices.movescount.com. This server MUST accept SSL, so you have to create a dummy sertificate for this server. As described above, latest version in Debug mode will not check if SSL sertificate is valid.

3) In the file /etc/hosts you have to add a line with:

<ipadress of server> uiservices.movescount.com

Now all request from openambit will go to your server.

I can provide you with some files later today, so you know what format the different files/urls/request type are in.

ghost commented 7 years ago

@landas Is it required to change the firmware on the watch to do this?

landas commented 7 years ago

No change to firmware I think. I have only tested with latest firmware from Suunto.

Proxy / data capture

http://doppel.no/openambit_data/ _index.php is the script I have used to capture data between openambit/moveslink2 and uiservices.movescount.com

Data samples

http://doppel.no/openambit_data/data here you find example of differen http-request between openabmit/moveslink2 and uiservices.movescount.com

Example of moves upoload

http://doppel.no/openambit_data/data/1490201496.5427.log an example of an POST request with moves. at the top of the file you see the URL used by openambit/moveslink2 to POST the data.

As you can see it is standard json. CompressedSampleSets - On this field you first have to do a base 64 decoding, then gunzip it.

http://php.net/manual/en/function.base64-decode.php http://php.net/manual/en/function.gzuncompress.php

I hope this will help you in some direction :smile:

ghost commented 7 years ago

@landas Okay, I'll give it a try. Thanks! :-)