mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-21 21:25:38 +00:00
started an NMEA wind receiver implementation by adding some Javadoc
Change-Id: I81ad85ef64bf34cfb38772f69e9a535bee3c6bec
This commit is contained in:
Executable
+45
@@ -0,0 +1,45 @@
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
import net.sf.marineapi.nmea.event.SentenceListener;
|
||||
import net.sf.marineapi.nmea.io.SentenceReader;
|
||||
import net.sf.marineapi.nmea.sentence.DateSentence;
|
||||
import net.sf.marineapi.nmea.sentence.MWVSentence;
|
||||
import net.sf.marineapi.nmea.sentence.SentenceId;
|
||||
import net.sf.marineapi.nmea.sentence.TimeSentence;
|
||||
|
||||
/**
|
||||
* A stateful receiver that consumes sentences from an NMEA {@link SentenceReader}
|
||||
* for which it acts as a {@link SentenceListener} for sentences providing information
|
||||
* about wind measurements, date/time reference, location of measurements and data
|
||||
* that may be required to convert apparent wind speeds and angles into true wind
|
||||
* speeds and directions.<p>
|
||||
*
|
||||
* The NMEA 0183 protocol specifies that a {@link SentenceId#MWV} sentence may provide
|
||||
* "true" (relative to true north) or "relative" (relative to bow) wind angles. However,
|
||||
* it is not entirely clear in all cases if those angles have the magnetic declination
|
||||
* already corrected. Only with {@link SentenceId#MWD} sentences does this become clear,
|
||||
* and a value for the magnetic declination could be inferred. For now, we will assume
|
||||
* that {@link SentenceId#MWV} values really provide angles based on true north if
|
||||
* {@link MWVSentence#isTrue()} is {@code true}.<p>
|
||||
*
|
||||
* This receiver assumes that the sentences do not necessarily have to be entirely
|
||||
* time-synchronous. But different sentence types can provide "hints" as to the timing.
|
||||
* GPS fixes (@link SentenceId#GGA} and other position fixes {@link SentenceId#GLL} have
|
||||
* time of day but no date information. Other messages such as {@link SentenceId#RMC} and
|
||||
* {@link SentenceId#ZDA} contain date and optionally time zone information. When analyzing
|
||||
* the entire sequence, under certain assumptions such as fixes with time information being
|
||||
* less than 24h apart from each other and with at least one {@link DateSentence} per day
|
||||
* it is possible to combine {@link TimeSentence}s with the last date information into
|
||||
* a full {@link TimePoint}.<p>
|
||||
*
|
||||
* In order to also work in streaming mode and to provide {@link Wind} fixes as soon as
|
||||
* all data relevant for a wind fix has been received, this receiver won't wait for the
|
||||
* next timing information to interpolate, but instead the last timing data received
|
||||
* before the wind measurement will be used for the {@link Wind} fix.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public interface NMEAWindReceiver {
|
||||
|
||||
}
|
||||
+7
-4
@@ -1,10 +1,13 @@
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.io.InputStream;
|
||||
|
||||
import com.sap.sailing.domain.common.Wind;
|
||||
import com.sap.sailing.nmeaconnector.impl.NmeaFactoryImpl;
|
||||
|
||||
import net.sf.marineapi.nmea.sentence.MWVSentence;
|
||||
import net.sf.marineapi.nmea.sentence.ZDASentence;
|
||||
|
||||
public interface NmeaFactory {
|
||||
static NmeaFactory INSTANCE = new NmeaFactoryImpl();
|
||||
|
||||
@@ -19,11 +22,11 @@ public interface NmeaFactory {
|
||||
* is relative to "true north" which we can only believe; it means that the instrument needs to have an understanding
|
||||
* of the magnetic declination at the time and position of the measurement.
|
||||
*
|
||||
* @param reader
|
||||
* @param inputStream
|
||||
* will be consumed up to its end but will not be closed; the caller remains responsible for closing the
|
||||
* reader.
|
||||
* input stream.
|
||||
* @return a sequence of {@link Wind} objects as extracted from the NMEA 0183 sentences found in the contents of the
|
||||
* {@code reader}; never {@code null}, but possibly empty
|
||||
*/
|
||||
Iterable<Wind> readWind(Reader reader);
|
||||
Iterable<Wind> readWind(InputStream inputStream);
|
||||
}
|
||||
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
package com.sap.sailing.nmeaconnector.impl;
|
||||
|
||||
import com.sap.sailing.nmeaconnector.NMEAWindReceiver;
|
||||
|
||||
public class NMEAWindReceiverImpl implements NMEAWindReceiver {
|
||||
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.sap.sailing.nmeaconnector.impl;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.io.InputStream;
|
||||
|
||||
import com.sap.sailing.domain.common.Wind;
|
||||
import com.sap.sailing.nmeaconnector.NmeaFactory;
|
||||
@@ -14,7 +14,7 @@ public class NmeaFactoryImpl implements NmeaFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Wind> readWind(Reader reader) {
|
||||
public Iterable<Wind> readWind(InputStream inputStream) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user