Closed wiedmann closed 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
Usage example: https://github.com/wiedmann/zwift-telemetry
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 :-)
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')
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).