UNPKG

extended-nmea

Version:

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

38 lines (37 loc) 1.71 kB
import { RawNmeaSentence } from "./RawNmeaSentence"; import { ChecksumSentence } from "./ChecksumSentence"; import { ITalkerSentence } from "../interfaces"; export declare class TalkerSentence extends ChecksumSentence implements ITalkerSentence { /** * The number of characters in the given string which belong to the talker. This value is 2 by the NMEA0183 * standard. */ private readonly talkerIdLength; /** * Create a NMEA0183 "talker sentence" from a string and an optional talker id length. * * @param data The data to interpret as an NMEA0183 talker sentence. Can also be an existing Sentence. * @param talkerIdLength The length of the talker id in 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, talkerIdLength?: number, prefix?: string, suffix?: string); /** * By default, returns the first two characters in the first field as per NMEA0183 standard. Can return more than * two characters if specified otherwise in the constructor. */ get talkerId(): string; /** * Returns all characters between the talker id and the end of the first field, excluding all characters from the * talker id. */ get sentenceId(): string; /** * The first field in the sentence (usually includes a talker id/sentence id). */ protected get idField(): string; /** * Returns all data fields of the sentence. I.e. all fields separated by comma, excluding the first one. */ protected get dataFields(): string[]; }