pcolby / bipolar

Free your data from Polar FlowSync
GNU General Public License v3.0
115 stars 16 forks source link

.proto files? #55

Closed pashky closed 8 years ago

pashky commented 8 years ago

Hi Paul,

First of all I'd like to say thanks for all your work here. It's amazing and bipolar sources was of a great help to me.

Yet I was wondering if you have actually created .proto files for all your reverse engineering works? I know, you don't use google's parser in bipolar, but given you definitely use protoc to debug it, I suspect you might have done it. If so, would you mind sharing them?

The story behind this question is that even though I'm okay to use flow, and don't use v800_downloader or bipolar as such, I still had to dive into the world of Polar data files recently. That's because sometimes, when connection is really bad, iOS Polar Flow app simply doesn't sync data to website yet still marks them as such locally. So session is there on the web, but no GPS data, no graphs, no export, only summary. And it was too late to use v800_downloader as those sessions were already overwritten on watch.

It's still perfectly visible on the phone though, which made me think that I can salvage some data from iTunes backups. And surely enough with a help of ruby, protobuf, sqlite, bipolar sources and a few hours time I cobbled together a script that produces a bog standard GPX file out of sqlite db they use. And I got my segments into Strava at the very least :)

Works ok for now, but I suspect those sync issues may happen in future as well, and I may want to enhance my script to extract HR and other data too, so having .proto files for everything else may be very helpful.

pcolby commented 8 years ago

Hi @pashky,

First of all I'd like to say thanks for all your work here. It's amazing and bipolar sources was of a great help to me.

Your welcome. I'm glad to hear its helped you :smile:

I was wondering if you have actually created .proto files for all your reverse engineering works?

No, I didn't create any .proto files during the development of Bipolar. However, another user (@profanum429) did manage to extract some .proto files from one of the FlowSync apps - see issue #3.

Disclaimer: The .proto files from issue #3 are not open source (as far as I know). I am not a lawyer. Use at you're own risk.

Bipolar doesn't use any of the .proto files directly, since:

  1. its not clear how legal it would be include them in open-source apps like Bipolar; and
  2. since I only need to de-serialize, and not serialize, it was (arguably) simpler to implement an Qt-native, lenient protobuf de-serializer than to depend on the protobuf libraries; and
  3. it was more fun :smile:

Anyway, issue #3 includes some links to .proto files in dropbox, which might be what you're after... though they seem to be 404's now :frowning:

I don't have any copies on my current PC, but might still have a copy on some older build VMs... I'll have a look later today / tomorrow. Alternatively, you could have a go at extracted the .proto resources from FlowSync yourself.

you definitely use protoc to debug it

Although the protoc command is officially the "protobuf compiler", it's undocumented --decode_raw option takes a raw protobuf stream with no .proto files at all... its kinda like a hexdump for protobuf data.

The story behind this question is ...

Good luck with that - sounds like a fun project! :+1: :smile:

Cheers.

pc.

pashky commented 8 years ago

Wow, I didn't know it was that easy and sources were kindly supplied by manufacturer! So now you aren't that much of a hero as I thought before... Just kidding, sorry :)

Anyways, thanks again! I guess I could manage extracting them myself from dll. Or, really, I should just keep it simple and delegate actual file conversion to bipolar and leave only code that extract polar binary data from sqlite db...