net.sf.marineapi.nmea.sentence
Interface Sentence

All Known Subinterfaces:
BODSentence, DateSentence, DBTSentence, DepthSentence, DPTSentence, GGASentence, GLLSentence, GSASentence, GSVSentence, PositionSentence, RMBSentence, RMCSentence, RTESentence, TimeSentence, WPLSentence, VTGSentence, ZDASentence
All Known Implementing Classes:
SentenceParser

public interface Sentence

Base interface and constants for NMEA 0183 sentences.

Version:
$Revision: 100 $
Author:
Kimmo Tuukkanen

Field Summary
static int ADDRESS_FIELD
          Address field index, the first field of all 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>)
 
Method Summary
 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 isProprietary()
          Tells if the sentence is of proprietary format.
 boolean isValid()
          Tells if the sentence formatting matches NMEA 0183 format.
 void setTalkerId(TalkerId id)
          Set the talker ID of the sentence.
 String toSentence()
          Formats and validates the String representation of sentence without the line terminator CR/LF.
 String toString()
          Returns the String representation of sentence in NMEA 0183 format.
 

Field Detail

ADDRESS_FIELD

static final int ADDRESS_FIELD
Address field index, the first field of all sentences.

See Also:
Constant Field Values

BEGIN_CHAR

static final char BEGIN_CHAR
Sentence begin character

See Also:
Constant Field Values

CHECKSUM_DELIMITER

static final char CHECKSUM_DELIMITER
Checksum field delimiter char

See Also:
Constant Field Values

FIELD_DELIMITER

static final char FIELD_DELIMITER
Sentence data fields delimiter char

See Also:
Constant Field Values

MAX_LENGTH

static final int MAX_LENGTH
Maximum length of NMEA 0183 sentences, including BEGIN_CHAR and TERMINATOR.

See Also:
Constant Field Values

TERMINATOR

static final String TERMINATOR
Sentence terminator (<CR><LF>)

See Also:
Constant Field Values
Method Detail

getFieldCount

int getFieldCount()
Returns the current number of data fields in sentence, excluding ID field and checksum.

Returns:
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.

Returns:
Sentence id String, e.g. "GLL" or "GGA".
See Also:
SentenceId

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.

Returns:
Talker id enum.

isProprietary

boolean isProprietary()
Tells if the sentence is of proprietary format.

Returns:
True if proprietary, otherwise false.

isValid

boolean isValid()
Tells if the sentence formatting matches NMEA 0183 format.

Returns:
True if validly formatted, otherwise false.

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.

Parameters:
id - TalkerId to set

toSentence

String toSentence()
Formats and validates the String representation of sentence without the line terminator CR/LF. If formatting results in invalid sentence, e.g. 82 character limit exceeds due too long values set in fields, an exception is thrown.

Returns:
A valid NMEA sentence String
Throws:
IllegalStateException - If formatting results in invalid sentence.
See Also:
toString()

toString

String toString()
Returns the String representation of sentence in NMEA 0183 format.

Overrides:
toString in class Object
Returns:
Sentence String


Copyright (C) 2010-2011 Java Marine API author(s). All Rights Reserved.