UNPKG

extended-nmea

Version:

A TypeScript library for parsing NMEA0183-like sentences with support for custom and proprietary sentences.

57 lines (56 loc) 2.05 kB
import { INmeaSentence } from "../interfaces"; import { RawNmeaSentence } from "./RawNmeaSentence"; import { SentenceType } from "../SentenceType"; export declare class NmeaSentence implements INmeaSentence { /** * Each NMEA0183 sentence starts with a "$" sign. */ static readonly Prefix: string; /** * Each NMEA0183 sentence ends with <CR><LF>. */ static readonly Suffix: string; /** * The raw line given to the constructor. Can be changed. */ raw: string; /** * The type of this sentence. */ readonly type: SentenceType; /** * The prefix to use when validating the sentence. */ protected readonly prefix: string; /** * The suffix to use when validating the sentence. */ protected readonly suffix: string; /** * Create a NMEA0183 sentence from a string. * * @param data The line to interpret as an NMEA0183 sentence. Can also be an existing Sentence. * @param type The type of this sentence. * @param prefix The prefix to use when validating the sentence. * @param suffix The suffix to use when validating the sentence. */ constructor(data: RawNmeaSentence, type: SentenceType, prefix?: string, suffix?: string); /** * Whether or not this sentence is a valid NMEA0183 sentence. * * All data is transmitted in the form of sentences. Only printable ASCII characters are allowed, plus CR (carriage * return) and LF (line feed). Each sentence starts with a "$" sign and ends with <CR><LF>. * * This does _not_ validate the checksum, regardless of if one is contained in the sentence. */ get valid(): boolean; get invalidReason(): null | string; /** * Returns all characters between "$" and "<CR><LF>". */ protected get dataNoFixtures(): string; /** * Returns all fields (including the first field in the sentence) separated by comma. */ get fields(): string[]; }