UNPKG

@z0mt3c/f1-telemetry-client

Version:

[![Node.js CI](https://github.com/z0mt3c/f1-telemetry-client/actions/workflows/node.js.yml/badge.svg)](https://github.com/z0mt3c/f1-telemetry-client/actions/workflows/node.js.yml) [![NPM Release](https://img.shields.io/npm/v/@z0mt3c/f1-telemetry-client.sv

63 lines (62 loc) 2.47 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CarStatusDataParser = void 0; const binary_parser_1 = require("binary-parser"); const F1Parser_1 = require("../F1Parser"); class CarStatusDataParser extends F1Parser_1.F1Parser { constructor(packetFormat) { super(); this.uint8('m_tractionControl').uint8('m_antiLockBrakes').uint8('m_fuelMix').uint8('m_frontBrakeBias').uint8('m_pitLimiterStatus').floatle('m_fuelInTank').floatle('m_fuelCapacity'); if (packetFormat >= 2019) { this.floatle('m_fuelRemainingLaps'); } this.uint16le('m_maxRPM').uint16le('m_idleRPM').uint8('m_maxGears').uint8('m_drsAllowed'); if (packetFormat >= 2020) { this.uint16le('m_drsActivationDistance'); } if (packetFormat >= 2018 && packetFormat <= 2020) { this.array('m_tyresWear', { length: 4, type: new binary_parser_1.Parser().uint8(''), }); } if (packetFormat >= 2019) { this.uint8('m_actualTyreCompound').uint8('m_visualTyreCompound'); } else { this.uint8('m_tyreCompound'); } if (packetFormat >= 2020) { this.uint8('m_tyresAgeLaps'); } if (packetFormat < 2021) { this.array('m_tyresDamage', { length: 4, type: new binary_parser_1.Parser().uint8(''), }) .uint8('m_frontLeftWingDamage') .uint8('m_frontRightWingDamage') .uint8('m_rearWingDamage'); } if (packetFormat === 2020) { this.uint8('m_drsFault'); } if (packetFormat >= 2018 && packetFormat <= 2020) { this.uint8('m_engineDamage').uint8('m_gearBoxDamage'); } if (packetFormat >= 2019) { this.uint8('m_vehicleFiaFlags'); } else { this.uint8('m_exhaustDamage').int8('m_vehicleFiaFlags'); } if (packetFormat >= 2023) { this.floatle('m_enginePowerICE').floatle('m_enginePowerMGUK'); } this.floatle('m_ersStoreEnergy').uint8('m_ersDeployMode').floatle('m_ersHarvestedThisLapMGUK').floatle('m_ersHarvestedThisLapMGUH').floatle('m_ersDeployedThisLap'); if (packetFormat >= 2021) { this.int8('m_networkPaused'); } } } exports.CarStatusDataParser = CarStatusDataParser;