接口 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 char
    Alternative sentence begin character used in VDO and VDM sentences.
    static final char
    Sentence begin character
    static final char
    Checksum field delimiter char
    static final char
    Sentence data fields delimiter char
    static final int
    Maximum length of NMEA 0183 sentences, including BEGIN_CHAR and TERMINATOR.
    static final String
    Sentence terminator <CR><LF>.
  • 方法概要

    修饰符和类型
    方法
    说明
    char
    Get the sentence begin character.
    int
    Returns 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.
    boolean
    Tells if this is an AIS sentence.
    boolean
    Tells if the sentence is of proprietary format.
    boolean
    Tells if the sentence formatting matches NMEA 0183 format.
    void
    Resets the sentence contents, i.e. removes all existing values from data fields.
    void
    setBeginChar(char ch)
    Set the sentence begin character.
    void
    Set the talker ID of the sentence.
    Formats and validates the String representation of sentence.
    toSentence(int maxLength)
    Formats and validates the sentence like toSentence(), but checks also that resulting String does not exceed specified length.
    Returns the String representation of the sentence, without line terminator CR/LR.
  • 字段详细资料

    • ALTERNATIVE_BEGIN_CHAR

      static final char ALTERNATIVE_BEGIN_CHAR
      Alternative sentence begin character used in VDO and VDM sentences.
      另请参阅:
    • BEGIN_CHAR

      static final char BEGIN_CHAR
      Sentence begin character
      另请参阅:
    • CHECKSUM_DELIMITER

      static final char CHECKSUM_DELIMITER
      Checksum field delimiter char
      另请参阅:
    • FIELD_DELIMITER

      static final char FIELD_DELIMITER
      Sentence data fields delimiter char
      另请参阅:
    • MAX_LENGTH

      static final int MAX_LENGTH
      Maximum length of NMEA 0183 sentences, including BEGIN_CHAR and TERMINATOR.
      另请参阅:
    • TERMINATOR

      static final String 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 $GPGGA the method returns SentenceId.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 returns TalkerId.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

      void setTalkerId(TalkerId id)
      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 by SentenceValidator, notice that resulting sentence length is not checked. To also validate the length, use toSentence(int).
      返回:
      Sentence as String, equal to toString().
      抛出:
      IllegalStateException - If formatting results in invalid sentence.
      另请参阅:
    • toSentence

      String toSentence(int maxLength)
      Formats and validates the sentence like toSentence(), 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 terminator 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.
      覆盖:
      toString 在类中 Object
      返回:
      String representation of sentence