f1_game_packet_parser/constants/
mod.rs

1/// Unique identifiers of drivers.
2pub mod driver_id;
3/// Unique identifiers of session types.
4pub mod session_type;
5/// Unique identifiers of teams.
6pub mod team_id;
7/// Indexes of wheels in wheel-oriented arrays.
8/// The order is:
9/// [`REAR_LEFT`](const@wheel_index::REAR_LEFT),
10/// [`REAR_RIGHT`](const@wheel_index::REAR_RIGHT),
11/// [`FRONT_LEFT`](const@wheel_index::FRONT_LEFT),
12/// [`FRONT_RIGHT`](const@wheel_index::FRONT_RIGHT).
13pub mod wheel_index;
14
15use binrw::BinRead;
16use bitflags::bitflags;
17use serde::{Deserialize, Serialize};
18
19pub(crate) const MAX_NUM_CARS: usize = 22;
20
21/// Unique identifier of the type of this packet.
22/// Represents a [`u8`].
23#[non_exhaustive]
24#[derive(
25    BinRead,
26    Eq,
27    PartialEq,
28    Ord,
29    PartialOrd,
30    Copy,
31    Clone,
32    Debug,
33    Hash,
34    Serialize,
35    Deserialize,
36)]
37#[br(little, repr(u8))]
38pub enum PacketId {
39    Motion = 0,
40    Session = 1,
41    Laps = 2,
42    Event = 3,
43    Participants = 4,
44    CarSetups = 5,
45    CarTelemetry = 6,
46    CarStatus = 7,
47    FinalClassification = 8,
48    LobbyInfo = 9,
49    CarDamage = 10,
50    SessionHistory = 11,
51    TyreSets = 12,
52    MotionEx = 13,
53    TimeTrial = 14,
54}
55
56/// Flag that's currently being waved in
57/// a [`MarshalZone`](crate::packets::session::MarshalZone).
58/// Represents an [`i8`].
59#[non_exhaustive]
60#[derive(
61    BinRead,
62    Eq,
63    PartialEq,
64    Ord,
65    PartialOrd,
66    Copy,
67    Clone,
68    Debug,
69    Hash,
70    Serialize,
71    Deserialize,
72)]
73#[br(little, repr(i8))]
74pub enum MarshalZoneFlag {
75    Unknown = -1,
76    None = 0,
77    Green = 1,
78    Blue = 2,
79    Yellow = 3,
80    Red = 4,
81}
82
83/// Session/forecast weather type. Represents a [`u8`].
84#[non_exhaustive]
85#[derive(
86    BinRead,
87    Eq,
88    PartialEq,
89    Ord,
90    PartialOrd,
91    Copy,
92    Clone,
93    Debug,
94    Hash,
95    Serialize,
96    Deserialize,
97)]
98#[br(little, repr(u8))]
99pub enum Weather {
100    Clear = 0,
101    LightCloud = 1,
102    Overcast = 2,
103    LightRain = 3,
104    HeavyRain = 4,
105    Storm = 5,
106}
107
108/// Temperature change direction. Represents an [`i8`].
109#[non_exhaustive]
110#[derive(
111    BinRead,
112    Eq,
113    PartialEq,
114    Ord,
115    PartialOrd,
116    Copy,
117    Clone,
118    Debug,
119    Hash,
120    Serialize,
121    Deserialize,
122)]
123#[br(little, repr(i8))]
124pub enum TemperatureChange {
125    Up = 0,
126    Down = 1,
127    NoChange = 2,
128}
129
130/// Unique circuit ID. Represents an [`i8`].
131#[non_exhaustive]
132#[derive(
133    BinRead,
134    Eq,
135    PartialEq,
136    Ord,
137    PartialOrd,
138    Copy,
139    Clone,
140    Debug,
141    Hash,
142    Serialize,
143    Deserialize,
144)]
145#[br(little, repr(i8))]
146pub enum TrackId {
147    /// Unknown circuit.
148    Unknown = -1,
149    /// Australian Grand Prix.
150    AlbertPark = 0,
151    /// French Grand Prix.
152    PaulRicard = 1,
153    /// Chinese Grand Prix.
154    Shanghai = 2,
155    /// Bahrain Grand Prix.
156    Sakhir = 3,
157    /// Spanish Grand Prix.
158    Catalunya = 4,
159    /// Monaco Grand Prix.
160    MonteCarlo = 5,
161    /// Canadian Grand Prix.
162    Montreal = 6,
163    /// British Grand Prix.
164    Silverstone = 7,
165    /// German Grand Prix.
166    Hockenheim = 8,
167    /// Hungarian Grand Prix.
168    Hungaroring = 9,
169    /// Belgian Grand Prix.
170    Spa = 10,
171    /// Italian Grand Prix.
172    Monza = 11,
173    /// Singapore Grand Prix.
174    MarinaBay = 12,
175    /// Japanese Grand Prix.
176    Suzuka = 13,
177    /// Abu Dhabi Grand Prix.
178    YasMarina = 14,
179    /// Circuit of the Americas. United States (Texas) Grand Prix.
180    Cota = 15,
181    /// Brazilian (Sao Paulo) Grand Prix.
182    Interlagos = 16,
183    /// Austrian Grand Prix.
184    RedBullRing = 17,
185    /// Russian Grand Prix.
186    Sochi = 18,
187    /// Mexican Grand Prix.
188    MexicoCity = 19,
189    /// Azerbaijan Grand Prix.
190    Baku = 20,
191    /// Short variant of the [`Sakhir`](TrackId::Sakhir) circuit.
192    SakhirShort = 21,
193    /// Short variant of the [`Silverstone`](TrackId::Silverstone) circuit.
194    SilverstoneShort = 22,
195    /// Short variant of the [`Cota`](TrackId::Cota) circuit.
196    CotaShort = 23,
197    /// Short variant of the [`Suzuka`](TrackId::Suzuka) circuit.
198    SuzukaShort = 24,
199    /// Vietnamese Grand Prix.
200    Hanoi = 25,
201    /// Dutch Grand Prix.
202    Zandvoort = 26,
203    /// ~~San Marino~~ Emilia-Romagna Grand Prix.
204    Imola = 27,
205    /// Portuguese Grand Prix.
206    Portimao = 28,
207    /// Saudi Arabian Grand Prix.
208    Jeddah = 29,
209    /// Miami Grand Prix.
210    Miami = 30,
211    /// Las Vegas Grand Prix.
212    LasVegas = 31,
213    /// Qatar Grand Prix.
214    Losail = 32,
215}
216
217/// Type of cars being raced in
218/// [`F1PacketSession`](struct@crate::F1PacketSession).
219/// Represents a [`u8`].
220#[non_exhaustive]
221#[derive(
222    BinRead,
223    Eq,
224    PartialEq,
225    Ord,
226    PartialOrd,
227    Copy,
228    Clone,
229    Debug,
230    Hash,
231    Serialize,
232    Deserialize,
233)]
234#[br(little, repr(u8))]
235pub enum Formula {
236    F1Modern = 0,
237    F1Classic = 1,
238    F2 = 2,
239    F1Generic = 3,
240    Beta = 4,
241    Supercars = 5,
242    Esports = 6,
243    F22021 = 7,
244    F1World = 8,
245    F1Elimination = 9,
246}
247
248/// Safety car deployment status in [`F1PacketSession`](struct@crate::F1PacketSession).
249/// Represents a [`u8`].
250#[non_exhaustive]
251#[derive(
252    BinRead,
253    Eq,
254    PartialEq,
255    Ord,
256    PartialOrd,
257    Copy,
258    Clone,
259    Debug,
260    Hash,
261    Serialize,
262    Deserialize,
263)]
264#[br(little, repr(u8))]
265pub enum SafetyCarStatus {
266    None = 0,
267    Virtual = 1,
268    Full = 2,
269    FormationLap = 3,
270}
271
272/// Accuracy of a
273/// [`WeatherForecastSample`](struct@crate::packets::session::WeatherForecastSample).
274/// Represents a [`u8`].
275#[non_exhaustive]
276#[derive(
277    BinRead,
278    Eq,
279    PartialEq,
280    Ord,
281    PartialOrd,
282    Copy,
283    Clone,
284    Debug,
285    Hash,
286    Serialize,
287    Deserialize,
288)]
289#[br(little, repr(u8))]
290pub enum ForecastAccuracy {
291    Perfect = 0,
292    Approximate = 1,
293}
294
295/// Type of enabled braking assist. Represents a [`u8`].
296#[non_exhaustive]
297#[derive(
298    BinRead,
299    Eq,
300    PartialEq,
301    Ord,
302    PartialOrd,
303    Copy,
304    Clone,
305    Debug,
306    Hash,
307    Serialize,
308    Deserialize,
309)]
310#[br(little, repr(u8))]
311pub enum BrakingAssist {
312    Off = 0,
313    Low = 1,
314    Medium = 2,
315    High = 3,
316}
317
318/// Type of enabled gearbox assist. Represents a [`u8`].
319#[non_exhaustive]
320#[derive(
321    BinRead,
322    Eq,
323    PartialEq,
324    Ord,
325    PartialOrd,
326    Copy,
327    Clone,
328    Debug,
329    Hash,
330    Serialize,
331    Deserialize,
332)]
333#[br(little, repr(u8))]
334pub enum GearboxAssist {
335    Unknown = 0,
336    Manual = 1,
337    ManualWithSuggestedGear = 2,
338    Automatic = 3,
339}
340
341/// Type of enabled racing line assist. Represents a [`u8`].
342#[non_exhaustive]
343#[derive(
344    BinRead,
345    Eq,
346    PartialEq,
347    Ord,
348    PartialOrd,
349    Copy,
350    Clone,
351    Debug,
352    Hash,
353    Serialize,
354    Deserialize,
355)]
356#[br(little, repr(u8))]
357pub enum DynamicRacingLine {
358    Off = 0,
359    CornersOnly = 1,
360    Full = 2,
361}
362
363/// Shape of the racing line. Represents a [`u8`].
364#[non_exhaustive]
365#[derive(
366    BinRead,
367    Eq,
368    PartialEq,
369    Ord,
370    PartialOrd,
371    Copy,
372    Clone,
373    Debug,
374    Hash,
375    Serialize,
376    Deserialize,
377)]
378#[br(little, repr(u8))]
379pub enum DynamicRacingLineType {
380    TwoDimensional = 0,
381    ThreeDimensional = 1,
382}
383
384/// Game mode that's currently in use. Represents a [`u8`].
385#[non_exhaustive]
386#[derive(
387    BinRead,
388    Eq,
389    PartialEq,
390    Ord,
391    PartialOrd,
392    Copy,
393    Clone,
394    Debug,
395    Hash,
396    Serialize,
397    Deserialize,
398)]
399#[br(little, repr(u8))]
400pub enum GameMode {
401    EventMode = 0,
402    GrandPrix = 3,
403    GrandPrix2023 = 4,
404    TimeTrial = 5,
405    Splitscreen = 6,
406    OnlineCustom = 7,
407    OnlineLeague = 8,
408    CareerInvitational = 11,
409    ChampionshipInvitational = 12,
410    Championship = 13,
411    OnlineChampionship = 14,
412    OnlineWeeklyEvent = 15,
413    BrakingPoint2023 = 17,
414    Career2022 = 19,
415    OnlineCareer2022 = 20,
416    Career2023 = 21,
417    OnlineCareer2023 = 22,
418    DriverCareer2024 = 23,
419    OnlineCareer2024 = 24,
420    MyTeamCareer2024 = 25,
421    CuratedCareer2024 = 26,
422    Benchmark = 127,
423}
424
425/// Set of rules that's in use for this session. Represents a [`u8`].
426#[non_exhaustive]
427#[derive(
428    BinRead,
429    Eq,
430    PartialEq,
431    Ord,
432    PartialOrd,
433    Copy,
434    Clone,
435    Debug,
436    Hash,
437    Serialize,
438    Deserialize,
439)]
440#[br(little, repr(u8))]
441pub enum RuleSet {
442    PracticeAndQualifying = 0,
443    Race = 1,
444    TimeTrial = 2,
445    TimeAttack = 4,
446    CheckpointChallenge = 6,
447    Autocross = 8,
448    Drift = 9,
449    AverageSpeedZone = 10,
450    RivalDuel = 11,
451}
452
453/// Length of the ongoing session. Represents a [`u8`].
454#[non_exhaustive]
455#[derive(
456    BinRead,
457    Eq,
458    PartialEq,
459    Ord,
460    PartialOrd,
461    Copy,
462    Clone,
463    Debug,
464    Hash,
465    Serialize,
466    Deserialize,
467)]
468#[br(little, repr(u8))]
469pub enum SessionLength {
470    None = 0,
471    VeryShort = 2,
472    Short = 3,
473    Medium = 4,
474    MediumLong = 5,
475    Long = 6,
476    Full = 7,
477}
478
479/// Whether the car is outside/entering/in the pit lane. Represents a [`u8`].
480#[non_exhaustive]
481#[derive(
482    BinRead,
483    Eq,
484    PartialEq,
485    Ord,
486    PartialOrd,
487    Copy,
488    Clone,
489    Debug,
490    Hash,
491    Serialize,
492    Deserialize,
493)]
494#[br(little, repr(u8))]
495pub enum PitStatus {
496    None = 0,
497    Pitting = 1,
498    InPitArea = 2,
499}
500
501/// Zero-based sector number. Represents a [`u8`].
502#[non_exhaustive]
503#[derive(
504    BinRead,
505    Eq,
506    PartialEq,
507    Ord,
508    PartialOrd,
509    Copy,
510    Clone,
511    Debug,
512    Hash,
513    Serialize,
514    Deserialize,
515)]
516#[br(little, repr(u8))]
517pub enum Sector {
518    First = 0,
519    Second = 1,
520    Third = 2,
521}
522
523/// Status of a driver in the current session. Represents a [`u8`].
524#[non_exhaustive]
525#[derive(
526    BinRead,
527    Eq,
528    PartialEq,
529    Ord,
530    PartialOrd,
531    Copy,
532    Clone,
533    Debug,
534    Hash,
535    Serialize,
536    Deserialize,
537)]
538#[br(little, repr(u8))]
539pub enum DriverStatus {
540    InGarage = 0,
541    FlyingLap = 1,
542    InLap = 2,
543    OutLap = 3,
544    OnTrack = 4,
545}
546
547/// Status of a driver's result in the current session and final classification.
548/// Represents a [`u8`].
549#[non_exhaustive]
550#[derive(
551    BinRead,
552    Eq,
553    PartialEq,
554    Ord,
555    PartialOrd,
556    Copy,
557    Clone,
558    Debug,
559    Hash,
560    Serialize,
561    Deserialize,
562)]
563#[br(little, repr(u8))]
564pub enum ResultStatus {
565    Unknown = 0,
566    Inactive = 1,
567    Active = 2,
568    Finished = 3,
569    DidNotFinish = 4,
570    Disqualified = 5,
571    NotClassified = 6,
572    Retired = 7,
573}
574
575/// Type of penalty awarded to a driver. Represents a [`u8`].
576#[non_exhaustive]
577#[derive(
578    BinRead,
579    Eq,
580    PartialEq,
581    Ord,
582    PartialOrd,
583    Copy,
584    Clone,
585    Debug,
586    Hash,
587    Serialize,
588    Deserialize,
589)]
590#[br(little, repr(u8))]
591pub enum PenaltyType {
592    DriveThrough = 0,
593    StopGo = 1,
594    GridPenalty = 2,
595    PenaltyReminder = 3,
596    TimePenalty = 4,
597    Warning = 5,
598    Disqualified = 6,
599    RemovedFromFormationLap = 7,
600    ParkedTooLongTimer = 8,
601    TyreRegulations = 9,
602    ThisLapInvalidated = 10,
603    ThisAndNextLapInvalidated = 11,
604    ThisLapInvalidatedWithoutReason = 12,
605    ThisAndNextLapInvalidatedWithoutReason = 13,
606    ThisAndPreviousLapInvalidated = 14,
607    ThisAndPreviousLapInvalidatedWithoutReason = 15,
608    Retired = 16,
609    BlackFlagTimer = 17,
610}
611
612/// Type of offence commited by a driver. Represents a [`u8`].
613#[non_exhaustive]
614#[derive(
615    BinRead,
616    Eq,
617    PartialEq,
618    Ord,
619    PartialOrd,
620    Copy,
621    Clone,
622    Debug,
623    Hash,
624    Serialize,
625    Deserialize,
626)]
627#[br(little, repr(u8))]
628pub enum InfringementType {
629    BlockingBySlowDriving = 0,
630    BlockingByWrongWayDriving = 1,
631    ReversingOffTheStartLine = 2,
632    BigCollision = 3,
633    SmallCollision = 4,
634    CollisionFailedToHandBackPositionSingle = 5,
635    CollisionFailedToHandBackPositionMultiple = 6,
636    CornerCuttingGainedTime = 7,
637    CornerCuttingOvertakeSingle = 8,
638    CornerCuttingOvertakeMultiple = 9,
639    CrossedPitExitLane = 10,
640    IgnoringBlueFlags = 11,
641    IgnoringYellowFlags = 12,
642    IgnoringDriveThrough = 13,
643    TooManyDriveThroughs = 14,
644    DriveThroughReminderServeWithinNLaps = 15,
645    DriveThroughReminderServeThisLap = 16,
646    PitLaneSpeeding = 17,
647    ParkedForTooLong = 18,
648    IgnoringTyreRegulations = 19,
649    TooManyPenalties = 20,
650    MultipleWarnings = 21,
651    ApproachingDisqualification = 22,
652    TyreRegulationsSelectSingle = 23,
653    TyreRegulationsSelectMultiple = 24,
654    LapInvalidatedCornerCutting = 25,
655    LapInvalidatedRunningWide = 26,
656    CornerCuttingRanWideMinorTimeGain = 27,
657    CornerCuttingRanWideSignificantTimeGain = 28,
658    CornerCuttingRanWideExtremeTimeGain = 29,
659    LapInvalidatedWallRiding = 30,
660    LapInvalidatedFlashbackUsed = 31,
661    LapInvalidatedResetToTrack = 32,
662    BlockingThePitLane = 33,
663    JumpStart = 34,
664    SafetyCarCollision = 35,
665    SafetyCarIllegalOvertake = 36,
666    SafetyCarExceedingAllowedPace = 37,
667    VirtualSafetyCarExceedingAllowedPace = 38,
668    FormationLapBelowAllowedSpeed = 39,
669    FormationLapParking = 40,
670    RetiredMechanicalFailure = 41,
671    RetiredTerminallyDamaged = 42,
672    SafetyCarFallingTooFarBack = 43,
673    BlackFlagTimer = 44,
674    UnservedStopGoPenalty = 45,
675    UnservedDriveThroughPenalty = 46,
676    EngineComponentChange = 47,
677    GearboxChange = 48,
678    ParcFermeChange = 49,
679    LeagueGridPenalty = 50,
680    RetryPenalty = 51,
681    IllegalTimeGain = 52,
682    MandatoryPitStop = 53,
683    AttributeAssigned = 54,
684}
685
686/// Bit flags of specific controller buttons being pressed
687/// in a [`Buttons` event](variant@crate::packets::event::EventDetails::Buttons).
688/// Represents a [`u32`].
689#[derive(
690    Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Hash, Serialize, Deserialize,
691)]
692pub struct ButtonStatus(u32);
693
694bitflags! {
695    impl ButtonStatus: u32 {
696        /// The "A" button on an Xbox controller
697        /// or the cross button on a PlayStation controller.
698        /// Has a value of `0x0000_0001`.
699        const A_OR_CROSS = 0x0000_0001;
700        /// The "Y" button on an Xbox controller
701        /// or the triangle button on a PlayStation controller.
702        /// Has a value of `0x0000_0002`.
703        const Y_OR_TRIANGLE = 0x0000_0002;
704        /// The "B" button on an Xbox controller
705        /// or the circle button on a PlayStation controller.
706        /// Has a value of `0x0000_0004`.
707        const B_OR_CIRCLE = 0x0000_0004;
708        /// The "X" button on an Xbox controller
709        /// or the square button on a PlayStation controller.
710        /// Has a value of `0x0000_0008`.
711        const X_OR_SQUARE = 0x0000_0008;
712        /// Left directional pad button. Has a value of `0x0000_0010`.
713        const DPAD_LEFT = 0x0000_0010;
714        /// Right directional pad button. Has a value of `0x0000_0020`.
715        const DPAD_RIGHT = 0x0000_0020;
716        /// Up directional pad button. Has a value of `0x0000_0040`.
717        const DPAD_UP = 0x0000_0040;
718        /// Down directional pad button. Has a value of `0x0000_0080`.
719        const DPAD_DOWN = 0x0000_0080;
720        /// The "Menu" button on an Xbox controller
721        /// or the "Options" button on a PlayStation controller.
722        /// Has a value of `0x0000_0100`.
723        const MENU_OR_OPTIONS = 0x0000_0100;
724        /// Left bumper. Has a value of `0x0000_0200`.
725        const LEFT_BUMPER = 0x0000_0200;
726        /// Right bumper. Has a value of `0x0000_0400`.
727        const RIGHT_BUMPER = 0x0000_0400;
728        /// Left trigger. Has a value of `0x0000_0800`.
729        const LEFT_TRIGGER = 0x0000_0800;
730        /// Right trigger. Has a value of `0x0000_1000`.
731        const RIGHT_TRIGGER = 0x0000_1000;
732        /// Left analog stick click. Has a value of `0x0000_2000`.
733        const LEFT_STICK_CLICK = 0x0000_2000;
734        /// Right analog stick click. Has a value of `0x0000_4000`.
735        const RIGHT_STICK_CLICK = 0x0000_4000;
736        /// Right analog stick left. Has a value of `0x0000_8000`.
737        const RIGHT_STICK_LEFT = 0x0000_8000;
738        /// Right analog stick right. Has a value of `0x0001_0000`
739        const RIGHT_STICK_RIGHT = 0x0001_0000;
740        /// Right analog stick up. Has a value of `0x0002_0000`
741        const RIGHT_STICK_UP = 0x0002_0000;
742        /// Right analog stick down. Has a value of `0x0004_0000`
743        const RIGHT_STICK_DOWN = 0x0004_0000;
744        /// Special button. Has a value of `0x0008_0000`.
745        const SPECIAL = 0x0008_0000;
746        /// UDP Action 1. Has a value of `0x0010_0000`.
747        const UDP_ACTION_1 = 0x0010_0000;
748        /// UDP Action 2. Has a value of `0x0020_0000`.
749        const UDP_ACTION_2 = 0x0020_0000;
750        /// UDP Action 3. Has a value of `0x0040_0000`.
751        const UDP_ACTION_3 = 0x0040_0000;
752        /// UDP Action 4. Has a value of `0x0080_0000`.
753        const UDP_ACTION_4 = 0x0080_0000;
754        /// UDP Action 5. Has a value of `0x0100_0000`.
755        const UDP_ACTION_5 = 0x0100_0000;
756        /// UDP Action 6. Has a value of `0x0200_0000`.
757        const UDP_ACTION_6 = 0x0200_0000;
758        /// UDP Action 7. Has a value of `0x0400_0000`.
759        const UDP_ACTION_7 = 0x0400_0000;
760        /// UDP Action 8. Has a value of `0x0800_0000`.
761        const UDP_ACTION_8 = 0x0800_0000;
762        /// UDP Action 9. Has a value of `0x1000_0000`.
763        const UDP_ACTION_9 = 0x1000_0000;
764        /// UDP Action 10. Has a value of `0x2000_0000`.
765        const UDP_ACTION_10 = 0x2000_0000;
766        /// UDP Action 11. Has a value of `0x4000_0000`.
767        const UDP_ACTION_11 = 0x4000_0000;
768        /// UDP Action 12. Has a value of `0x8000_0000`.
769        const UDP_ACTION_12 = 0x8000_0000;
770    }
771}
772
773/// Unique identifier of a driver's nationality. Represents a [`u8`].
774#[non_exhaustive]
775#[derive(
776    BinRead,
777    Eq,
778    PartialEq,
779    Ord,
780    PartialOrd,
781    Copy,
782    Clone,
783    Debug,
784    Hash,
785    Serialize,
786    Deserialize,
787)]
788#[br(little, repr(u8))]
789pub enum Nationality {
790    Unknown = 0,
791    American = 1,
792    Argentinian = 2,
793    Australian = 3,
794    Austrian = 4,
795    Azerbaijani = 5,
796    Bahraini = 6,
797    Belgian = 7,
798    Bolivian = 8,
799    Brazilian = 9,
800    British = 10,
801    Bulgarian = 11,
802    Cameroonian = 12,
803    Canadian = 13,
804    Chilean = 14,
805    Chinese = 15,
806    Colombian = 16,
807    CostaRican = 17,
808    Croatian = 18,
809    Cypriot = 19,
810    Czech = 20,
811    Danish = 21,
812    Dutch = 22,
813    Ecuadorian = 23,
814    English = 24,
815    Emirian = 25,
816    Estonian = 26,
817    Finnish = 27,
818    French = 28,
819    German = 29,
820    Ghanaian = 30,
821    Greek = 31,
822    Guatemalan = 32,
823    Honduran = 33,
824    HongKonger = 34,
825    Hungarian = 35,
826    Icelander = 36,
827    Indian = 37,
828    Indonesian = 38,
829    Irish = 39,
830    Israeli = 40,
831    Italian = 41,
832    Jamaican = 42,
833    Japanese = 43,
834    Jordanian = 44,
835    Kuwaiti = 45,
836    Latvian = 46,
837    Lebanese = 47,
838    Lithuanian = 48,
839    Luxembourger = 49,
840    Malaysian = 50,
841    Maltese = 51,
842    Mexican = 52,
843    Monegasque = 53,
844    NewZealander = 54,
845    Nicaraguan = 55,
846    NorthernIrish = 56,
847    Norwegian = 57,
848    Omani = 58,
849    Pakistani = 59,
850    Panamanian = 60,
851    Paraguayan = 61,
852    Peruvian = 62,
853    Polish = 63,
854    Portuguese = 64,
855    Qatari = 65,
856    Romanian = 66,
857    Russian = 67,
858    Salvadoran = 68,
859    Saudi = 69,
860    Scottish = 70,
861    Serbian = 71,
862    Singaporean = 72,
863    Slovakian = 73,
864    Slovenian = 74,
865    SouthKorean = 75,
866    SouthAfrican = 76,
867    Spanish = 77,
868    Swedish = 78,
869    Swiss = 79,
870    Thai = 80,
871    Turkish = 81,
872    Uruguayan = 82,
873    Ukrainian = 83,
874    Venezuelan = 84,
875    Welsh = 85,
876    Barbadian = 86,
877    Vietnamese = 87,
878    Algerian = 88,
879    Bosnian = 89,
880    Filipino = 90,
881}
882
883/// "Your telemetry" UDP setting value. Represents a [`u8`].
884#[non_exhaustive]
885#[derive(
886    BinRead,
887    Eq,
888    PartialEq,
889    Ord,
890    PartialOrd,
891    Copy,
892    Clone,
893    Debug,
894    Hash,
895    Serialize,
896    Deserialize,
897)]
898#[br(little, repr(u8))]
899pub enum YourTelemetry {
900    Restricted = 0,
901    Public = 1,
902}
903
904/// Type of surface a tyre is on. Represents a [`u8`].
905#[non_exhaustive]
906#[derive(
907    BinRead,
908    Eq,
909    PartialEq,
910    Ord,
911    PartialOrd,
912    Copy,
913    Clone,
914    Debug,
915    Hash,
916    Serialize,
917    Deserialize,
918)]
919#[br(little, repr(u8))]
920pub enum Surface {
921    Tarmac = 0,
922    RumbleStrip = 1,
923    Concrete = 2,
924    Rock = 3,
925    Gravel = 4,
926    Mud = 5,
927    Sand = 6,
928    Grass = 7,
929    Water = 8,
930    Cobblestone = 9,
931    Metal = 10,
932    Ridged = 11,
933}
934
935/// Bit flags of lit rev lights on a steering wheel.
936/// Represents a [`u16`].
937#[derive(
938    Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Hash, Serialize, Deserialize,
939)]
940pub struct RevLights(u16);
941
942bitflags! {
943    impl RevLights: u16 {
944        /// 1st left (1st leftmost) LED. Has a value of `0x0001`.
945        const LEFT_1 = 0x0001;
946        /// 2nd left (2nd leftmost) LED. Has a value of `0x0002`.
947        const LEFT_2 = 0x0002;
948        /// 3rd left (3rd leftmost) LED. Has a value of `0x0004`.
949        const LEFT_3 = 0x0004;
950        /// 4th left (4th leftmost) LED. Has a value of `0x0008`.
951        const LEFT_4 = 0x0008;
952        /// 5th left (5th leftmost) LED. Has a value of `0x0010`.
953        const LEFT_5 = 0x0010;
954        /// 1st middle (6th leftmost)  LED. Has a value of `0x0020`.
955        const MIDDLE_1 = 0x0020;
956        /// 2nd middle (7th leftmost) LED. Has a value of `0x0040`.
957        const MIDDLE_2 = 0x0040;
958        /// 3rd middle (8th leftmost) LED. Has a value of `0x0080`.
959        const MIDDLE_3 = 0x0080;
960        /// 4th middle (9th leftmost) LED . Has a value of `0x0100`.
961        const MIDDLE_4 = 0x0100;
962        /// 5th middle (10th leftmost) LED . Has a value of `0x0200`.
963        const MIDDLE_5 = 0x0200;
964        /// 1st right (11th leftmost) LED. Has a value of `0x0400`.
965        const RIGHT_1 = 0x0400;
966        /// 2nd right (12th leftmost) LED. Has a value of `0x0800`.
967        const RIGHT_2 = 0x0800;
968        /// 3rd right (13th leftmost) LED. Has a value of `0x1000`.
969        const RIGHT_3 = 0x1000;
970        /// 4th right (14th leftmost) LED. Has a value of `0x2000`.
971        const RIGHT_4 = 0x2000;
972        /// 5th right (15th leftmost) LED. Has a value of `0x4000`.
973        const RIGHT_5 = 0x4000;
974    }
975}
976
977/// Index of currently open multi-function display panel. Represents a [`u8`].
978#[non_exhaustive]
979#[derive(
980    BinRead,
981    Eq,
982    PartialEq,
983    Ord,
984    PartialOrd,
985    Copy,
986    Clone,
987    Debug,
988    Hash,
989    Serialize,
990    Deserialize,
991)]
992#[br(little, repr(u8))]
993pub enum MfdPanelIndex {
994    CarSetup = 0,
995    Pits = 1,
996    Damage = 2,
997    Engine = 3,
998    Temperatures = 4,
999    Closed = 255,
1000}
1001
1002/// Type of enabled traction control assist. Represents a [`u8`].
1003#[non_exhaustive]
1004#[derive(
1005    BinRead,
1006    Eq,
1007    PartialEq,
1008    Ord,
1009    PartialOrd,
1010    Copy,
1011    Clone,
1012    Debug,
1013    Hash,
1014    Serialize,
1015    Deserialize,
1016)]
1017#[br(little, repr(u8))]
1018pub enum TractionControl {
1019    Off = 0,
1020    Medium = 1,
1021    Full = 2,
1022}
1023
1024/// Type of fuel mix that's currently in use. Represents a [`u8`].
1025#[non_exhaustive]
1026#[derive(
1027    BinRead,
1028    Eq,
1029    PartialEq,
1030    Ord,
1031    PartialOrd,
1032    Copy,
1033    Clone,
1034    Debug,
1035    Hash,
1036    Serialize,
1037    Deserialize,
1038)]
1039#[br(little, repr(u8))]
1040pub enum FuelMix {
1041    Lean = 0,
1042    Standard = 1,
1043    Rich = 2,
1044    Max = 3,
1045}
1046
1047/// ERS deployment mode that's currently in use. Represents a [`u8`].
1048#[non_exhaustive]
1049#[derive(
1050    BinRead,
1051    Eq,
1052    PartialEq,
1053    Ord,
1054    PartialOrd,
1055    Copy,
1056    Clone,
1057    Debug,
1058    Hash,
1059    Serialize,
1060    Deserialize,
1061)]
1062#[br(little, repr(u8))]
1063pub enum ErsDeployMode {
1064    None = 0,
1065    Medium = 1,
1066    Overtake = 2,
1067    Hotlap = 3,
1068}
1069
1070/// Flag the driver is currently being shown. Represents an [`i8`].
1071#[non_exhaustive]
1072#[derive(
1073    BinRead,
1074    Eq,
1075    PartialEq,
1076    Ord,
1077    PartialOrd,
1078    Copy,
1079    Clone,
1080    Debug,
1081    Hash,
1082    Serialize,
1083    Deserialize,
1084)]
1085#[br(little, repr(i8))]
1086pub enum VehicleFiaFlag {
1087    Unknown = -1,
1088    None = 0,
1089    Green = 1,
1090    Blue = 2,
1091    Yellow = 3,
1092    Red = 4,
1093}
1094
1095/// Global DRS activation permission status. Represents an [`i8`].
1096#[non_exhaustive]
1097#[derive(
1098    BinRead,
1099    Eq,
1100    PartialEq,
1101    Ord,
1102    PartialOrd,
1103    Copy,
1104    Clone,
1105    Debug,
1106    Hash,
1107    Serialize,
1108    Deserialize,
1109)]
1110#[br(little, repr(i8))]
1111pub enum DrsAllowed {
1112    Unknown = -1,
1113    NotAllowed = 0,
1114    Allowed = 1,
1115}
1116
1117/// Session-independent tyre compound type. Represents a [`u8`].
1118#[non_exhaustive]
1119#[derive(
1120    BinRead,
1121    Eq,
1122    PartialEq,
1123    Ord,
1124    PartialOrd,
1125    Copy,
1126    Clone,
1127    Debug,
1128    Hash,
1129    Serialize,
1130    Deserialize,
1131)]
1132#[br(little, repr(u8))]
1133pub enum ActualTyreCompound {
1134    Unknown = 0,
1135    C5 = 16,
1136    C4 = 17,
1137    C3 = 18,
1138    C2 = 19,
1139    C1 = 20,
1140    C0 = 21,
1141    Inter = 7,
1142    Wet = 8,
1143    ClassicDry = 9,
1144    ClassicWet = 10,
1145    F2SuperSoft = 11,
1146    F2Soft = 12,
1147    F2Medium = 13,
1148    F2Hard = 14,
1149    F2Wet = 15,
1150}
1151
1152/// Visual indicator of a tyre compound's type in a given session.
1153/// Represents a [`u8`].
1154#[non_exhaustive]
1155#[derive(
1156    BinRead,
1157    Eq,
1158    PartialEq,
1159    Ord,
1160    PartialOrd,
1161    Copy,
1162    Clone,
1163    Debug,
1164    Hash,
1165    Serialize,
1166    Deserialize,
1167)]
1168#[br(little, repr(u8))]
1169pub enum VisualTyreCompound {
1170    Unknown = 0,
1171    F1Soft = 16,
1172    F1Medium = 17,
1173    F1Hard = 18,
1174    F1Inter = 7,
1175    F1Wet = 8,
1176    ClassicDry = 9,
1177    ClassicWet = 10,
1178    F2SuperSoft = 19,
1179    F2Soft = 20,
1180    F2Medium = 21,
1181    F2Hard = 22,
1182    F2Wet = 15,
1183}
1184
1185/// Readiness of a player in an online lobby. Represents a [`u8`].
1186#[non_exhaustive]
1187#[derive(
1188    BinRead,
1189    Eq,
1190    PartialEq,
1191    Ord,
1192    PartialOrd,
1193    Copy,
1194    Clone,
1195    Debug,
1196    Hash,
1197    Serialize,
1198    Deserialize,
1199)]
1200#[br(little, repr(u8))]
1201pub enum ReadyStatus {
1202    NotReady = 0,
1203    Ready = 1,
1204    Spectating = 2,
1205}
1206
1207/// Bit flags of lap validity across all three sectors and overall.
1208/// Represents a [`u8`].
1209#[derive(
1210    Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Hash, Serialize, Deserialize,
1211)]
1212pub struct LapValid(u8);
1213
1214bitflags! {
1215    impl LapValid: u8 {
1216        /// Whether the whole lap is valid. Has a value of `0x01`.
1217        const OVERALL = 0x01;
1218        /// Whether the sector 1 run is valid. Has a value of `0x02`.
1219        const SECTOR_1 = 0x02;
1220        /// Whether the sector 2 run is valid. Has a value of `0x04`.
1221        const SECTOR_2 = 0x04;
1222        /// Whether the sector 3 run is valid. Has a value of `0x08`.
1223        const SECTOR_3 = 0x08;
1224    }
1225}
1226
1227/// Speed unit used by a player. Represents a [`u8`].
1228#[non_exhaustive]
1229#[derive(
1230    BinRead,
1231    Eq,
1232    PartialEq,
1233    Ord,
1234    PartialOrd,
1235    Copy,
1236    Clone,
1237    Debug,
1238    Hash,
1239    Serialize,
1240    Deserialize,
1241)]
1242#[br(little, repr(u8))]
1243pub enum SpeedUnit {
1244    MilesPerHour = 0,
1245    KilometresPerHour = 1,
1246}
1247
1248/// Temperature unit used by a player. Represents a [`u8`].
1249#[non_exhaustive]
1250#[derive(
1251    BinRead,
1252    Eq,
1253    PartialEq,
1254    Ord,
1255    PartialOrd,
1256    Copy,
1257    Clone,
1258    Debug,
1259    Hash,
1260    Serialize,
1261    Deserialize,
1262)]
1263#[br(little, repr(u8))]
1264pub enum TemperatureUnit {
1265    Celsius = 0,
1266    Fahrenheit = 1,
1267}
1268
1269/// Console or PC game distribution platform used by a player.
1270/// Represents a [`u8`].
1271#[non_exhaustive]
1272#[derive(
1273    BinRead,
1274    Eq,
1275    PartialEq,
1276    Ord,
1277    PartialOrd,
1278    Copy,
1279    Clone,
1280    Debug,
1281    Hash,
1282    Serialize,
1283    Deserialize,
1284)]
1285#[br(little, repr(u8))]
1286pub enum Platform {
1287    Invalid = 0,
1288    Steam = 1,
1289    PlayStation = 3,
1290    Xbox = 4,
1291    Origin = 6,
1292    Unknown = 255,
1293}
1294
1295/// Recovery mode assist that's currently enabled.
1296/// Represents a [`u8`].
1297#[non_exhaustive]
1298#[derive(
1299    BinRead,
1300    Eq,
1301    PartialEq,
1302    Ord,
1303    PartialOrd,
1304    Copy,
1305    Clone,
1306    Debug,
1307    Hash,
1308    Serialize,
1309    Deserialize,
1310)]
1311#[br(little, repr(u8))]
1312pub enum RecoveryMode {
1313    None = 0,
1314    Flashbacks = 1,
1315    AutoRecovery = 2,
1316}
1317
1318/// Flashback usage limit that's currently enabled.
1319/// Represents a [`u8`].
1320#[non_exhaustive]
1321#[derive(
1322    BinRead,
1323    Eq,
1324    PartialEq,
1325    Ord,
1326    PartialOrd,
1327    Copy,
1328    Clone,
1329    Debug,
1330    Hash,
1331    Serialize,
1332    Deserialize,
1333)]
1334#[br(little, repr(u8))]
1335pub enum FlashbackLimit {
1336    Low = 0,
1337    Medium = 1,
1338    High = 2,
1339    Unlimited = 3,
1340}
1341
1342/// Type of surface simulation that's currently enabled.
1343/// Represents a [`u8`].
1344#[non_exhaustive]
1345#[derive(
1346    BinRead,
1347    Eq,
1348    PartialEq,
1349    Ord,
1350    PartialOrd,
1351    Copy,
1352    Clone,
1353    Debug,
1354    Hash,
1355    Serialize,
1356    Deserialize,
1357)]
1358#[br(little, repr(u8))]
1359pub enum SurfaceSimType {
1360    Simplified = 0,
1361    Realistic = 1,
1362}
1363
1364/// Difficulty of driving with low fuel. Represent a [`u8`].
1365#[non_exhaustive]
1366#[derive(
1367    BinRead,
1368    Eq,
1369    PartialEq,
1370    Ord,
1371    PartialOrd,
1372    Copy,
1373    Clone,
1374    Debug,
1375    Hash,
1376    Serialize,
1377    Deserialize,
1378)]
1379#[br(little, repr(u8))]
1380pub enum LowFuelMode {
1381    Easy = 0,
1382    Hard = 1,
1383}
1384
1385/// Race starts assist that's currently in use.
1386/// Represents a [`u8`].
1387#[non_exhaustive]
1388#[derive(
1389    BinRead,
1390    Eq,
1391    PartialEq,
1392    Ord,
1393    PartialOrd,
1394    Copy,
1395    Clone,
1396    Debug,
1397    Hash,
1398    Serialize,
1399    Deserialize,
1400)]
1401#[br(little, repr(u8))]
1402pub enum RaceStarts {
1403    Manual = 0,
1404    Assisted = 1,
1405}
1406
1407/// Type of tyre temperature simulation that's currently in use.
1408/// Represents a [`u8`].
1409#[non_exhaustive]
1410#[derive(
1411    BinRead,
1412    Eq,
1413    PartialEq,
1414    Ord,
1415    PartialOrd,
1416    Copy,
1417    Clone,
1418    Debug,
1419    Hash,
1420    Serialize,
1421    Deserialize,
1422)]
1423#[br(little, repr(u8))]
1424pub enum TyreTemperature {
1425    SurfaceOnly = 0,
1426    SurfaceAndCarcass = 1,
1427}
1428
1429/// Type of car damage simulation that's currently in use.
1430/// Represents a [`u8`].
1431#[non_exhaustive]
1432#[derive(
1433    BinRead,
1434    Eq,
1435    PartialEq,
1436    Ord,
1437    PartialOrd,
1438    Copy,
1439    Clone,
1440    Debug,
1441    Hash,
1442    Serialize,
1443    Deserialize,
1444)]
1445#[br(little, repr(u8))]
1446pub enum CarDamage {
1447    Off = 0,
1448    Reduced = 1,
1449    Standard = 2,
1450    Simulation = 3,
1451}
1452
1453/// Car damage severity. Represents a [`u8`].
1454#[non_exhaustive]
1455#[derive(
1456    BinRead,
1457    Eq,
1458    PartialEq,
1459    Ord,
1460    PartialOrd,
1461    Copy,
1462    Clone,
1463    Debug,
1464    Hash,
1465    Serialize,
1466    Deserialize,
1467)]
1468#[br(little, repr(u8))]
1469pub enum CarDamageRate {
1470    Reduced = 0,
1471    Standard = 1,
1472    Simulation = 2,
1473}
1474
1475/// Type of collision simulation that's currently enabled.
1476/// Represents a [`u8`].
1477#[non_exhaustive]
1478#[derive(
1479    BinRead,
1480    Eq,
1481    PartialEq,
1482    Ord,
1483    PartialOrd,
1484    Copy,
1485    Clone,
1486    Debug,
1487    Hash,
1488    Serialize,
1489    Deserialize,
1490)]
1491#[br(little, repr(u8))]
1492pub enum Collisions {
1493    Off = 0,
1494    PlayerToPlayerOff = 1,
1495    On = 2,
1496}
1497
1498/// Type of corner cutting and track limits punishability.
1499/// Represents a [`u8`].
1500#[non_exhaustive]
1501#[derive(
1502    BinRead,
1503    Eq,
1504    PartialEq,
1505    Ord,
1506    PartialOrd,
1507    Copy,
1508    Clone,
1509    Debug,
1510    Hash,
1511    Serialize,
1512    Deserialize,
1513)]
1514#[br(little, repr(u8))]
1515pub enum CornerCuttingStringency {
1516    Regular = 0,
1517    Strict = 1,
1518}
1519
1520/// The way the game handles pit stops. Represents a [`u8`].
1521#[non_exhaustive]
1522#[derive(
1523    BinRead,
1524    Eq,
1525    PartialEq,
1526    Ord,
1527    PartialOrd,
1528    Copy,
1529    Clone,
1530    Debug,
1531    Hash,
1532    Serialize,
1533    Deserialize,
1534)]
1535#[br(little, repr(u8))]
1536pub enum PitStopExperience {
1537    Automatic = 0,
1538    Broadcast = 1,
1539    Immersive = 2,
1540}
1541
1542/// The likelihood of safety car getting deployed with hazard on track.
1543/// Represents a [`u8`].
1544#[non_exhaustive]
1545#[derive(
1546    BinRead,
1547    Eq,
1548    PartialEq,
1549    Ord,
1550    PartialOrd,
1551    Copy,
1552    Clone,
1553    Debug,
1554    Hash,
1555    Serialize,
1556    Deserialize,
1557)]
1558#[br(little, repr(u8))]
1559pub enum SafetyCarIntensity {
1560    Off = 0,
1561    Reduced = 1,
1562    Standard = 2,
1563    Increased = 3,
1564}
1565
1566/// The way the game handles safety car periods. Represents a [`u8`].
1567#[non_exhaustive]
1568#[derive(
1569    BinRead,
1570    Eq,
1571    PartialEq,
1572    Ord,
1573    PartialOrd,
1574    Copy,
1575    Clone,
1576    Debug,
1577    Hash,
1578    Serialize,
1579    Deserialize,
1580)]
1581#[br(little, repr(u8))]
1582pub enum SafetyCarExperience {
1583    Broadcast = 0,
1584    Immersive = 1,
1585    Unknown = 255,
1586}
1587
1588/// The way the game handles formation laps. Represents a [`u8`].
1589#[non_exhaustive]
1590#[derive(
1591    BinRead,
1592    Eq,
1593    PartialEq,
1594    Ord,
1595    PartialOrd,
1596    Copy,
1597    Clone,
1598    Debug,
1599    Hash,
1600    Serialize,
1601    Deserialize,
1602)]
1603#[br(little, repr(u8))]
1604pub enum FormationLapExperience {
1605    Broadcast = 0,
1606    Immersive = 1,
1607    Unknown = 255,
1608}
1609
1610/// The likelihood of the game using a red flag after a serious incident.
1611/// Represents a [`u8`].
1612#[non_exhaustive]
1613#[derive(
1614    BinRead,
1615    Eq,
1616    PartialEq,
1617    Ord,
1618    PartialOrd,
1619    Copy,
1620    Clone,
1621    Debug,
1622    Hash,
1623    Serialize,
1624    Deserialize,
1625)]
1626#[br(little, repr(u8))]
1627pub enum RedFlagIntensity {
1628    Off = 0,
1629    Reduced = 1,
1630    Standard = 2,
1631    Increased = 3,
1632}
1633
1634/// Type of safety car being deployed in a
1635/// [`SafetyCar` event](variant@crate::packets::event::EventDetails::SafetyCar).
1636/// Represents a [`u8`].
1637#[non_exhaustive]
1638#[derive(
1639    BinRead,
1640    Eq,
1641    PartialEq,
1642    Ord,
1643    PartialOrd,
1644    Copy,
1645    Clone,
1646    Debug,
1647    Hash,
1648    Serialize,
1649    Deserialize,
1650)]
1651#[br(little, repr(u8))]
1652pub enum SafetyCarType {
1653    None = 0,
1654    Full = 1,
1655    Virtual = 2,
1656    FormationLap = 3,
1657}
1658
1659/// Type of [`SafetyCar` event](variant@crate::packets::event::EventDetails::SafetyCar).
1660/// Represents a [`u8`].
1661#[non_exhaustive]
1662#[derive(
1663    BinRead,
1664    Eq,
1665    PartialEq,
1666    Ord,
1667    PartialOrd,
1668    Copy,
1669    Clone,
1670    Debug,
1671    Hash,
1672    Serialize,
1673    Deserialize,
1674)]
1675#[br(little, repr(u8))]
1676pub enum SafetyCarEventType {
1677    Deployed = 0,
1678    Returning = 1,
1679    Returned = 2,
1680    ResumeRace = 3,
1681}