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

28 lines (27 loc) 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PacketParticipantsDataParser = void 0; const F1Parser_1 = require("../F1Parser"); const PacketHeaderParser_1 = require("./PacketHeaderParser"); const ParticipantDataParser_1 = require("./ParticipantDataParser"); class PacketParticipantsDataParser extends F1Parser_1.F1Parser { constructor(buffer, packetFormat, bigintEnabled) { super(); this.endianess('little').nest('m_header', { type: new PacketHeaderParser_1.PacketHeaderParser(packetFormat, bigintEnabled), }); if (packetFormat === 2018) { this.uint8('m_numCars'); } if (packetFormat >= 2019) { this.uint8('m_numActiveCars'); } const length = packetFormat >= 2020 ? 22 : 20; this.array('m_participants', { length, type: new ParticipantDataParser_1.ParticipantDataParser(packetFormat), }); this.data = this.fromBuffer(buffer); } } exports.PacketParticipantsDataParser = PacketParticipantsDataParser;