protected void doInit() throws Exception { serialPort.setSerialPortParams( config().getOption(BAUD_RATE), config().getOption(DATA_BITS).value(), config().getOption(STOP_BITS).value(), config().getOption(PARITY_BIT).value() ); serialPort.setDTR(config().getOption(DTR)); serialPort.setRTS(config().getOption(RTS)); activate(serialPort.getInputStream(), serialPort.getOutputStream()); }
protected void doInit() throws Exception { serialPort.setSerialPortParams( config().getOption(BAUD_RATE), config().getOption(DATA_BITS).value(), config().getOption(STOP_BITS).value(), config().getOption(PARITY_BIT).value() ); serialPort.setDTR(config().getOption(DTR)); serialPort.setRTS(config().getOption(RTS)); activate(serialPort.getInputStream(), serialPort.getOutputStream()); }
OutputStream out = sport.getOutputStream();
@Override public OutputStream getOutputStream() throws IOException { return port.getOutputStream(); }
@Override public boolean isOpened() { boolean isOpened = false; try { LOGGER.debug("Check if port is opened: {}", port); isOpened = (port != null && port.getOutputStream() != null); } catch (IOException ex) { LOGGER.warn("OutputStream is not available.", ex); } return isOpened; }
if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); out1=out; //add this line, where out1 is a global variable// (new Thread(new SerialReader(in))).start(); (new Thread(new SerialWriter(out))).start(); }
public static BGAPITransport connectBLED112(String portName) { SerialPort port = connectSerial(portName); try { return new BGAPITransport(port.getInputStream(), port.getOutputStream()); } catch (IOException ex) { Logger.getLogger(BLED112.class.getName()).log(Level.SEVERE, null, ex); } return null; }
public static BGAPITransport connectBLED112(String portName) { SerialPort port = connectSerial(portName); try { return new BGAPITransport(port.getInputStream(), port.getOutputStream()); } catch (IOException ex) { Logger.getLogger(BLED112.class.getName()).log(Level.SEVERE, null, ex); } return null; }
public static BGAPITransport connectBLED112() { SerialPort port = connectSerial(); try { return new BGAPITransport(port.getInputStream(), port.getOutputStream()); } catch (IOException ex) { Logger.getLogger(BLED112.class.getName()).log(Level.SEVERE, null, ex); } return null; }
// Each of these could be object members so all your class methods have access OutputStream outputStream; InputStream inputStream; SerialPort serialPort; // Open the port one time, then init your settings serialPort = (SerialPort)portId.open("SimpleWriteApp", 2000); serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); // Get the input/output streams for use in the application outputStream = serialPort.getOutputStream(); inputStream = serialPort.getInputStream(); // Finally, add your event listener serialPort.addEventListener(this);
SerialPort serialPort; InputStream inStream; OutputStream outStream; serialPort = (SerialPort) portId.open(...); serialPort.setFlowControlMode(...); serialPort.setSerialPortParams(...); inStream = serialPort.getInputStream (); outStream = serialPort.getOutputStream ();
protected void doInit() throws Exception { serialPort.setSerialPortParams( config().getOption(BAUD_RATE), config().getOption(DATA_BITS).value(), config().getOption(STOP_BITS).value(), config().getOption(PARITY_BIT).value() ); serialPort.setDTR(config().getOption(DTR)); serialPort.setRTS(config().getOption(RTS)); activate(serialPort.getInputStream(), serialPort.getOutputStream()); }
protected void doInit() throws Exception { serialPort.setSerialPortParams( config().getOption(BAUD_RATE), config().getOption(DATA_BITS).value(), config().getOption(STOP_BITS).value(), config().getOption(PARITY_BIT).value() ); serialPort.setDTR(config().getOption(DTR)); serialPort.setRTS(config().getOption(RTS)); activate(serialPort.getInputStream(), serialPort.getOutputStream()); }
protected void doInit() throws Exception { serialPort.setSerialPortParams( config().getOption(BAUD_RATE), config().getOption(DATA_BITS).value(), config().getOption(STOP_BITS).value(), config().getOption(PARITY_BIT).value() ); serialPort.setDTR(config().getOption(DTR)); serialPort.setRTS(config().getOption(RTS)); activate(serialPort.getInputStream(), serialPort.getOutputStream()); }
protected void doInit() throws Exception { serialPort.setSerialPortParams( config().getOption(BAUD_RATE), config().getOption(DATA_BITS).value(), config().getOption(STOP_BITS).value(), config().getOption(PARITY_BIT).value() ); serialPort.setDTR(config().getOption(DTR)); serialPort.setRTS(config().getOption(RTS)); activate(serialPort.getInputStream(), serialPort.getOutputStream()); }
protected void doInit() throws Exception { serialPort.setSerialPortParams( config().getOption(BAUD_RATE), config().getOption(DATA_BITS).value(), config().getOption(STOP_BITS).value(), config().getOption(PARITY_BIT).value() ); serialPort.setDTR(config().getOption(DTR)); serialPort.setRTS(config().getOption(RTS)); activate(serialPort.getInputStream(), serialPort.getOutputStream()); }
protected void doInit() throws Exception { serialPort.setSerialPortParams( config().getOption(BAUD_RATE), config().getOption(DATA_BITS).value(), config().getOption(STOP_BITS).value(), config().getOption(PARITY_BIT).value() ); serialPort.setDTR(config().getOption(DTR)); serialPort.setRTS(config().getOption(RTS)); activate(serialPort.getInputStream(), serialPort.getOutputStream()); }
protected void doInit() throws Exception { serialPort.setSerialPortParams( config().getOption(BAUD_RATE), config().getOption(DATA_BITS).value(), config().getOption(STOP_BITS).value(), config().getOption(PARITY_BIT).value() ); serialPort.setDTR(config().getOption(DTR)); serialPort.setRTS(config().getOption(RTS)); activate(serialPort.getInputStream(), serialPort.getOutputStream()); }
protected void doInit() throws Exception { serialPort.setSerialPortParams( config().getOption(BAUD_RATE), config().getOption(DATA_BITS).value(), config().getOption(STOP_BITS).value(), config().getOption(PARITY_BIT).value() ); serialPort.setDTR(config().getOption(DTR)); serialPort.setRTS(config().getOption(RTS)); activate(serialPort.getInputStream(), serialPort.getOutputStream()); }
protected void doInit() throws Exception { serialPort.setSerialPortParams( config().getOption(BAUD_RATE), config().getOption(DATA_BITS).value(), config().getOption(STOP_BITS).value(), config().getOption(PARITY_BIT).value() ); serialPort.setDTR(config().getOption(DTR)); serialPort.setRTS(config().getOption(RTS)); activate(serialPort.getInputStream(), serialPort.getOutputStream()); }