Search in sources :

Example 1 with MWVSentence

use of net.sf.marineapi.nmea.sentence.MWVSentence in project marine-api by ktuukkan.

the class OutputExample method main.

public static void main(String[] args) {
    // Create a fresh MWV parser
    SentenceFactory sf = SentenceFactory.getInstance();
    MWVSentence mwv = (MWVSentence) sf.createParser(TalkerId.II, "MWV");
    // should output "$IIMWV,,,,,V*36" 
    System.out.println(mwv.toSentence());
    // Be sure to set all needed values correctly. For instance, in this
    // example setAngle() and setTrue() have mutual dependency. Likewise,
    // pay attention to set units correctly.
    mwv.setAngle(43.7);
    mwv.setTrue(true);
    mwv.setSpeed(4.54);
    mwv.setSpeedUnit(Units.METER);
    mwv.setStatus(DataStatus.ACTIVE);
    // should output "$IIMWV,043.7,T,4.5,M,A*39"
    System.out.println(mwv.toSentence());
}
Also used : MWVSentence(net.sf.marineapi.nmea.sentence.MWVSentence) SentenceFactory(net.sf.marineapi.nmea.parser.SentenceFactory)

Aggregations

SentenceFactory (net.sf.marineapi.nmea.parser.SentenceFactory)1 MWVSentence (net.sf.marineapi.nmea.sentence.MWVSentence)1