Crates.io | cm-telemetry |
lib.rs | cm-telemetry |
version | 2.3.1 |
source | src |
created_at | 2020-07-12 01:00:16.463858 |
updated_at | 2023-02-20 04:43:24.153087 |
description | Implementation of the telemetry UDP protocol for codemasters (and friends) games |
homepage | |
repository | https://github.com/ozkar99/cm-telemetry |
max_upload_size | |
id | 264241 |
size | 113,660 |
Implements the codemasters (and friends) UDP telemetry protocol and provides an abstraction for interacting with it.
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 :)
https://forums.codemasters.com/topic/50942-f1-2020-udp-specification/ https://answers.ea.com/t5/General-Discussion/F1-22-UDP-Specification/td-p/11551274