/** * CTRK Parser - Main parsing logic. * * Implements the complete CTRK file parsing algorithm with: * - Binary record parsing (14-byte headers + typed payloads) * - Timestamp computation (GetTimeDataEx) * - CAN message decoding for 21 telemetry channels * - GPS NMEA sentence parsing * - 10 Hz emission timing with GPS gating * - Lap detection via finish line crossing */ import type { TelemetryRecord } from './types.js'; /** * Parser for Yamaha Y-Trac CTRK telemetry files. * * This class implements a complete CTRK file parser based on reverse engineering * of the native library (libSensorsRecordIF.so). It handles: * * - Binary file structure parsing (header, data section, footer) * - Timestamp computation with incremental optimization * - CAN message decoding for all 21 telemetry channels * - GPS NMEA sentence parsing with checksum validation * - 10 Hz emission timing with GPS gating * - Lap detection via finish line crossing */ export declare class CTRKParser { private data; private records; private finishLine; /** * Initialize the parser with file data. * * @param data - Complete CTRK file data as Uint8Array */ constructor(data: Uint8Array); /** * Parse the CTRK file and extract telemetry records. * * Validates the header, extracts finish line coordinates, and processes * all data records to produce 10 Hz telemetry output. * * @returns Array of TelemetryRecord objects, one per 100ms emission interval * @throws Error if the file does not have valid CTRK header magic */ parse(): TelemetryRecord[]; /** * Get parsed telemetry records. * * @returns Array of parsed records (empty before parse() is called) */ getRecords(): TelemetryRecord[]; /** * Parse the data section using continuous state processing. * * Iterates through all records in the data section, updating CAN state * and emitting telemetry records at 100ms intervals. State is carried * forward continuously across laps. */ private parseDataSection; /** * Check if the motorcycle crossed the finish line. * * Compares current position against previous position to detect * finish line crossing. On crossing, increments lap counter and * resets fuel accumulator. * * @param lat - Current latitude in decimal degrees * @param lon - Current longitude in decimal degrees * @param currentLap - Current lap number * @param fuelAcc - Mutable fuel accumulator object * @param canState - CAN state object to reset fuel value * @param prevLat - Previous latitude * @param prevLng - Previous longitude * @returns Object with updated lap, prevLat, prevLng */ private checkLapCrossing; /** * Create a TelemetryRecord from current accumulated CAN state. * * Snapshots the current state into a new TelemetryRecord * object with the provided GPS data and timestamp. * * @param timeMs - Unix timestamp in milliseconds * @param gpsState - GPS state object * @param canState - CAN state object * @param lap - Current lap number * @returns New TelemetryRecord with all current channel values */ private createRecord; } //# sourceMappingURL=ctrk-parser.d.ts.map