UNPKG

@canboat/canboatjs

Version:

Native javascript version of canboat

66 lines 2.71 kB
/** * Copyright 2018 Scott Bender (scott@scottbender.net) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Definition, Field, PGN } from '@canboat/ts-pgns'; import { EventEmitter } from 'events'; export type FromPgnCallback = (msg: any, pgn: any | undefined) => void; export type PostProcessor = (field: Field, value: any) => any; export type ByteMapping = { bytes: number[]; value?: number | string | null; bits?: string; }; export type RepeatingByteMapping = { [key: string]: ByteMapping; }; export type ByteMap = { [key: string]: ByteMapping | RepeatingByteMapping[]; }; export declare class Parser extends EventEmitter { options: any; name: string; version: string; author: string; license: string; format: number; devices: { [key: number]: { [key: number]: any; }; }; mixedFormat: boolean; constructor(opts?: any); private getPGNDefinitionList; private readPacket; private readRepeatingFields; private readFields; private readPGN; private _parse; setField(res: any, field: Field, value: any): void; getField(res: any, field: Field): any; findNonMatchPgn(pgnList: Definition[]): Definition | undefined; findMatchPgn(pgnList: Definition[]): Definition | undefined; parse(data: any, cb?: FromPgnCallback | undefined): PGN | undefined; parsePgnData(pgn: PGN, length: number, data: string[] | Buffer, coalesced: boolean, cb: FromPgnCallback | undefined, sourceString: string): PGN | undefined; isN2KOver0183(sentence: string): boolean; parseN2KOver0183(sentence: string, cb: FromPgnCallback): PGN | undefined; parseYDGW02(pgn_data: any, cb: FromPgnCallback): PGN | undefined; parseActisenceN2KAscii(pgn_data: any, cb: FromPgnCallback): PGN | undefined; parsePDGY(pgn_data: any, cb: FromPgnCallback): PGN | undefined; parseString(pgn_data: string, cb?: FromPgnCallback | undefined): PGN | undefined; parseBuffer(pgn_data: any, cb: FromPgnCallback | undefined): PGN | undefined; } export declare function getField(pgn_number: number, index: number, data: any): Field | null | undefined; //# sourceMappingURL=fromPgn.d.ts.map