mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-21 21:25:38 +00:00
fixed nmeaconnector reference in pom.xml
This commit is contained in:
@@ -1,28 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.sap.sailing.nmeaconnector</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.sap.sailing.nmeaconnector</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
line.separator=\r\n
|
||||
eclipse.preferences.version=1
|
||||
line.separator=\r\n
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>root</artifactId>
|
||||
<groupId>com.sap.sailing</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.sap.sailing.nmeaconnector</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>root</artifactId>
|
||||
<groupId>com.sap.sailing</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.sap.sailing.nmeaconnector</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
||||
+45
-45
@@ -1,45 +1,45 @@
|
||||
/*
|
||||
* MWVSentence.java
|
||||
* Copyright (C) 2011 Kimmo Tuukkanen
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://sourceforge.net/projects/marineapi/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
import net.sf.marineapi.nmea.sentence.Sentence;
|
||||
|
||||
/**
|
||||
* This sentence is obsolete over most of its former coverage area.
|
||||
* The US/Canadian/Russian Loran-C network was shut down in 2010; it is still as of 2015 in limited use in Europe.
|
||||
* Loran-C operations in Norway will cease from 1st Jan 2016. [NORWAY]
|
||||
* The format of the sentence is:<pre>
|
||||
* 1 2 3 4 5 6
|
||||
* | | | | | |
|
||||
* $--AAM,A,A,x.x,N,c--c*hh<CR><LF>
|
||||
* Field Number:
|
||||
* Status, BOOLEAN, A = Arrival circle entered, V = not passed
|
||||
* Status, BOOLEAN, A = perpendicular passed at waypoint, V = not passed
|
||||
* Arrival circle radius
|
||||
* Units of radius, nautical miles
|
||||
* Waypoint ID
|
||||
* Checksum
|
||||
* Example: GPAAM,A,A,0.10,N,WPTNME*43
|
||||
* WPTNME is the waypoint name.
|
||||
* </pre>
|
||||
*/
|
||||
public interface AAMSentence extends Sentence {
|
||||
}
|
||||
/*
|
||||
* MWVSentence.java
|
||||
* Copyright (C) 2011 Kimmo Tuukkanen
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://sourceforge.net/projects/marineapi/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
import net.sf.marineapi.nmea.sentence.Sentence;
|
||||
|
||||
/**
|
||||
* This sentence is obsolete over most of its former coverage area.
|
||||
* The US/Canadian/Russian Loran-C network was shut down in 2010; it is still as of 2015 in limited use in Europe.
|
||||
* Loran-C operations in Norway will cease from 1st Jan 2016. [NORWAY]
|
||||
* The format of the sentence is:<pre>
|
||||
* 1 2 3 4 5 6
|
||||
* | | | | | |
|
||||
* $--AAM,A,A,x.x,N,c--c*hh<CR><LF>
|
||||
* Field Number:
|
||||
* Status, BOOLEAN, A = Arrival circle entered, V = not passed
|
||||
* Status, BOOLEAN, A = perpendicular passed at waypoint, V = not passed
|
||||
* Arrival circle radius
|
||||
* Units of radius, nautical miles
|
||||
* Waypoint ID
|
||||
* Checksum
|
||||
* Example: GPAAM,A,A,0.10,N,WPTNME*43
|
||||
* WPTNME is the waypoint name.
|
||||
* </pre>
|
||||
*/
|
||||
public interface AAMSentence extends Sentence {
|
||||
}
|
||||
|
||||
+61
-61
@@ -1,61 +1,61 @@
|
||||
/*
|
||||
* MWVSentence.java
|
||||
* Copyright (C) 2011 Kimmo Tuukkanen
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://sourceforge.net/projects/marineapi/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
import net.sf.marineapi.nmea.sentence.Sentence;
|
||||
|
||||
/**
|
||||
* BAT sentence. Used for the proprietary NMEA extension of the SailTimer WindVane's battery indicator message.
|
||||
* The format of the sentence is:<pre>
|
||||
*
|
||||
* $WIBAT,a,b*hh
|
||||
*
|
||||
* 1) Wind Vane Battery (‘0’= Low, ‘1’= Good)
|
||||
* 2) Base Unit battery level (‘0’ = Low, ‘9’ = Good)
|
||||
* 3) Checksum
|
||||
* </pre>
|
||||
*/
|
||||
public interface BATSentence extends Sentence {
|
||||
public static enum WindVaneBatteryStatus {
|
||||
LOW(0), GOOD(1);
|
||||
|
||||
private final int value;
|
||||
|
||||
private WindVaneBatteryStatus(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
WindVaneBatteryStatus getWindVaneBatteryStatus();
|
||||
|
||||
void setWindVaneBatteryStatus(WindVaneBatteryStatus status);
|
||||
|
||||
/**
|
||||
* Battery status is reported as value ranve 0..9 where 0 means "Low" and 9 means "Good."
|
||||
*/
|
||||
int getBaseUnitBatteryLevel();
|
||||
|
||||
void setBaseUnitBatteryLevel(int level);
|
||||
}
|
||||
/*
|
||||
* MWVSentence.java
|
||||
* Copyright (C) 2011 Kimmo Tuukkanen
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://sourceforge.net/projects/marineapi/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
import net.sf.marineapi.nmea.sentence.Sentence;
|
||||
|
||||
/**
|
||||
* BAT sentence. Used for the proprietary NMEA extension of the SailTimer WindVane's battery indicator message.
|
||||
* The format of the sentence is:<pre>
|
||||
*
|
||||
* $WIBAT,a,b*hh
|
||||
*
|
||||
* 1) Wind Vane Battery (‘0’= Low, ‘1’= Good)
|
||||
* 2) Base Unit battery level (‘0’ = Low, ‘9’ = Good)
|
||||
* 3) Checksum
|
||||
* </pre>
|
||||
*/
|
||||
public interface BATSentence extends Sentence {
|
||||
public static enum WindVaneBatteryStatus {
|
||||
LOW(0), GOOD(1);
|
||||
|
||||
private final int value;
|
||||
|
||||
private WindVaneBatteryStatus(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
WindVaneBatteryStatus getWindVaneBatteryStatus();
|
||||
|
||||
void setWindVaneBatteryStatus(WindVaneBatteryStatus status);
|
||||
|
||||
/**
|
||||
* Battery status is reported as value ranve 0..9 where 0 means "Low" and 9 means "Good."
|
||||
*/
|
||||
int getBaseUnitBatteryLevel();
|
||||
|
||||
void setBaseUnitBatteryLevel(int level);
|
||||
}
|
||||
|
||||
+52
-52
@@ -1,52 +1,52 @@
|
||||
/*
|
||||
* MWVSentence.java
|
||||
* Copyright (C) 2011 Kimmo Tuukkanen
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://sourceforge.net/projects/marineapi/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
import net.sf.marineapi.nmea.sentence.Sentence;
|
||||
|
||||
/**
|
||||
* This sentence is obsolete over most of its former coverage area.
|
||||
* The US/Canadian/Russian Loran-C network was shut down in 2010; it is still as of 2015 in limited use in Europe.
|
||||
* Loran-C operations in Norway will cease from 1st Jan 2016. [NORWAY]
|
||||
* The format of the sentence is:<pre>
|
||||
* 12 14
|
||||
* 1 2 3 4 5 6 7 8 9 10 11| 13|
|
||||
* | | | | | | | | | | | | | |
|
||||
* $--GLC,xxxx,x.x,a,x.x,a,x.x,a.x,x,a,x.x,a,x.x,a*hh<CR><LF>
|
||||
* Field Number:
|
||||
* GRI Microseconds/10
|
||||
* Master TOA Microseconds
|
||||
* Master TOA Signal Status
|
||||
* Time Difference 1 Microseconds
|
||||
* Time Difference 1 Signal Status
|
||||
* Time Difference 2 Microseconds
|
||||
* Time Difference 2 Signal Status
|
||||
* Time Difference 3 Microseconds
|
||||
* Time Difference 3 Signal Status
|
||||
* Time Difference 4 Microseconds
|
||||
* Time Difference 4 Signal Status
|
||||
* Time Difference 5 Microseconds
|
||||
* Time Difference 5 Signal Status
|
||||
* Checksum
|
||||
* </pre>
|
||||
*/
|
||||
public interface GLCSentence extends Sentence {
|
||||
}
|
||||
/*
|
||||
* MWVSentence.java
|
||||
* Copyright (C) 2011 Kimmo Tuukkanen
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://sourceforge.net/projects/marineapi/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
import net.sf.marineapi.nmea.sentence.Sentence;
|
||||
|
||||
/**
|
||||
* This sentence is obsolete over most of its former coverage area.
|
||||
* The US/Canadian/Russian Loran-C network was shut down in 2010; it is still as of 2015 in limited use in Europe.
|
||||
* Loran-C operations in Norway will cease from 1st Jan 2016. [NORWAY]
|
||||
* The format of the sentence is:<pre>
|
||||
* 12 14
|
||||
* 1 2 3 4 5 6 7 8 9 10 11| 13|
|
||||
* | | | | | | | | | | | | | |
|
||||
* $--GLC,xxxx,x.x,a,x.x,a,x.x,a.x,x,a,x.x,a,x.x,a*hh<CR><LF>
|
||||
* Field Number:
|
||||
* GRI Microseconds/10
|
||||
* Master TOA Microseconds
|
||||
* Master TOA Signal Status
|
||||
* Time Difference 1 Microseconds
|
||||
* Time Difference 1 Signal Status
|
||||
* Time Difference 2 Microseconds
|
||||
* Time Difference 2 Signal Status
|
||||
* Time Difference 3 Microseconds
|
||||
* Time Difference 3 Signal Status
|
||||
* Time Difference 4 Microseconds
|
||||
* Time Difference 4 Signal Status
|
||||
* Time Difference 5 Microseconds
|
||||
* Time Difference 5 Signal Status
|
||||
* Checksum
|
||||
* </pre>
|
||||
*/
|
||||
public interface GLCSentence extends Sentence {
|
||||
}
|
||||
|
||||
+53
-53
@@ -1,53 +1,53 @@
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
import com.sap.sailing.domain.common.Wind;
|
||||
import com.sap.sailing.domain.tracking.WindListener;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
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. Clients can {@link #addWindListener(WindListener) register}
|
||||
* as a {@link WindListener} and receive {@link WindListener#windDataReceived} callbacks
|
||||
* whenever a {@link Wind} fix was assembled out of the various NMEA sentences.<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 {
|
||||
void addWindListener(WindListener listener);
|
||||
|
||||
void removeWindListener(WindListener listener);
|
||||
}
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
import com.sap.sailing.domain.common.Wind;
|
||||
import com.sap.sailing.domain.tracking.WindListener;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
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. Clients can {@link #addWindListener(WindListener) register}
|
||||
* as a {@link WindListener} and receive {@link WindListener#windDataReceived} callbacks
|
||||
* whenever a {@link Wind} fix was assembled out of the various NMEA sentences.<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 {
|
||||
void addWindListener(WindListener listener);
|
||||
|
||||
void removeWindListener(WindListener listener);
|
||||
}
|
||||
|
||||
+32
-32
@@ -1,32 +1,32 @@
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
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();
|
||||
|
||||
NmeaUtil getUtil();
|
||||
|
||||
/**
|
||||
* Reads from a series of NMEA 0183 sentences and looks for timing information in the form of {@link ZDASentence}s
|
||||
* as well as for weather records ({@link MWVSentence} sentences). If multiple {@code MWV} sentences are found between
|
||||
* two time stamps, linear interpolation is used to assign time points to each wind reading. The information is
|
||||
* furthermore combined with position and motion data. If the wind readings are apparent readings, the speed of
|
||||
* the wind sensor is taken into account to transform into a true reading. NMEA specifies that a "true" reading
|
||||
* 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 inputStream
|
||||
* will be consumed up to its end but will not be closed; the caller remains responsible for closing the
|
||||
* 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(InputStream inputStream) throws InterruptedException;
|
||||
}
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
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();
|
||||
|
||||
NmeaUtil getUtil();
|
||||
|
||||
/**
|
||||
* Reads from a series of NMEA 0183 sentences and looks for timing information in the form of {@link ZDASentence}s
|
||||
* as well as for weather records ({@link MWVSentence} sentences). If multiple {@code MWV} sentences are found between
|
||||
* two time stamps, linear interpolation is used to assign time points to each wind reading. The information is
|
||||
* furthermore combined with position and motion data. If the wind readings are apparent readings, the speed of
|
||||
* the wind sensor is taken into account to transform into a true reading. NMEA specifies that a "true" reading
|
||||
* 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 inputStream
|
||||
* will be consumed up to its end but will not be closed; the caller remains responsible for closing the
|
||||
* 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(InputStream inputStream) throws InterruptedException;
|
||||
}
|
||||
|
||||
+38
-38
@@ -1,38 +1,38 @@
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.Speed;
|
||||
import com.sap.sailing.domain.common.SpeedWithBearing;
|
||||
import com.sap.sailing.domain.common.Wind;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
import net.sf.marineapi.nmea.parser.SentenceFactory;
|
||||
import net.sf.marineapi.nmea.sentence.MWVSentence;
|
||||
import net.sf.marineapi.nmea.util.Units;
|
||||
|
||||
public interface NmeaUtil {
|
||||
Wind getWind(TimePoint timePoint, Position position, MWVSentence mwvSentence);
|
||||
|
||||
Speed getSpeed(double magnitude, Units unit);
|
||||
|
||||
SpeedWithBearing getSpeedWithBearing(double speedMagnitude, Units speedUnit, double bearingInDegrees);
|
||||
|
||||
/**
|
||||
* Replaces all occurrences of <code>sequenceToFind</code> by <code>replaceWith</code>, as {@link String#replace(CharSequence, CharSequence)},
|
||||
* but assuming that <code>nmeaSentence</code> has a trailing NMEA checksum, adjusts the checksum accordingly. This will turn a valid
|
||||
* checksum into a valid checksum again, and an invalid checksum into an invalid checksum.
|
||||
*/
|
||||
String replace(String nmeaSentence, String sequenceToFind, String replaceWith);
|
||||
|
||||
/**
|
||||
* Call this to register proprietary parsers provided by this bundle with the
|
||||
* {@link SentenceFactory} {@link SentenceFactory#getInstance() default instance}.
|
||||
*/
|
||||
void registerAdditionalParsers();
|
||||
|
||||
/**
|
||||
* Call this to unregister proprietary parsers provided by this bundle from the
|
||||
* {@link SentenceFactory} {@link SentenceFactory#getInstance() default instance}.
|
||||
*/
|
||||
void unregisterAdditionalParsers();
|
||||
}
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.Speed;
|
||||
import com.sap.sailing.domain.common.SpeedWithBearing;
|
||||
import com.sap.sailing.domain.common.Wind;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
import net.sf.marineapi.nmea.parser.SentenceFactory;
|
||||
import net.sf.marineapi.nmea.sentence.MWVSentence;
|
||||
import net.sf.marineapi.nmea.util.Units;
|
||||
|
||||
public interface NmeaUtil {
|
||||
Wind getWind(TimePoint timePoint, Position position, MWVSentence mwvSentence);
|
||||
|
||||
Speed getSpeed(double magnitude, Units unit);
|
||||
|
||||
SpeedWithBearing getSpeedWithBearing(double speedMagnitude, Units speedUnit, double bearingInDegrees);
|
||||
|
||||
/**
|
||||
* Replaces all occurrences of <code>sequenceToFind</code> by <code>replaceWith</code>, as {@link String#replace(CharSequence, CharSequence)},
|
||||
* but assuming that <code>nmeaSentence</code> has a trailing NMEA checksum, adjusts the checksum accordingly. This will turn a valid
|
||||
* checksum into a valid checksum again, and an invalid checksum into an invalid checksum.
|
||||
*/
|
||||
String replace(String nmeaSentence, String sequenceToFind, String replaceWith);
|
||||
|
||||
/**
|
||||
* Call this to register proprietary parsers provided by this bundle with the
|
||||
* {@link SentenceFactory} {@link SentenceFactory#getInstance() default instance}.
|
||||
*/
|
||||
void registerAdditionalParsers();
|
||||
|
||||
/**
|
||||
* Call this to unregister proprietary parsers provided by this bundle from the
|
||||
* {@link SentenceFactory} {@link SentenceFactory#getInstance() default instance}.
|
||||
*/
|
||||
void unregisterAdditionalParsers();
|
||||
}
|
||||
|
||||
+7
-7
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
import com.sap.sailing.domain.common.Bearing;
|
||||
import com.sap.sse.common.Timed;
|
||||
|
||||
public interface TimedBearing extends Timed, Bearing {
|
||||
}
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
import com.sap.sailing.domain.common.Bearing;
|
||||
import com.sap.sse.common.Timed;
|
||||
|
||||
public interface TimedBearing extends Timed, Bearing {
|
||||
}
|
||||
|
||||
+8
-8
@@ -1,8 +1,8 @@
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
import com.sap.sailing.domain.common.SpeedWithBearing;
|
||||
import com.sap.sse.common.Timed;
|
||||
|
||||
public interface TimedSpeedWithBearing extends Timed, SpeedWithBearing {
|
||||
|
||||
}
|
||||
package com.sap.sailing.nmeaconnector;
|
||||
|
||||
import com.sap.sailing.domain.common.SpeedWithBearing;
|
||||
import com.sap.sse.common.Timed;
|
||||
|
||||
public interface TimedSpeedWithBearing extends Timed, SpeedWithBearing {
|
||||
|
||||
}
|
||||
|
||||
+62
-62
@@ -1,62 +1,62 @@
|
||||
/*
|
||||
* GSVParser.java
|
||||
* Copyright (C) 2010 Kimmo Tuukkanen
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://ktuukkan.github.io/marine-api/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.sap.sailing.nmeaconnector.impl;
|
||||
|
||||
import com.sap.sailing.nmeaconnector.AAMSentence;
|
||||
|
||||
import net.sf.marineapi.nmea.parser.SentenceParser;
|
||||
import net.sf.marineapi.nmea.sentence.TalkerId;
|
||||
|
||||
/**
|
||||
* GSV sentence parser.
|
||||
*
|
||||
* @author Kimmo Tuukkanen
|
||||
* @author Axel Uhl
|
||||
*/
|
||||
public class AAMParser extends SentenceParser implements AAMSentence {
|
||||
|
||||
// field indices, in case someone plans to use them:
|
||||
// private static final int STATUS_1 = 0;
|
||||
// private static final int STATUS_2 = 1;
|
||||
// private static final int ARRIVAL_CIRCLE_RADIUS = 2;
|
||||
// private static final int UNIT_OF_RADIUS = 3;
|
||||
// private static final int WAYPOINT_ID = 4;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param nmea
|
||||
* GLC Sentence
|
||||
*/
|
||||
public AAMParser(String nmea) {
|
||||
super(nmea, "AAM");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an GSV parser with empty sentence.
|
||||
*
|
||||
* @param talker
|
||||
* TalkerId to set
|
||||
*/
|
||||
public AAMParser(TalkerId talker) {
|
||||
super(talker, "AAM", 5);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* GSVParser.java
|
||||
* Copyright (C) 2010 Kimmo Tuukkanen
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://ktuukkan.github.io/marine-api/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.sap.sailing.nmeaconnector.impl;
|
||||
|
||||
import com.sap.sailing.nmeaconnector.AAMSentence;
|
||||
|
||||
import net.sf.marineapi.nmea.parser.SentenceParser;
|
||||
import net.sf.marineapi.nmea.sentence.TalkerId;
|
||||
|
||||
/**
|
||||
* GSV sentence parser.
|
||||
*
|
||||
* @author Kimmo Tuukkanen
|
||||
* @author Axel Uhl
|
||||
*/
|
||||
public class AAMParser extends SentenceParser implements AAMSentence {
|
||||
|
||||
// field indices, in case someone plans to use them:
|
||||
// private static final int STATUS_1 = 0;
|
||||
// private static final int STATUS_2 = 1;
|
||||
// private static final int ARRIVAL_CIRCLE_RADIUS = 2;
|
||||
// private static final int UNIT_OF_RADIUS = 3;
|
||||
// private static final int WAYPOINT_ID = 4;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param nmea
|
||||
* GLC Sentence
|
||||
*/
|
||||
public AAMParser(String nmea) {
|
||||
super(nmea, "AAM");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an GSV parser with empty sentence.
|
||||
*
|
||||
* @param talker
|
||||
* TalkerId to set
|
||||
*/
|
||||
public AAMParser(TalkerId talker) {
|
||||
super(talker, "AAM", 5);
|
||||
}
|
||||
}
|
||||
|
||||
+27
-27
@@ -1,27 +1,27 @@
|
||||
package com.sap.sailing.nmeaconnector.impl;
|
||||
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
import com.sap.sailing.nmeaconnector.NmeaFactory;
|
||||
|
||||
import net.sf.marineapi.nmea.parser.SentenceFactory;
|
||||
|
||||
/**
|
||||
* Registers and unregisters additional proprietary NMEA sentence parsers with the {@link SentenceFactory}
|
||||
* {@link SentenceFactory#getInstance() default instance}.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class Activator implements BundleActivator {
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
NmeaFactory.INSTANCE.getUtil().registerAdditionalParsers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
NmeaFactory.INSTANCE.getUtil().unregisterAdditionalParsers();
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.nmeaconnector.impl;
|
||||
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
import com.sap.sailing.nmeaconnector.NmeaFactory;
|
||||
|
||||
import net.sf.marineapi.nmea.parser.SentenceFactory;
|
||||
|
||||
/**
|
||||
* Registers and unregisters additional proprietary NMEA sentence parsers with the {@link SentenceFactory}
|
||||
* {@link SentenceFactory#getInstance() default instance}.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class Activator implements BundleActivator {
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
NmeaFactory.INSTANCE.getUtil().registerAdditionalParsers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
NmeaFactory.INSTANCE.getUtil().unregisterAdditionalParsers();
|
||||
}
|
||||
}
|
||||
|
||||
+20
-20
@@ -1,20 +1,20 @@
|
||||
package com.sap.sailing.nmeaconnector.impl;
|
||||
|
||||
import com.sap.sailing.domain.common.impl.DegreeBearingImpl;
|
||||
import com.sap.sailing.nmeaconnector.TimedBearing;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class DegreeBearingWithTimepoint extends DegreeBearingImpl implements TimedBearing {
|
||||
private static final long serialVersionUID = 8704478920647067862L;
|
||||
private final TimePoint timePoint;
|
||||
|
||||
public DegreeBearingWithTimepoint(TimePoint timePoint, double bearingDeg) {
|
||||
super(bearingDeg);
|
||||
this.timePoint = timePoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimePoint getTimePoint() {
|
||||
return timePoint;
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.nmeaconnector.impl;
|
||||
|
||||
import com.sap.sailing.domain.common.impl.DegreeBearingImpl;
|
||||
import com.sap.sailing.nmeaconnector.TimedBearing;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class DegreeBearingWithTimepoint extends DegreeBearingImpl implements TimedBearing {
|
||||
private static final long serialVersionUID = 8704478920647067862L;
|
||||
private final TimePoint timePoint;
|
||||
|
||||
public DegreeBearingWithTimepoint(TimePoint timePoint, double bearingDeg) {
|
||||
super(bearingDeg);
|
||||
this.timePoint = timePoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimePoint getTimePoint() {
|
||||
return timePoint;
|
||||
}
|
||||
}
|
||||
|
||||
+70
-70
@@ -1,70 +1,70 @@
|
||||
/*
|
||||
* GSVParser.java
|
||||
* Copyright (C) 2010 Kimmo Tuukkanen
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://ktuukkan.github.io/marine-api/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.sap.sailing.nmeaconnector.impl;
|
||||
|
||||
import com.sap.sailing.nmeaconnector.GLCSentence;
|
||||
|
||||
import net.sf.marineapi.nmea.parser.SentenceParser;
|
||||
import net.sf.marineapi.nmea.sentence.TalkerId;
|
||||
|
||||
/**
|
||||
* GSV sentence parser.
|
||||
*
|
||||
* @author Kimmo Tuukkanen
|
||||
* @author Axel Uhl
|
||||
*/
|
||||
public class GLCParser extends SentenceParser implements GLCSentence {
|
||||
|
||||
// field indices, in case someone plans to use them:
|
||||
// private static final int GRI_MICROSECONDS_BY_10 = 0;
|
||||
// private static final int MASTER_TOA_MICROSECONDS = 1;
|
||||
// private static final int MASTER_TOA_SIGNAL_STATUS = 2;
|
||||
// private static final int TIME_DIFF_1_MICROSECONDS = 3;
|
||||
// private static final int TIME_DIFF_1_SIGNAL_STATUS = 4;
|
||||
// private static final int TIME_DIFF_2_MICROSECONDS = 5;
|
||||
// private static final int TIME_DIFF_2_SIGNAL_STATUS = 6;
|
||||
// private static final int TIME_DIFF_3_MICROSECONDS = 7;
|
||||
// private static final int TIME_DIFF_3_SIGNAL_STATUS = 8;
|
||||
// private static final int TIME_DIFF_4_MICROSECONDS = 9;
|
||||
// private static final int TIME_DIFF_4_SIGNAL_STATUS = 10;
|
||||
// private static final int TIME_DIFF_5_MICROSECONDS = 11;
|
||||
// private static final int TIME_DIFF_5_SIGNAL_STATUS = 12;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param nmea
|
||||
* GLC Sentence
|
||||
*/
|
||||
public GLCParser(String nmea) {
|
||||
super(nmea, "GLC");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an GSV parser with empty sentence.
|
||||
*
|
||||
* @param talker
|
||||
* TalkerId to set
|
||||
*/
|
||||
public GLCParser(TalkerId talker) {
|
||||
super(talker, "GLC", 19);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* GSVParser.java
|
||||
* Copyright (C) 2010 Kimmo Tuukkanen
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://ktuukkan.github.io/marine-api/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.sap.sailing.nmeaconnector.impl;
|
||||
|
||||
import com.sap.sailing.nmeaconnector.GLCSentence;
|
||||
|
||||
import net.sf.marineapi.nmea.parser.SentenceParser;
|
||||
import net.sf.marineapi.nmea.sentence.TalkerId;
|
||||
|
||||
/**
|
||||
* GSV sentence parser.
|
||||
*
|
||||
* @author Kimmo Tuukkanen
|
||||
* @author Axel Uhl
|
||||
*/
|
||||
public class GLCParser extends SentenceParser implements GLCSentence {
|
||||
|
||||
// field indices, in case someone plans to use them:
|
||||
// private static final int GRI_MICROSECONDS_BY_10 = 0;
|
||||
// private static final int MASTER_TOA_MICROSECONDS = 1;
|
||||
// private static final int MASTER_TOA_SIGNAL_STATUS = 2;
|
||||
// private static final int TIME_DIFF_1_MICROSECONDS = 3;
|
||||
// private static final int TIME_DIFF_1_SIGNAL_STATUS = 4;
|
||||
// private static final int TIME_DIFF_2_MICROSECONDS = 5;
|
||||
// private static final int TIME_DIFF_2_SIGNAL_STATUS = 6;
|
||||
// private static final int TIME_DIFF_3_MICROSECONDS = 7;
|
||||
// private static final int TIME_DIFF_3_SIGNAL_STATUS = 8;
|
||||
// private static final int TIME_DIFF_4_MICROSECONDS = 9;
|
||||
// private static final int TIME_DIFF_4_SIGNAL_STATUS = 10;
|
||||
// private static final int TIME_DIFF_5_MICROSECONDS = 11;
|
||||
// private static final int TIME_DIFF_5_SIGNAL_STATUS = 12;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param nmea
|
||||
* GLC Sentence
|
||||
*/
|
||||
public GLCParser(String nmea) {
|
||||
super(nmea, "GLC");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an GSV parser with empty sentence.
|
||||
*
|
||||
* @param talker
|
||||
* TalkerId to set
|
||||
*/
|
||||
public GLCParser(TalkerId talker) {
|
||||
super(talker, "GLC", 19);
|
||||
}
|
||||
}
|
||||
|
||||
+52
-52
@@ -1,52 +1,52 @@
|
||||
package com.sap.sailing.nmeaconnector.impl;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import com.sap.sailing.domain.common.Wind;
|
||||
import com.sap.sailing.domain.tracking.WindListener;
|
||||
import com.sap.sailing.nmeaconnector.NMEAWindReceiver;
|
||||
import com.sap.sailing.nmeaconnector.NmeaFactory;
|
||||
import com.sap.sailing.nmeaconnector.NmeaUtil;
|
||||
|
||||
import net.sf.marineapi.nmea.event.AbstractSentenceListener;
|
||||
import net.sf.marineapi.nmea.io.SentenceReader;
|
||||
import net.sf.marineapi.nmea.sentence.Sentence;
|
||||
|
||||
public class NmeaFactoryImpl implements NmeaFactory {
|
||||
|
||||
@Override
|
||||
public NmeaUtil getUtil() {
|
||||
return new NmeaUtilImpl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Wind> readWind(InputStream inputStream) throws InterruptedException {
|
||||
final CountDownLatch finishedLatch = new CountDownLatch(1);
|
||||
final List<Wind> result = new ArrayList<>();
|
||||
final SentenceReader sentenceReader = new SentenceReader(inputStream);
|
||||
sentenceReader.addSentenceListener(new AbstractSentenceListener<Sentence>() {
|
||||
@Override
|
||||
public void readingStopped() {
|
||||
finishedLatch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sentenceRead(Sentence sentence) {}
|
||||
});
|
||||
final NMEAWindReceiver receiver = new NMEAWindReceiverImpl(sentenceReader);
|
||||
receiver.addWindListener(new WindListener() {
|
||||
@Override
|
||||
public void windDataReceived(Wind wind) {
|
||||
result.add(wind);
|
||||
}
|
||||
@Override public void windDataRemoved(Wind wind) {}
|
||||
@Override public void windAveragingChanged(long oldMillisecondsOverWhichToAverage, long newMillisecondsOverWhichToAverage) {}
|
||||
});
|
||||
sentenceReader.start();
|
||||
finishedLatch.await();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.nmeaconnector.impl;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import com.sap.sailing.domain.common.Wind;
|
||||
import com.sap.sailing.domain.tracking.WindListener;
|
||||
import com.sap.sailing.nmeaconnector.NMEAWindReceiver;
|
||||
import com.sap.sailing.nmeaconnector.NmeaFactory;
|
||||
import com.sap.sailing.nmeaconnector.NmeaUtil;
|
||||
|
||||
import net.sf.marineapi.nmea.event.AbstractSentenceListener;
|
||||
import net.sf.marineapi.nmea.io.SentenceReader;
|
||||
import net.sf.marineapi.nmea.sentence.Sentence;
|
||||
|
||||
public class NmeaFactoryImpl implements NmeaFactory {
|
||||
|
||||
@Override
|
||||
public NmeaUtil getUtil() {
|
||||
return new NmeaUtilImpl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Wind> readWind(InputStream inputStream) throws InterruptedException {
|
||||
final CountDownLatch finishedLatch = new CountDownLatch(1);
|
||||
final List<Wind> result = new ArrayList<>();
|
||||
final SentenceReader sentenceReader = new SentenceReader(inputStream);
|
||||
sentenceReader.addSentenceListener(new AbstractSentenceListener<Sentence>() {
|
||||
@Override
|
||||
public void readingStopped() {
|
||||
finishedLatch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sentenceRead(Sentence sentence) {}
|
||||
});
|
||||
final NMEAWindReceiver receiver = new NMEAWindReceiverImpl(sentenceReader);
|
||||
receiver.addWindListener(new WindListener() {
|
||||
@Override
|
||||
public void windDataReceived(Wind wind) {
|
||||
result.add(wind);
|
||||
}
|
||||
@Override public void windDataRemoved(Wind wind) {}
|
||||
@Override public void windAveragingChanged(long oldMillisecondsOverWhichToAverage, long newMillisecondsOverWhichToAverage) {}
|
||||
});
|
||||
sentenceReader.start();
|
||||
finishedLatch.await();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user