@rflafla/motec-ld-reader
Version:
A Node.js library for reading MoTeC .ld telemetry files
45 lines (44 loc) • 1.5 kB
TypeScript
import { BinaryReader } from './utils.js';
export type DataType = 'int16' | 'int32' | 'float16' | 'float32' | 'gps' | 'timestamp' | null;
/**
* Channel (meta) data
*
* Parses and stores the channel meta data of a channel in an ld file.
* The actual data is read on demand using the 'data' property.
*/
export declare class LdChan {
private reader;
private _data;
metaPtr: number;
prevMetaPtr: number;
nextMetaPtr: number;
dataPtr: number;
dataLen: number;
dtype: DataType;
freq: number;
shift: number;
mul: number;
scale: number;
dec: number;
name: string;
shortName: string;
unit: string;
constructor(reader: BinaryReader, metaPtr: number, prevMetaPtr: number, nextMetaPtr: number, dataPtr: number, dataLen: number, dtype: DataType, freq: number, shift: number, mul: number, scale: number, dec: number, name: string, shortName: string, unit: string);
/**
* Parses and stores the header information of an ld channel in an ld file
*/
static fromFile(reader: BinaryReader, metaPtr: number): LdChan;
/**
* Read the data words of the channel (lazy loading)
*/
get data(): number[] | bigint[];
toString(): string;
}
/**
* Read channel data inside ld file
*
* Cycles through the channels inside an ld file,
* starting with the one where metaPtr points to.
* Returns a list of LdChan objects.
*/
export declare function readChannels(reader: BinaryReader, metaPtr: number): LdChan[];