Codemasters.F1_2020 4.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Codemasters.F1_2020 --version 4.1.0                
NuGet\Install-Package Codemasters.F1_2020 -Version 4.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Codemasters.F1_2020" Version="4.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Codemasters.F1_2020 --version 4.1.0                
#r "nuget: Codemasters.F1_2020, 4.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Codemasters.F1_2020 as a Cake Addin
#addin nuget:?package=Codemasters.F1_2020&version=4.1.0

// Install Codemasters.F1_2020 as a Cake Tool
#tool nuget:?package=Codemasters.F1_2020&version=4.1.0                

Codemasters.F1_2020

A package of resources for deserializing and analyzing UDP telemetry data from the F1 2020 video game by Codemasters.

The F1 2020 video game will provide to you a UDP data package in the form of a byte array (byte[]). There are several different types of data packets that the game will broadcast. Import the following namespace to use the basic resources for reading data:

using Codemasters.F1_2020;

Every packet type derives from the same base class, Packet. The Packet class contains the following properties:

PacketFormat - Describes the game the packet is from (F1 2020)
GameMajorVersion - The major version of the game at the time of broadcast
GameMinorVersion - The minor version of the game at the time of broadcast
PacketVersion
PacketType - The type of packet this data is (i.e. Telemetry, status, lap data, etc.)
UniqueSessionId - The unique ID of your session.
SessioTime - The timestamp of the current session when this packet was recorded and broadcasted.
FrameIdentifier - Which grouping of packets this data belongs to.
PlayerCarIndex - The index of the player's car in field arrays in all corresponding packets.
SecondaryPlayerCarIndex - If you are playing two player (split screen), this will be player 2's index in the field array.

To tell what type of packet any array of bytes that was provided to you is, use the CodemastersToolkit. The bytes variable below would come from your telemetry broadcast, or from a deserialized file if you saved telemetry on disk.

byte[] bytes; //Your telemetry data package
PacketType pt = CodemastersToolkit.GetPacketType(bytes);
Console.WriteLine(pt.ToString());

Console output of the above: "CarTelemetry"
Since we know that this particular data package is a telemetry packet, we can create a telemetry package:

TelemetryPacket tp = new TelemetryPacket();
tp.LoadBytes(bytes);

The TelemetryPacket class contains an array of CarTelemetryData, one for each car in the field.
As an exmaple, the below code will print the throttle pressure that every driver is applying at the moment this data was broadcasted.

foreach (TelemetryPacket.CarTelemetryData ctd in tp.FieldTelemetryData)
{
    Console.WriteLine(ctd.Throttle.ToString());
}

Many of the packets follow a similar format as is seen above with the TelemetryPacket.

Converting all telemetry to packets

You can convert all of the byte array packages that you received. Example:

List<byte[]> telemetry;
Packet[] packets = CodemastersToolkit.BulkConvertByteArraysToPackets(telemetry);

You can then convert each packet from the returned array of packets. For example, converting a Packet to the TelemetryPacket:

foreach (Packet p in packets)
{
    if (p.PacketType == PacketType.CarTelemetry)
    {
        TelemetryPacket telpack = (TelemetryPacket)p;
    }
}

You may need to, for example, find the accompanying CarStatusPacket for a particular TelemetryPacket. To do this:

TelemetryPacket telpack;
CarStatusPacket csp = (CarStatusPacket)telpack.GetRelatedPacket(packets, PacketType.CarStatus);

**If you previously used the Codemasters.F1_2020.Analysis namespace and now find it missing: The analysis namespace has been moved under the ApexVisual.F1_2020 NuGet package (https://www.nuget.org/packages/ApexVisual.F1_2020/)

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Codemasters.F1_2020:

Package Downloads
ApexVisual.F1_2020

Package Description

ApexVisual

.NET class library supporting the Apex Visual application

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.3.3 3,470 8/14/2021
4.3.2 923 8/13/2021
4.3.1 568 8/13/2021
4.3.0 2,777 12/18/2020
4.2.0 651 12/16/2020
4.1.0 3,418 12/4/2020
4.0.0 1,186 11/29/2020
3.0.0 1,997 11/6/2020
2.0.3 759 10/29/2020
2.0.2 717 9/24/2020
2.0.1 886 9/19/2020
2.0.0 723 9/15/2020
1.4.0 740 9/15/2020
1.3.0 703 9/6/2020
1.2.3 745 8/17/2020
1.2.2 2,490 8/15/2020
1.2.1 967 8/12/2020
1.2.0 798 8/12/2020
1.1.0 984 8/3/2020
1.0.0 818 8/2/2020
0.5.0 1,795 7/21/2020
0.4.1 741 7/21/2020
0.4.0 724 7/20/2020
0.3.0 731 7/18/2020
0.2.0 731 7/17/2020
0.1.1 712 7/15/2020
0.1.0 758 7/14/2020