Search in sources :

Example 1 with SentenceReader

use of net.sf.marineapi.nmea.io.SentenceReader in project marine-api by ktuukkan.

the class HeadingProviderTest method setUp.

/**
	 * @throws java.lang.Exception
	 */
@Before
public void setUp() throws Exception {
    factory = SentenceFactory.getInstance();
    File file = new File("target/test-classes/data/sample1.txt");
    FileInputStream str = new FileInputStream(file);
    SentenceReader r = new SentenceReader(str);
    instance = new HeadingProvider(r);
    instance.addListener(this);
    event = null;
}
Also used : SentenceReader(net.sf.marineapi.nmea.io.SentenceReader) File(java.io.File) FileInputStream(java.io.FileInputStream) Before(org.junit.Before)

Example 2 with SentenceReader

use of net.sf.marineapi.nmea.io.SentenceReader in project marine-api by ktuukkan.

the class PositionProviderTest method setUp.

/**
	 * @throws java.lang.Exception
	 */
@Before
public void setUp() throws Exception {
    File f = new File("target/test-classes/data/Navibe-GM720.txt");
    FileInputStream str = new FileInputStream(f);
    SentenceReader r = new SentenceReader(str);
    instance = new PositionProvider(r);
    instance.addListener(this);
}
Also used : SentenceReader(net.sf.marineapi.nmea.io.SentenceReader) File(java.io.File) FileInputStream(java.io.FileInputStream) Before(org.junit.Before)

Example 3 with SentenceReader

use of net.sf.marineapi.nmea.io.SentenceReader in project marine-api by ktuukkan.

the class SerialPortExample method init.

/**
	 * Init serial port and reader.
	 */
private void init() {
    try {
        SerialPort sp = getSerialPort();
        if (sp != null) {
            InputStream is = sp.getInputStream();
            SentenceReader sr = new SentenceReader(is);
            sr.addSentenceListener(this);
            sr.start();
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : SentenceReader(net.sf.marineapi.nmea.io.SentenceReader) SerialPort(gnu.io.SerialPort) InputStream(java.io.InputStream) IOException(java.io.IOException)

Aggregations

SentenceReader (net.sf.marineapi.nmea.io.SentenceReader)3 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 Before (org.junit.Before)2 SerialPort (gnu.io.SerialPort)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1