Implements the codemasters (and friends) UDP telemetry protocol and provides an abstraction for interacting with it.
- F1 2020
- F1 2022
- Dirt Rally 2.0
use cm_telemetry::f1::f1_2020::F1_2020;
use cm_telemetry::TelemetryServer;
fn main() {
let server =
TelemetryServer::<F1_2020>::new("127.0.0.1:20777").expect("failed to bind to address");
loop {
let event = server.next();
if let Err(e) = event {
println!("error: {:?}", e);
continue;
}
match event.unwrap() {
F1_2020::FinalClassification(_data) => println!("Received FinalClassification packet"),
F1_2020::LobbyInfo(_data) => println!("Received LobbyInfo packet"),
_ => ()
}
You can support new games (external to the crate) by implementing the Event
trait on a type
and then initialize a Server
with it using cm_telemetry::Server::<T>::new(addr)
PR's welcome :)
F1 2020 UDP Specification (Webarchive because EA)