Ogadai / zwift-mobile-api

MIT License
118 stars 25 forks source link

Adding more protobuf definitions - support for udp parsing #5

Closed wiedmann closed 7 years ago

wiedmann commented 7 years ago

This is a proposed change. I've added more protobuf definitions to support parsing the Zwift UDP traffic.

In order to do so, I had to change some of the export structure. Notably riderStatus.js now uses named exports and ZwiftAccount exposes two static methods to allow access to the protobuf definitions and to allow wrapping status objects to decode the bitwise encoded fields using the PlayerStateWrapper.

Note that I've also renamed Status in the protobuf definition to PlayerState to align with what I believe Zwift calls the message internally (based on strings visible in the Zwift binary).

mhanney commented 7 years ago

Guys, first, my apologies for just lurking and not contributing anything. Amazing work. I'm watching with awe. +1 for raw node.js

wiedmann commented 7 years ago

Usage example: https://github.com/wiedmann/zwift-telemetry

Ogadai commented 7 years ago

Thanks for the vote @mhanney

Right, I think I've decided. I'll merge this PR as-is, then refactor into a raw node.js project and factor out the protobuf definitions and stuff like that. Then I'm going to go and ride my bike :-)

Ogadai commented 7 years ago

As part of refactoring, I've removed the static functions, because you can now access modules directly. e.g.

const root = require('zwift-mobile-api/src/zwiftProtobuf')