summaryrefslogtreecommitdiff
path: root/src/udp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/udp.h')
-rw-r--r--src/udp.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/udp.h b/src/udp.h
new file mode 100644
index 0000000..05db434
--- /dev/null
+++ b/src/udp.h
@@ -0,0 +1,44 @@
+#pragma once
+#include "util.h"
+
+#define PSI_TO_BAR 0.0689476f
+
+struct TELEMETRY {
+ I32 race_on;
+ F32 rpm;
+ F32 rpm_max;
+ F32 rpm_idle;
+
+ U8 extended; // fields below valid (324-byte packet)
+ F32 speed_ms;
+ F32 pos_x, pos_y, pos_z;
+ F32 vel_x, vel_y, vel_z;
+ F32 power;
+ F32 boost_psi;
+ I32 gear; // 0 = R, 1..10, >= 11 = N
+ I32 accel, brake; // 0..255
+ I32 handbrake, clutch; // 0..255
+ I32 car_ordinal; // unique car id; changes on car swap
+ I32 drivetrain; // 0 FWD, 1 RWD, 2 AWD
+ F32 slip_ratio[4]; // FL FR RL RR
+ F32 combined_slip[4];
+ F32 tire_temp[4];
+ F32 racetime;
+ U32 racepos;
+ U32 lapnum;
+ F32 laptime;
+ I32 norm_driving_line;
+ I32 norm_ai_brake_diff;
+ F64 stamp;
+};
+
+class UDP_LISTENER {
+public:
+ I32 fd;
+
+ UDP_LISTENER();
+ ~UDP_LISTENER();
+};
+
+STAT udp_open( UDP_LISTENER* udp, I32 port );
+void udp_parse( UDP_LISTENER* udp, TELEMETRY* t );