接口 Sentence
- 所有已知子接口:
AISSentence,APBSentence,BODSentence,CURSentence,DateSentence,DBTSentence,DepthSentence,DPTSentence,DTASentence,DTBSentence,DTMSentence,GBSSentence,GGASentence,GLLSentence,GNSSentence,GSASentence,GSTSentence,GSVSentence,HDGSentence,HDMSentence,HDTSentence,HeadingSentence,HTCSentence,HTDSentence,MDASentence,MHUSentence,MMBSentence,MTASentence,MTWSentence,MWDSentence,MWVSentence,PositionSentence,RMBSentence,RMCSentence,ROTSentence,RPMSentence,RSASentence,RTESentence,STALKSentence,TimeSentence,TLBSentence,TLLSentence,TTMSentence,TXTSentence,UBXSentence,VBWSentence,VDRSentence,VHWSentence,VLWSentence,VTGSentence,VWRSentence,VWTSentence,WPLSentence,XDRSentence,XTESentence,ZDASentence
- 所有已知实现类:
PositionParser,SentenceParser,UBXMessageParser
public interface Sentence
Base interface and constants for NMEA 0183 sentences.
- 作者:
- Kimmo Tuukkanen
-
字段概要
字段修饰符和类型字段说明static final charAlternative sentence begin character used in VDO and VDM sentences.static final charSentence begin characterstatic final charChecksum field delimiter charstatic final charSentence data fields delimiter charstatic final intMaximum length of NMEA 0183 sentences, includingBEGIN_CHARandTERMINATOR.static final StringSentence terminator<CR><LF>. -
方法概要
修饰符和类型方法说明charGet the sentence begin character.intReturns the current number of data fields in sentence, excluding ID field and checksum.Get the sentence ID that specifies the sentence type and data it holds.Gets the talker ID of the sentence.booleanTells if this is an AIS sentence.booleanTells if the sentence is of proprietary format.booleanisValid()Tells if the sentence formatting matches NMEA 0183 format.voidreset()Resets the sentence contents, i.e. removes all existing values from data fields.voidsetBeginChar(char ch) Set the sentence begin character.voidsetTalkerId(TalkerId id) Set the talker ID of the sentence.Formats and validates the String representation of sentence.toSentence(int maxLength) Formats and validates the sentence liketoSentence(), but checks also that resulting String does not exceed specified length.toString()Returns the String representation of the sentence, without line terminatorCR/LR.
-
字段详细资料
-
ALTERNATIVE_BEGIN_CHAR
static final char ALTERNATIVE_BEGIN_CHARAlternative sentence begin character used in VDO and VDM sentences.- 另请参阅:
-
BEGIN_CHAR
static final char BEGIN_CHARSentence begin character- 另请参阅:
-
CHECKSUM_DELIMITER
static final char CHECKSUM_DELIMITERChecksum field delimiter char- 另请参阅:
-
FIELD_DELIMITER
static final char FIELD_DELIMITERSentence data fields delimiter char- 另请参阅:
-
MAX_LENGTH
static final int MAX_LENGTHMaximum length of NMEA 0183 sentences, includingBEGIN_CHARandTERMINATOR.- 另请参阅:
-
TERMINATOR
Sentence terminator<CR><LF>.- 另请参阅:
-
-
方法详细资料
-
getBeginChar
char getBeginChar()Get the sentence begin character. Although most of the sentences start with '$', some of them use '!' as begin character.- 返回:
- Sentence begin char, e.g. "$" or "!".
-
getFieldCount
int getFieldCount()Returns the current number of data fields in sentence, excluding ID field and checksum.- 返回:
- Data field count
-
getSentenceId
String getSentenceId()Get the sentence ID that specifies the sentence type and data it holds. ID is the last three characters in address field. For example, in case of$GPGGAthe method returnsSentenceId.GGA.- 返回:
- Sentence id String, e.g. "GLL" or "GGA".
- 另请参阅:
-
getTalkerId
TalkerId getTalkerId()Gets the talker ID of the sentence. Talker ID is the next two characters after$in sentence address field. For example, in case of$GPGGA, the method returnsTalkerId.GP.- 返回:
- Talker id enum.
-
isAISSentence
boolean isAISSentence()Tells if this is an AIS sentence.- 返回:
- True if AIS sentence, otherwise false.
-
isProprietary
boolean isProprietary()Tells if the sentence is of proprietary format.- 返回:
- True if proprietary, otherwise false.
-
isValid
boolean isValid()Tells if the sentence formatting matches NMEA 0183 format.- 返回:
- True if validly formatted, otherwise false.
-
reset
void reset()Resets the sentence contents, i.e. removes all existing values from data fields. After resetting, address field remains as is and checksum is calculated according to empty data fields. -
setBeginChar
void setBeginChar(char ch) Set the sentence begin character. Although most of the sentences start with '$', some of them use '!' as begin character.- 参数:
ch- Sentence begin char to set ('$' or '!')- 另请参阅:
-
setTalkerId
Set the talker ID of the sentence. Typically, the ID might be changed if the sentence is to be sent from a computer to an NMEA device.- 参数:
id- TalkerId to set
-
toSentence
String toSentence()Formats and validates the String representation of sentence. Throws an exception if result is not considered a valid sentence. As validation is done bySentenceValidator, notice that resulting sentence length is not checked. To also validate the length, usetoSentence(int).- 返回:
- Sentence as String, equal to
toString(). - 抛出:
IllegalStateException- If formatting results in invalid sentence.- 另请参阅:
-
toSentence
Formats and validates the sentence liketoSentence(), but checks also that resulting String does not exceed specified length.- 参数:
maxLength- Maximum String length- 返回:
- Sentence as String, equal to
toString(). - 抛出:
IllegalStateException- If formatting results in invalid sentence or specified maximum length is exceeded.- 另请参阅:
-
toString
String toString()Returns the String representation of the sentence, without line terminatorCR/LR. Checksum is calculated and appended at the end of the sentence, but no validation is done. UsetoSentence()to also validate the result.
-