Search in sources :

Example 6 with SentenceEvent

use of net.sf.marineapi.nmea.event.SentenceEvent in project marine-api by ktuukkan.

the class HeadingProviderTest method testHDTSentenceRead.

/**
	 * Test method for
	 * {@link net.sf.marineapi.provider.AbstractProvider#sentenceRead(net.sf.marineapi.nmea.event.SentenceEvent)}
	 * .
	 */
@Test
public void testHDTSentenceRead() {
    Sentence s = factory.createParser(HDTTest.EXAMPLE);
    assertNull(event);
    instance.sentenceRead(new SentenceEvent(this, s));
    assertNotNull(event);
    assertEquals(90.1, event.getHeading(), 0.1);
    assertTrue(event.isTrue());
}
Also used : SentenceEvent(net.sf.marineapi.nmea.event.SentenceEvent) Sentence(net.sf.marineapi.nmea.sentence.Sentence) HDMTest(net.sf.marineapi.nmea.parser.HDMTest) Test(org.junit.Test) HDTTest(net.sf.marineapi.nmea.parser.HDTTest) HDGTest(net.sf.marineapi.nmea.parser.HDGTest)

Example 7 with SentenceEvent

use of net.sf.marineapi.nmea.event.SentenceEvent in project marine-api by ktuukkan.

the class PositionProviderTest method testSentenceReadWithGGA.

/**
	 * Test method for
	 * {@link net.sf.marineapi.provider.AbstractProvider#sentenceRead(net.sf.marineapi.nmea.event.SentenceEvent)}
	 * .
	 */
@Test
public void testSentenceReadWithGGA() {
    SentenceFactory sf = SentenceFactory.getInstance();
    Sentence gga = sf.createParser(GGATest.EXAMPLE);
    assertNull(event);
    instance.sentenceRead(new SentenceEvent(this, gga));
    assertNull(event);
    Sentence rmc = sf.createParser(RMCTest.EXAMPLE);
    assertNull(event);
    instance.sentenceRead(new SentenceEvent(this, rmc));
    assertNotNull(event);
}
Also used : SentenceEvent(net.sf.marineapi.nmea.event.SentenceEvent) SentenceFactory(net.sf.marineapi.nmea.parser.SentenceFactory) Sentence(net.sf.marineapi.nmea.sentence.Sentence) GGATest(net.sf.marineapi.nmea.parser.GGATest) GLLTest(net.sf.marineapi.nmea.parser.GLLTest) Test(org.junit.Test) RMCTest(net.sf.marineapi.nmea.parser.RMCTest)

Aggregations

SentenceEvent (net.sf.marineapi.nmea.event.SentenceEvent)7 Sentence (net.sf.marineapi.nmea.sentence.Sentence)6 Test (org.junit.Test)6 GGATest (net.sf.marineapi.nmea.parser.GGATest)3 GLLTest (net.sf.marineapi.nmea.parser.GLLTest)3 HDGTest (net.sf.marineapi.nmea.parser.HDGTest)3 HDMTest (net.sf.marineapi.nmea.parser.HDMTest)3 HDTTest (net.sf.marineapi.nmea.parser.HDTTest)3 RMCTest (net.sf.marineapi.nmea.parser.RMCTest)3 SentenceFactory (net.sf.marineapi.nmea.parser.SentenceFactory)3 HashSet (java.util.HashSet)1 SentenceListener (net.sf.marineapi.nmea.event.SentenceListener)1