mirror of
https://github.com/italicsjenga/fh5-telemetry-watcher.git
synced 2024-12-23 14:11:33 +11:00
serde + data structure
This commit is contained in:
parent
8f57c15a54
commit
f9294ce6bf
45
Cargo.lock
generated
45
Cargo.lock
generated
|
@ -86,6 +86,12 @@ dependencies = [
|
|||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
|
@ -155,6 +161,43 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.136"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.136"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.10.0"
|
||||
|
@ -177,6 +220,8 @@ name = "telemetry"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -6,4 +6,6 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "3.1.1", features = ["derive"] }
|
||||
clap = { version = "3.1.1", features = ["derive"] }
|
||||
serde = { version = "1.0.136", features = ["derive"] }
|
||||
serde_json = "1.0.79"
|
99
src/main.rs
99
src/main.rs
|
@ -7,6 +7,105 @@ struct Args {
|
|||
folder: String,
|
||||
}
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
struct Telemetry {
|
||||
isRaceOn: bool,
|
||||
timeStampMS: u64,
|
||||
engineMaxRpm: f32,
|
||||
engineIdleRpm: f32,
|
||||
currentEngineRpm: f32,
|
||||
accelerationX: f32,
|
||||
accelerationY: f32,
|
||||
accelerationZ: f32,
|
||||
velocityX: f32,
|
||||
velocityY: f32,
|
||||
velocityZ: f32,
|
||||
angularVelocityX: f32,
|
||||
angularVelocityY: f32,
|
||||
angularVelocityZ: f32,
|
||||
yaw: f32,
|
||||
pitch: f32,
|
||||
roll: f32,
|
||||
normalizedSuspensionTravelFrontLeft: f32,
|
||||
normalizedSuspensionTravelFrontRight: f32,
|
||||
normalizedSuspensionTravelRearLeft: f32,
|
||||
normalizedSuspensionTravelRearRight: f32,
|
||||
tireSlipRatioFrontLeft: f32,
|
||||
tireSlipRatioFrontRight: f32,
|
||||
tireSlipRatioRearLeft: f32,
|
||||
tireSlipRatioRearRight: f32,
|
||||
wheelRotationSpeedFrontLeft: f32,
|
||||
wheelRotationSpeedFrontRight: f32,
|
||||
wheelRotationSpeedRearLeft: f32,
|
||||
wheelRotationSpeedRearRight: f32,
|
||||
wheelOnRumbleStripFrontLeft: i32,
|
||||
wheelOnRumbleStripFrontRight: i32,
|
||||
wheelOnRumbleStripRearLeft: i32,
|
||||
wheelOnRumbleStripRearRight: i32,
|
||||
wheelInPuddleDepthFrontLeft: f32,
|
||||
wheelInPuddleDepthFrontRight: f32,
|
||||
wheelInPuddleDepthRearLeft: f32,
|
||||
wheelInPuddleDepthRearRight: f32,
|
||||
surfaceRumbleFrontLeft: f32,
|
||||
surfaceRumbleFrontRight: f32,
|
||||
surfaceRumbleRearLeft: f32,
|
||||
surfaceRumbleRearRight: f32,
|
||||
tireSlipAngleFrontLeft: f32,
|
||||
tireSlipAngleFrontRight: f32,
|
||||
tireSlipAngleRearLeft: f32,
|
||||
tireSlipAngleRearRight: f32,
|
||||
tireCombinedSlipFrontLeft: f32,
|
||||
tireCombinedSlipFrontRight: f32,
|
||||
tireCombinedSlipRearLeft: f32,
|
||||
tireCombinedSlipRearRight: f32,
|
||||
suspensionTravelMetersFrontLeft: f32,
|
||||
suspensionTravelMetersFrontRight: f32,
|
||||
suspensionTravelMetersRearLeft: f32,
|
||||
suspensionTravelMetersRearRight: f32,
|
||||
carClass: i32,
|
||||
carPerformanceIndex: i32,
|
||||
drivetrai32ype: i32,
|
||||
numCylinders: i32,
|
||||
carType: i32,
|
||||
unknown1: i8,
|
||||
unknown2: i8,
|
||||
unknown3: i8,
|
||||
unknown4: i8,
|
||||
unknown5: i8,
|
||||
unknown6: i8,
|
||||
unknown7: i8,
|
||||
unknown8: i8,
|
||||
carOrdinal: i32,
|
||||
positionX: f32,
|
||||
positionY: f32,
|
||||
positionZ: f32,
|
||||
speed: f32,
|
||||
power: f32,
|
||||
torque: f32,
|
||||
tireTempFrontLeft: f32,
|
||||
tireTempFrontRight: f32,
|
||||
tireTempRearLeft: f32,
|
||||
tireTempRearRight: f32,
|
||||
boost: f32,
|
||||
fuel: f32,
|
||||
distanceTraveled: f32,
|
||||
bestLap: f32,
|
||||
lastLap: f32,
|
||||
currentLap: f32,
|
||||
currentRaceTime: f32,
|
||||
lapNumber: i16,
|
||||
racePosition: i8,
|
||||
accel: i8,
|
||||
brake: i8,
|
||||
clutch: i8,
|
||||
handbrake: i8,
|
||||
gear: i8,
|
||||
steer: i8,
|
||||
normalizedDrivingLine: i8,
|
||||
normalizedAIBrakeDifference: i8,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = Args::parse();
|
||||
|
||||
|
|
Loading…
Reference in a new issue