Here i started a thread asking on how to Capture Broadcast UDP Packets.
I´m not able to test it as yet but i´m sure it will work when erel says it will.
So. Imagine it will work, then i am supposed to get different UDP Packets with different contents.
One packet for example is the ParticipantInfoStrings struct
From my investigations with delphi on win32 i can say that i got two kind of packets so far.
ONE with a size of 1347 and a lot other with the size of 1367 bytes.
The last one are the truct sTelemetryData
How would i need to use the bytearray i have to get the sBuildVersionNumber, sPacketType, sCarName and so on into B4J variables?
I need to understand how to interpret for example
u16 sBuildVersionNumber; // 0
How do i get a B4J variable from the first two bytes of the bytearray?
There are different types in the structs i have to rebuild.
u16, u32, u8, s8, s16, f32, char....
The structs for the telemetrydata is more complex
Any help/tips/hints are welcome ;-)
I´m not able to test it as yet but i´m sure it will work when erel says it will.
So. Imagine it will work, then i am supposed to get different UDP Packets with different contents.
One packet for example is the ParticipantInfoStrings struct
struct sParticipantInfoStrings
{
static const u32 sPacketSize = 1347;
u16 sBuildVersionNumber; // 0
u8 sPacketType; // 2
char sCarName[64]; // 3
char sCarClassName[64]; // 131
char sTrackLocation[64]; // 195
char sTrackVariation[64]; // 259
char sName[16][64]; // 323
// 1347
};
From my investigations with delphi on win32 i can say that i got two kind of packets so far.
ONE with a size of 1347 and a lot other with the size of 1367 bytes.
The last one are the truct sTelemetryData
How would i need to use the bytearray i have to get the sBuildVersionNumber, sPacketType, sCarName and so on into B4J variables?
I need to understand how to interpret for example
u16 sBuildVersionNumber; // 0
How do i get a B4J variable from the first two bytes of the bytearray?
There are different types in the structs i have to rebuild.
u16, u32, u8, s8, s16, f32, char....
The structs for the telemetrydata is more complex
struct sTelemetryData
{
static const u32 sPacketSize = 1367;
u16 sBuildVersionNumber; // 0
u8 sPacketType; // 2
// Game states
u8 sGameSessionState; // 3
// Participant info
s8 sViewedParticipantIndex; // 4
s8 sNumParticipants; // 5
// Unfiltered input
u8 sUnfilteredThrottle; // 6
u8 sUnfilteredBrake; // 7
s8 sUnfilteredSteering; // 8
u8 sUnfilteredClutch; // 9
u8 sRaceStateFlags; // 10
// Event information
u8 sLapsInEvent; // 11
// Timings
f32 sBestLapTime; // 12
f32 sLastLapTime; // 16
f32 sCurrentTime; // 20
f32 sSplitTimeAhead; // 24
f32 sSplitTimeBehind; // 28
f32 sSplitTime; // 32
f32 sEventTimeRemaining; // 36
f32 sPersonalFastestLapTime; // 40
f32 sWorldFastestLapTime; // 44
f32 sCurrentSector1Time; // 48
f32 sCurrentSector2Time; // 52
f32 sCurrentSector3Time; // 56
f32 sFastestSector1Time; // 60
f32 sFastestSector2Time; // 64
f32 sFastestSector3Time; // 68
f32 sPersonalFastestSector1Time; // 72
f32 sPersonalFastestSector2Time; // 76
f32 sPersonalFastestSector3Time; // 80
f32 sWorldFastestSector1Time; // 84
f32 sWorldFastestSector2Time; // 88
f32 sWorldFastestSector3Time; // 92
u16 sJoyPad; // 96
// Flags
u8 sHighestFlag; // 98
// Pit info
u8 sPitModeSchedule; // 99
// Car state
s16 sOilTempCelsius; // 100
u16 sOilPressureKPa; // 102
s16 sWaterTempCelsius; // 104
u16 sWaterPressureKpa; // 106
u16 sFuelPressureKpa; // 108
u8 sCarFlags; // 110
u8 sFuelCapacity; // 111
u8 sBrake; // 112
u8 sThrottle; // 113
u8 sClutch; // 114
s8 sSteering; // 115
f32 sFuelLevel; // 116
f32 sSpeed; // 120
u16 sRpm; // 124
u16 sMaxRpm; // 126
u8 sGearNumGears; // 128
u8 sBoostAmount; // 129
s8 sEnforcedPitStopLap; // 130
u8 sCrashState; // 131
f32 sOdometerKM; // 132
f32 sOrientation[3]; // 136
f32 sLocalVelocity[3]; // 148
f32 sWorldVelocity[3]; // 160
f32 sAngularVelocity[3]; // 172
f32 sLocalAcceleration[3]; // 184
f32 sWorldAcceleration[3]; // 196
f32 sExtentsCentre[3]; // 208
// Wheels / Tyres
u8 sTyreFlags[4]; // 220
u8 sTerrain[4]; // 224
f32 sTyreY[4]; // 228
f32 sTyreRPS[4]; // 244
f32 sTyreSlipSpeed[4]; // 260
u8 sTyreTemp[4]; // 276
u8 sTyreGrip[4]; // 280
f32 sTyreHeightAboveGround[4]; // 284
f32 sTyreLateralStiffness[4]; // 300
u8 sTyreWear[4]; // 316
u8 sBrakeDamage[4]; // 320
u8 sSuspensionDamage[4]; // 324
s16 sBrakeTempCelsius[4]; // 328
u16 sTyreTreadTemp[4]; // 336
u16 sTyreLayerTemp[4]; // 344
u16 sTyreCarcassTemp[4]; // 352
u16 sTyreRimTemp[4]; // 360
u16 sTyreInternalAirTemp[4]; // 368
f32 sWheelLocalPositionY[4]; // 376
f32 sRideHeight[4]; // 392
f32 sSuspensionTravel[4]; // 408
f32 sSuspensionVelocity[4]; // 424
u16 sAirPressure[4]; // 440
// Extras
f32 sEngineSpeed; // 448
f32 sEngineTorque; // 452
// Car damage
u8 sAeroDamage; // 456
u8 sEngineDamage; // 457
// Weather
s8 sAmbientTemperature; // 458
s8 sTrackTemperature; // 459
u8 sRainDensity; // 460
s8 sWindSpeed; // 461
s8 sWindDirectionX; // 462
s8 sWindDirectionY; // 463
sParticipantInfo sParticipantInfo[56]; // 464
// 56*16=896
f32 sTrackLength; // 1360
u8 sWings[2]; // 1364
u8 sDPad; // 1366
// 1368 struct is padded to
};
Any help/tips/hints are welcome ;-)