// Path: src/main/java/org/firmata4j/Parser.java
// public interface Parser {
// 
//     /**
//      * Starts processing of input data.
//      */
//     void start();
// 
//     /**
//      * Stops processing of input data.
//      */
//     void stop();
// 
//     /**
//      * Processes the input data.
//      *
//      * @param bytes the data
//      */
//     void parse(byte[] bytes);
// 
// }


import org.firmata4j.Parser;
import jssc.SerialPort;
import jssc.SerialPortEvent;
import jssc.SerialPortEventListener;
import jssc.SerialPortException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
                port.setEventsMask(SerialPort.MASK_RXCHAR);
                port.addEventListener(this);
            } catch (SerialPortException ex) {
                throw new IOException("Cannot start firmata device", ex);
            }
        }
    }

    @Override
    public void stop() throws IOException {
        try {
            if (port.isOpened()) {
                port.purgePort(SerialPort.PURGE_RXCLEAR | SerialPort.PURGE_TXCLEAR);
                port.closePort();
            }
        } catch (SerialPortException ex) {
            throw new IOException("Cannot properly stop firmata device", ex);
        }
    }

    @Override
    public void write(byte[] bytes) throws IOException {
        try {
            port.writeBytes(bytes);
        } catch (SerialPortException ex) {
            throw new IOException("Cannot send message to device", ex);
        }
    }

    @Override
// Path: src/main/java/org/firmata4j/Parser.java
// public interface Parser {
// 
//     /**
//      * Starts processing of input data.
//      */
//     void start();
// 
//     /**
//      * Stops processing of input data.
//      */
//     void stop();
// 
//     /**
//      * Processes the input data.
//      *
//      * @param bytes the data
//      */
//     void parse(byte[] bytes);
// 
// }


// Path: src/main/java/org/firmata4j/transport/SerialTransport.java
import org.firmata4j.Parser;
import jssc.SerialPort;
import jssc.SerialPortEvent;
import jssc.SerialPortEventListener;
import jssc.SerialPortException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;

                port.setEventsMask(SerialPort.MASK_RXCHAR);
                port.addEventListener(this);
            } catch (SerialPortException ex) {
                throw new IOException("Cannot start firmata device", ex);
            }
        }
    }

    @Override
    public void stop() throws IOException {
        try {
            if (port.isOpened()) {
                port.purgePort(SerialPort.PURGE_RXCLEAR | SerialPort.PURGE_TXCLEAR);
                port.closePort();
            }
        } catch (SerialPortException ex) {
            throw new IOException("Cannot properly stop firmata device", ex);
        }
    }

    @Override
    public void write(byte[] bytes) throws IOException {
        try {
            port.writeBytes(bytes);
        } catch (SerialPortException ex) {
            throw new IOException("Cannot send message to device", ex);
        }
    }

    @Override
    public void setParser(Parser parser) {