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

35 lines (34 loc) 1.43 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PacketTimeTrialDataParser = void 0; const F1Parser_1 = require("../F1Parser"); const PacketHeaderParser_1 = require("./PacketHeaderParser"); class TimeTrialDataSetParser extends F1Parser_1.F1Parser { constructor() { super(); this.uint8('m_carIdx') .uint8('m_teamId') .uint32('m_lapTimeInMS') .uint32('m_sector1TimeInMS') .uint32('m_sector2TimeInMS') .uint32('m_sector3TimeInMS') .uint8('m_tractionControl') .uint8('m_gearboxAssist') .uint8('m_antiLockBrakes') .uint8('m_equalCarPerformance') .uint8('m_customSetup') .uint8('m_valid'); } } class PacketTimeTrialDataParser extends F1Parser_1.F1Parser { constructor(buffer, packetFormat, bigintEnabled) { super(); this.endianess('little') .nest('m_header', { type: new PacketHeaderParser_1.PacketHeaderParser(packetFormat, bigintEnabled) }) .nest('m_playerSessionBestDataSet', { type: new TimeTrialDataSetParser() }) .nest('m_personalBestDataSet', { type: new TimeTrialDataSetParser() }) .nest('m_rivalDataSet', { type: new TimeTrialDataSetParser() }); this.data = this.fromBuffer(buffer); } } exports.PacketTimeTrialDataParser = PacketTimeTrialDataParser;