|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.marineapi.provider.AbstractProvider<T>
public abstract class AbstractProvider<T extends ProviderEvent>
Abstract base class for providers. Defines methods that all providers must implement and provides general services for capturing and validating the required sentences.
When constructing PositionEvent,
the maximum age for all captured sentences is 1000 ms, i.e. all sentences are
from within the default NMEA update rate (1/s).
| Constructor Summary | |
|---|---|
AbstractProvider(SentenceReader reader,
SentenceId... ids)
Creates a new instance of AbstractProvider. |
|
AbstractProvider(SentenceReader reader,
String... ids)
Creates a new instance of AbstractProvider. |
|
| Method Summary | |
|---|---|
void |
addListener(ProviderListener<T> listener)
Inserts a listener to provider. |
protected abstract T |
createProviderEvent()
Creates a ProviderEvent of type T. |
protected List<Sentence> |
getSentences()
Returns the collected sentences. |
protected boolean |
hasAll(String... id)
Tells if the provider has captured all the specified sentences. |
protected boolean |
hasOne(String... id)
Tells if the provider has captured at least one of the specified sentences. |
protected abstract boolean |
isReady()
Tells if provider has captured the required sentences for creating new ProviderEvent. |
protected abstract boolean |
isValid()
Tells if the captured sentence events contain valid data to be dispatched to ProviderListeners. |
void |
readingPaused()
Called after SentenceReader has timed
out for receiving new data. |
void |
readingStarted()
Called before SentenceReader starts
dispatching events. |
void |
readingStopped()
Called after SentenceReader has
permanently stopped reading, either due to an error or by calling the
SentenceReader.stop() method. |
void |
removeListener(ProviderListener<T> listener)
Removes the specified listener from provider. |
void |
sentenceRead(SentenceEvent event)
Called by SentenceReader when a single
NMEA 0183 sentence has been read and parsed from the data stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractProvider(SentenceReader reader,
String... ids)
reader - Sentence reader to be used as data sourceids - Types of sentences to capture for creating provider events
public AbstractProvider(SentenceReader reader,
SentenceId... ids)
reader - Sentence reader to be used as data sourceids - Types of sentences to capture for creating provider events| Method Detail |
|---|
public void addListener(ProviderListener<T> listener)
listener - Listener to addprotected abstract T createProviderEvent()
ProviderEvent of type T.
protected final List<Sentence> getSentences()
protected final boolean hasAll(String... id)
id - Sentence type IDs to look for.
protected final boolean hasOne(String... id)
id - Sentence type IDs to look for, in prioritized order.
protected abstract boolean isReady()
protected abstract boolean isValid()
public void readingPaused()
SentenceListenerCalled after SentenceReader has timed
out for receiving new data. Indicates that the reader is still active and
waiting for new data which isn't currently available for some reason. For
example, the device may have stopped broadcasting or the end of a file
has been reached.
Default time for timeout is defined by
SentenceReader.DEFAULT_TIMEOUT. This
value can be overridden with
SentenceReader.setPauseTimeout(int).
readingPaused in interface SentenceListenerpublic void readingStarted()
SentenceListenerSentenceReader starts
dispatching events. Indicates that the reader is active and receiving
data. Also, this notification occurs when the dispatching continues
again after SentenceListener.readingPaused() has occurred.
readingStarted in interface SentenceListenerpublic void readingStopped()
SentenceListenerSentenceReader has
permanently stopped reading, either due to an error or by calling the
SentenceReader.stop() method.
readingStopped in interface SentenceListenerpublic void removeListener(ProviderListener<T> listener)
listener - Listener to removepublic void sentenceRead(SentenceEvent event)
SentenceListenerSentenceReader when a single
NMEA 0183 sentence has been read and parsed from the data stream. By
default, only supported sentences defined in
SentenceId are dispatched.
sentenceRead in interface SentenceListenerevent - SentenceEvent containing the data.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||