forked from SHWotever/MotoGP-18-UDP-Telemetry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMotoGP18Packet.cs
150 lines (105 loc) · 3.15 KB
/
MotoGP18Packet.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
using System;
using System.Runtime.InteropServices;
namespace MotoGP18UDPTelemetry
{
[StructLayout(LayoutKind.Explicit)]
public struct MotoGP18Packet
{
[FieldOffset(0)]
public Int32 Header;
[FieldOffset(4)]
public UInt32 packetid;
[FieldOffset(8)]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string Track;
[FieldOffset(40)]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
public string Model;
[FieldOffset(104)]
public byte CurrentLap;
[FieldOffset(105)]
public byte Position;
[FieldOffset(106)]
public Single LapTime;
[FieldOffset(110)]
public Single LastLapTime;
[FieldOffset(114)]
public Single SessionTime;
[FieldOffset(118)]
public byte GameMode;
[FieldOffset(119)]
public Single S1;
[FieldOffset(123)]
public Single S2;
[FieldOffset(127)]
public Single S3;
[FieldOffset(136)]
public Single LapDistance;
[FieldOffset(140)]
public Single TotalDistance;
[FieldOffset(150)]
public Single CoordinatesX;
[FieldOffset(154)]
public Single CoordinatesY;
[FieldOffset(158)]
public Single CoordinatesZ;
// [FieldOffset(162)]
// public Single?;
//[FieldOffset(166)]
// public Single?;
[FieldOffset(170)]
public Single Pitch;
[FieldOffset(174)]
public Single Yaw;
[FieldOffset(187)]
public Single MaxRpm;
[FieldOffset(191)]
public byte gear;
[FieldOffset(192)]
public Single RPM;
[FieldOffset(196)]
public Single Steering;
[FieldOffset(200)]
public Single Throttle;
[FieldOffset(204)]
public Single Clutch;
[FieldOffset(208)]
public Single BrakeF;
[FieldOffset(212)]
public Single BrakeR;
[FieldOffset(216)]
public Single SuspensionPositionF;
[FieldOffset(220)]
public Single SuspensionPositionR;
[FieldOffset(232)]
public Single WheelSpeedF;
[FieldOffset(236)]
public Single WheelSpeedR;
[FieldOffset(250)]
public Single WheelSlipF;
[FieldOffset(254)]
public Single WheelSlipR;
[FieldOffset(266)]
public byte FrontTyreCompound;
[FieldOffset(267)]
public byte RearTyreCompound;
[FieldOffset(268)]
public Single BrakeTempF;
[FieldOffset(276)]
public Single LongitudinalBodyPosition;
[FieldOffset(284)]
public Single LateralGforce;
[FieldOffset(288)]
public Single LongitudinalGforce;
[FieldOffset(292)]
public Single Speed;
public string FrontTyreCompoundName { get { return ((Compound)FrontTyreCompound).ToString(); } }
public string RearTyreCompoundName { get { return ((Compound)FrontTyreCompound).ToString(); } }
}
public enum Compound
{
Soft = 2,
Medium = 4,
Hard = 6
}
}