f1-game-packet-parser
This is a Rust crate that allows you to convert binary data from F1 24, F1 23, and F1 22 UDP telemetry into organised structs.
Getting started
Add f1-game-packet-parser to your project by running this command:
cargo add f1-game-packet-parser
Example
This crate doesn't provide a UDP client out of the box. Here's how to write one that will keep parsing incoming packets until it receives final classification or a session ended event packet. It will then print either the final classification or a Session has ended! message and exit.
use EventDetails;
use parse;
use Error;
use UdpSocket;
Minimum supported Rust version
The minimum supported Rust version is documented in the Cargo.toml file. It may be bumped in minor releases if necessary.
FAQ
What about support for F1 2021-2018?
My initial goal was to provide support from the most recent game all the way to F1 2018, starting development with implementing support for the latter and working my way up. I ended up limiting my crate's backwards compatibility to F1 22, because:
- When I was done with the 2021 format, certain structs had so many fields that got added, removed, or in some cases even reordered with each new format that they became a nightmare to manage and navigate through in the documentation.
- I realised that most users would probably never end up using formats that are over 2-3 years old anyway. Limiting support to the 3 most recent packet formats also happens to be the actual policy in the latest games.
However, if you believe there's a method in the madness and/or need support for these older packet formats, feel free to open an issue or a pull request.
Are there any alternatives to this crate?
If you're looking for a crate that supports an older telemetry format or need a built-in UDP client, consider one of the following:
- f1_game_telemetry - supports the 2022 format and offers a built-in UDP client
- f1-telemetry-client - supports the 2020 format and offers a built-in UDP client
Where can I find the links to the original specification documents?
In the list below:
License
MIT