Driver data

This part contains information of the driver state like position, damage, etc...

This stucture is for an eventClass equals to 0.

Structure
This structure have a size defined in the event header : 63 bytes.

Detailed View of some fields:
 * The current gear can be retrieved from the evenType:
 * 7 means R (rear)
 * 8 means N (neutral)
 * 9 means 1 (first)
 * 10 means 2 (second)
 * 15 means 7 (seventh)
 * 15 means 7 (seventh)

Info1
// xxxxxxxx xxxxxx00 00000000 00000000 - current RPS (14 bits) // 00000000 000000x0 00000000 00000000 - in pit lane flag (1 bit) // 00000000 0000000x xxxxx000 00000000 - throttle (6 bits) // 00000000 00000000 00000x00 00000000 - horn (1 bit) // 00000000 00000000 000000xx xxxxxxxx - steer yaw (10 bits)

Info2
// xxxxxxxx 00000000 00000000 00000000 - acceleration (see below) // 00000000 x0000000 00000000 00000000 - properly following // 00000000 0x000000 00000000 00000000 - warning light flag // 00000000 00x00000 00000000 00000000 - driver visible flag // 00000000 000x0000 00000000 00000000 - head light flag // 00000000 0000xx00 00000000 00000000 - current driver (2 bits) // 00000000 000000x0 00000000 00000000 - detachable Part Damage State (DPART_DEBRIS11) // 00000000 0000000x 00000000 00000000 - detachable Part Damage State (DPART_DEBRIS10) // 00000000 00000000 x0000000 00000000 - detachable Part Damage State (DPART_DEBRIS9) // 00000000 00000000 0x000000 00000000 - detachable Part Damage State (DPART_DEBRIS8) <span style="color:rgb(51,51,51);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:normal;">// 00000000 00000000 00x00000 00000000 - detachable Part Damage State (DPART_DEBRIS7) <span style="color:rgb(51,51,51);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:normal;">// 00000000 00000000 000x0000 00000000 - detachable Part Damage State (DPART_DEBRIS6) <span style="color:rgb(51,51,51);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:normal;">// 00000000 00000000 0000x000 00000000 - detachable Part Damage State (DPART_DEBRIS5) <span style="color:rgb(51,51,51);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:normal;">// 00000000 00000000 00000x00 00000000 - detachable Part Damage State (DPART_DEBRIS4) <span style="color:rgb(51,51,51);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:normal;">// 00000000 00000000 000000x0 00000000 - detachable Part Damage State (DPART_DEBRIS3) <span style="color:rgb(51,51,51);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:normal;">// 00000000 00000000 0000000x 00000000 - detachable Part Damage State (DPART_DEBRIS2) <span style="color:rgb(51,51,51);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:normal;">// 00000000 00000000 00000000 x0000000 - detachable Part Damage State (DPART_DEBRIS1) <span style="color:rgb(51,51,51);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:normal;">// 00000000 00000000 00000000 0x000000 - detachable Part Damage State (DPART_DEBRIS0) <span style="color:rgb(51,51,51);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:normal;">// 00000000 00000000 00000000 00x00000 - detachable Part Damage State (DPART_RWING) <span style="color:rgb(51,51,51);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:normal;">// 00000000 00000000 00000000 000x0000 - detachable Part Damage State (DPART_FWING) <span style="color:rgb(51,51,51);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:normal;">// 00000000 00000000 00000000 0000x000 - detachable Part Damage State (DPART_RR) <span style="color:rgb(51,51,51);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:normal;">// 00000000 00000000 00000000 00000x00 - detachable Part Damage State (DPART_RL) <span style="color:rgb(51,51,51);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:normal;">// 00000000 00000000 00000000 000000x0 - detachable Part Damage State (DPART_FR) <span style="color:rgb(51,51,51);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:normal;">// 00000000 00000000 00000000 0000000x - detachable Part Damage State (DPART_FL)

Info4
<span style="color:rgb(51,51,51);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:normal;">// xx000000 - traction control level (2 bits) <span style="color:rgb(51,51,51);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:normal;">// 00xxxxxx - brakes (6 bits)

How to decrypt speedInfo
xxxxxxxx yyXxxxxx yyyyyyyy zzzzzzYy Zzzzzzzz // x is a bit of Vx, X is the Sign bit of Vx // y is a bit of Vy, Y is the Sign bit of Vy // z is a bit of Vz, Z is the Sign bit of Vz



Here a C# code used to decrypt the 5 bytes (using Little Indian convention). byte[] speedInfo = br.ReadBytes(5); // 5 bytes of the speed info byte[] vx = new byte[2]; vx[0] = speedInfo[0]; if ((speedInfo[1] & 32) != 0) {               // negative : so fill missing bits with 1 vx[1] = (byte)((speedInfo[1] & 0x3F) + 128 + 64); }            else {                vx[1] = (byte)((speedInfo[1] & 0x3F)); }            float speedX = (3.6f * BitConverter.ToInt16(vx, 0) / 32.0f); byte[] vy = new byte[2]; vy[0] = (byte)((speedInfo[1] >> 6) + ((speedInfo[2] & 0x3F) << 2)); if ((speedInfo[3] & 2) != 0) {               // negative : so fill missing bits with 1 vy[1] = (byte)((speedInfo[2] >> 6) + ((speedInfo[3] & 1) << 2)+ 8 + 16+32+64+128); }            else {                vy[1] = (byte)((speedInfo[2] >> 6) + ((speedInfo[3] & 1) << 2)); }            float speedY = (3.6f * BitConverter.ToInt16(vy, 0) / 20.0f); byte[] vz = new byte[2]; vz[0] = (byte)(((speedInfo[3] & 0xFC) >> 2) + ((speedInfo[4] & 3) << 6)); if ((speedInfo[4] & 128) != 0) {               // negative : so fill missing bits with 1 vz[1] = (byte)((speedInfo[4] >> 2) + 128 + 64); }            else {                vz[1] = (byte)(speedInfo[4] >> 2); }            float speedZ = (3.6f * BitConverter.ToInt16(vz, 0) / 32.0f) ; ...