public interface Sentence
| Modifier and Type | Field and Description |
|---|---|
static char |
ALTERNATIVE_BEGIN_CHAR
Alternative sentence begin character used in VDO and VDM sentences.
|
static char |
BEGIN_CHAR
Sentence begin character
|
static char |
CHECKSUM_DELIMITER
Checksum field delimiter char
|
static char |
FIELD_DELIMITER
Sentence data fields delimiter char
|
static int |
MAX_LENGTH
Maximum length of NMEA 0183 sentences, including
BEGIN_CHAR
and TERMINATOR. |
static String |
TERMINATOR
Sentence terminator
<CR><LF>. |
| Modifier and Type | Method and Description |
|---|---|
char |
getBeginChar()
Get the sentence begin character.
|
int |
getFieldCount()
Returns the current number of data fields in sentence, excluding ID field
and checksum.
|
String |
getSentenceId()
Get the sentence ID that specifies the sentence type and data it holds.
|
TalkerId |
getTalkerId()
Gets the talker ID of the sentence.
|
boolean |
isAISSentence()
Tells if this is an AIS sentence.
|
boolean |
isProprietary()
Tells if the sentence is of proprietary format.
|
boolean |
isValid()
Tells if the sentence formatting matches NMEA 0183 format.
|
void |
reset()
Resets the sentence contents, i.e. removes all existing values from data
fields.
|
void |
setBeginChar(char ch)
Set the sentence begin character.
|
void |
setTalkerId(TalkerId id)
Set the talker ID of the sentence.
|
String |
toSentence()
Formats and validates the String representation of sentence.
|
String |
toSentence(int maxLength)
Formats and validates the sentence like
toSentence(), but checks
also that resulting String does not exceed specified length. |
String |
toString()
Returns the String representation of the sentence, without line
terminator
CR/LR. |
static final char ALTERNATIVE_BEGIN_CHAR
static final char BEGIN_CHAR
static final char CHECKSUM_DELIMITER
static final char FIELD_DELIMITER
static final int MAX_LENGTH
BEGIN_CHAR
and TERMINATOR.static final String TERMINATOR
<CR><LF>.char getBeginChar()
int getFieldCount()
String getSentenceId()
$GPGGA the method returns SentenceId.GGA.SentenceIdTalkerId getTalkerId()
$ in sentence address field. For example, in case of
$GPGGA, the method returns TalkerId.GP.boolean isAISSentence()
boolean isProprietary()
boolean isValid()
void reset()
void setBeginChar(char ch)
ch - Sentence begin char to set ('$' or '!')BEGIN_CHAR,
ALTERNATIVE_BEGIN_CHARvoid setTalkerId(TalkerId id)
id - TalkerId to setString toSentence()
SentenceValidator, notice
that resulting sentence length is not checked. To also validate the
length, use toSentence(int).toString().IllegalStateException - If formatting results in invalid sentence.toString()String toSentence(int maxLength)
toSentence(), but checks
also that resulting String does not exceed specified length.toString().IllegalStateException - If formatting results in invalid sentence
or specified maximum length is exceeded.toSentence(),
MAX_LENGTHString toString()
CR/LR. Checksum is calculated and appended at the
end of the sentence, but no validation is done. Use toSentence()
to also validate the result.Copyright (C) 2010-2017 Java Marine API authors. All Rights Reserved.