Search in sources :

Example 6 with SatelliteInfo

use of net.sf.marineapi.nmea.util.SatelliteInfo in project marine-api by ktuukkan.

the class SatelliteInfoProviderExample method providerUpdate.

/*
	 * (non-Javadoc)
	 * @see
	 * net.sf.marineapi.provider.event.SatelliteInfoListener#providerUpdate(net.sf.marineapi
	 * .provider.event.SatelliteInfoEvent)
	 */
public void providerUpdate(SatelliteInfoEvent event) {
    System.out.println("-- GSV report --");
    for (SatelliteInfo si : event.getSatelliteInfo()) {
        String ptrn = "%s: %d, %d";
        String msg = String.format(ptrn, si.getId(), si.getAzimuth(), si.getElevation());
        System.out.println(msg);
    }
    System.out.println("-----");
}
Also used : SatelliteInfo(net.sf.marineapi.nmea.util.SatelliteInfo)

Example 7 with SatelliteInfo

use of net.sf.marineapi.nmea.util.SatelliteInfo in project marine-api by ktuukkan.

the class GSVTest method testSetSatelliteInfo.

/**
	 * Test method for
	 * {@link net.sf.marineapi.nmea.parser.GSVParser#getSatelliteInfo()}.
	 */
@Test
public void testSetSatelliteInfo() {
    List<SatelliteInfo> si = new ArrayList<SatelliteInfo>();
    si.add(new SatelliteInfo("01", 11, 12, 13));
    si.add(new SatelliteInfo("02", 21, 22, 23));
    si.add(new SatelliteInfo("03", 31, 32, 33));
    gsv.setSatelliteInfo(si);
    assertTrue(gsv.toString().contains(",03,31,032,33,,,,*"));
    List<SatelliteInfo> sat = gsv.getSatelliteInfo();
    assertEquals(3, sat.size());
    testSatelliteInfo(sat.get(0), "01", 11, 12, 13);
    testSatelliteInfo(sat.get(1), "02", 21, 22, 23);
    testSatelliteInfo(sat.get(2), "03", 31, 32, 33);
}
Also used : ArrayList(java.util.ArrayList) SatelliteInfo(net.sf.marineapi.nmea.util.SatelliteInfo) Test(org.junit.Test)

Aggregations

SatelliteInfo (net.sf.marineapi.nmea.util.SatelliteInfo)7 ArrayList (java.util.ArrayList)3 GSVSentence (net.sf.marineapi.nmea.sentence.GSVSentence)3 Test (org.junit.Test)3 GSASentence (net.sf.marineapi.nmea.sentence.GSASentence)1 Sentence (net.sf.marineapi.nmea.sentence.Sentence)1 SatelliteInfoEvent (net.sf.marineapi.provider.event.SatelliteInfoEvent)1