|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.fhg.igd.gps.NMEA183Sentence
This class represents a generic NMEA183 sentence.
| Field Summary | |
protected byte |
checksum_
The checksum of this sentence. |
protected List |
fields_
|
protected String |
sentenceId_
|
protected String |
sentenceId_desc_
|
protected String |
talkerId_
|
protected String |
talkerId_desc_
|
| Constructor Summary | |
NMEA183Sentence()
Constructs a new NMEA183Sentence. |
|
NMEA183Sentence(String talkerId)
Constructs a new NMEA183Sentence with the specified
talkerId. |
|
NMEA183Sentence(String talkerId,
String sentenceId)
Constructs a new NMEA183Sentence with the specified
talkerId and sentenceId. |
|
| Method Summary | |
protected String |
bodyToString()
Returns the body part of this sentence's string representation. |
protected byte |
computeChecksum()
Computes the checksum that is valid for this NMEA183Sentence. |
protected Date |
getDateField(int index)
Returns the element of fields_ at the specified index,
transformed into a Date object. |
protected double |
getFloatField(int index)
Returns the element of fields_ at the specified index,
transformed into a double value. |
protected int |
getIntegerField(int index)
Returns the element of fields_ at the specified index,
transformed into an int value. |
protected Latitude |
getLatitudeField(int index)
Returns the element of fields_ at the specified index,
transformed into a Latitude object. |
protected Longitude |
getLongitudeField(int index)
Returns the element of fields_ at the specified index,
transformed into a Longitude object. |
String |
getSentenceId()
Returns the sentence id of this NMEA183Sentence. |
protected String |
getStringField(int index)
Returns the element of fields_ at the specified index as
a String object. |
boolean |
hasChecksum()
Tests whether a checksum has been specified for this NMEA183Sentence or not. |
protected String |
headerToString()
Returns the header part of this sentence's string representation, which consists of: the talker id the sentence id the checksum |
private String |
lookupTalkerId(String id)
Returns the description of the specified talker id. |
void |
parse(NMEA183Tokenizer tokenizer)
Reads and parses a NMEA183 sentence from tokenizer. |
protected byte[] |
rebuildSentence()
Builds a nmea sentence string based on fields_. |
String |
toString()
Returns the string representation of this NMEA183Sentence. |
boolean |
valid()
Tests whether the specified checksum is valid for this NMEA183Sentence or not. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected String sentenceId_desc_
protected String talkerId_desc_
protected String sentenceId_
protected String talkerId_
protected List fields_
protected byte checksum_
| Constructor Detail |
public NMEA183Sentence()
NMEA183Sentence.
public NMEA183Sentence(String talkerId)
NMEA183Sentence with the specified
talkerId.
talkerId - the talker id of this NMEA183Sentence
public NMEA183Sentence(String talkerId,
String sentenceId)
NMEA183Sentence with the specified
talkerId and sentenceId.
talkerId - the talker id of this NMEA183SentencesentenceId - the sentence id of this NMEA183Sentence| Method Detail |
public boolean hasChecksum()
NMEA183Sentence or not.
true if a checksum has been specified; otherwise
falsepublic boolean valid()
NMEA183Sentence or not.
true if checksum is valid for this sentence or
if checksum has not been specified, false if checksum
is invalid for this NMEA183Sentence.
public void parse(NMEA183Tokenizer tokenizer)
throws NMEA183SentenceFormatException
tokenizer.
tokenizer - the NMEA183Tokenizer to read from
NMEA183SentenceFormatException - if the read sentence does not have
the appropriate formatpublic String getSentenceId()
NMEA183Sentence.
NMEA183Sentence.public String toString()
NMEA183Sentence.
NMEA183Sentence.private String lookupTalkerId(String id)
id
is not known the String "unknown" is returned.
id - the talker id to query
protected Date getDateField(int index)
throws IndexOutOfBoundsException
fields_ at the specified index,
transformed into a Date object. The index
argument is expected to be more than 0 and less than
fields_.size().
index - the index of the element to get
IndexOutOfBoundsException - if index is less than 0 or
more than fields_.size()
protected double getFloatField(int index)
throws IndexOutOfBoundsException,
NumberFormatException
fields_ at the specified index,
transformed into a double value. The index
argument is expected to be more than 0 and less than
fields_.size().
index - the index of the element to get
IndexOutOfBoundsException - if index is less than 0 or
more than fields_.size()
NumberFormatException - if the element at the given index does not
have the appropriate format
protected int getIntegerField(int index)
throws IndexOutOfBoundsException,
NumberFormatException
fields_ at the specified index,
transformed into an int value. The index
argument is expected to be more than 0 and less than
fields_.size().
index - the index of the element to get
IndexOutOfBoundsException - if index is less than 0 or
more than fields_.size()
NumberFormatException - if the element at the given index does not
have the appropriate format
protected Latitude getLatitudeField(int index)
throws IndexOutOfBoundsException,
AngularDistanceFormatException
fields_ at the specified index,
transformed into a Latitude object. The index
argument is expected to be more than 0 and less than
fields_.size() - 1.
Note: This method actually reads 2 elements, at index and index+1
index - the starting index of the elements to get
IndexOutOfBoundsException - if index is less than 0 or
more than fields_.size() - 1
AngularDistanceFormatException - if the element at the given index does not
have the appropriate format
protected Longitude getLongitudeField(int index)
throws IndexOutOfBoundsException,
AngularDistanceFormatException
fields_ at the specified index,
transformed into a Longitude object. The index
argument is expected to be more than 0 and less than
fields_.size() - 1.
Note: This method actually reads 2 elements, at index and index+1
index - the starting index of the elements to get
IndexOutOfBoundsException - if index is less than 0 or
more than fields_.size() - 1
AngularDistanceFormatException - if the element at the given index does not
have the appropriate format
protected String getStringField(int index)
throws IndexOutOfBoundsException
fields_ at the specified index as
a String object. The index argument is expected
to be more than 0 and less than fields_.size().
index - the index of the element to get
IndexOutOfBoundsException - if index is less than 0 or
more than fields_.size()protected String bodyToString()
toString()protected String headerToString()
toString()protected byte[] rebuildSentence()
fields_.
protected byte computeChecksum()
NMEA183Sentence.
The calculation is based on the rebuild sentence returned by the
rebuildSentence method.
NMEA183Sentence
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||