/** * @see javax.microedition.io.InputConnection#openInputStream() */ @Override public InputStream openInputStream() throws IOException { if ( this.is != null ) { return this.is; } return this.is = this.port.getInputStream(); }
@Override public void serialEvent( SerialPortEvent event ) { if ( ( event.getEventType() & SerialPortEvent.DATA_AVAILABLE ) != 0 ) { SerialPort port = ( SerialPort )event.getSource(); try { InputStream is = port.getInputStream(); Integer[] buf = new Integer[is.available()]; for ( int i = 0; i < buf.length; i++ ) { buf[i] = Integer.valueOf( is.read() ); } terminalFrontend.writeCharacters( buf ); } catch ( IOException e ) { e.printStackTrace(); } } } } );
InputStream inStream = port.getInputStream();
static protected void openPort() throws Exception { try { CommPortIdentifier portid = CommPortIdentifier.getPortIdentifier(m_TestPortName); m_Port = (SerialPort) portid.open(APPLICATION_NAME, 1000); m_Out = m_Port.getOutputStream(); m_In = m_Port.getInputStream(); drain(m_In); } catch (NoSuchPortException e) { fail("could no open port '%s'\n", m_TestPortName); } }
static protected void openPort() throws Exception { try { CommPortIdentifier portid = CommPortIdentifier.getPortIdentifier(m_TestPortName); m_Port = (SerialPort) portid.open("PureJavaCommTestSuite", 1000); m_Out = m_Port.getOutputStream(); m_In = m_Port.getInputStream(); drain(m_In); } catch (NoSuchPortException e) { fail("could no open port '%s'\n", m_TestPortName); } }
port.setFlowControlMode(SerialPort.FLOWCONTROL_XONXOFF_IN + SerialPort.FLOWCONTROL_XONXOFF_OUT); final OutputStream outs = port.getOutputStream(); final InputStream ins = port.getInputStream(); final boolean[] stop = { false }; port.addEventListener(new SerialPortEventListener() {
m_In = m_Port.getInputStream();
m_In = m_Port.getInputStream();
m_In = m_Port.getInputStream();
m_In = m_Port.getInputStream();
openPort(); m_Out = m_Port.getOutputStream(); m_In = m_Port.getInputStream();
m_In = m_Port.getInputStream();
m_In = m_Port.getInputStream();
openPort(); m_Out = m_Port.getOutputStream(); m_In = m_Port.getInputStream();
m_Port.enableReceiveTimeout(1000); m_Out = m_Port.getOutputStream(); m_In = m_Port.getInputStream(); m_Out.write(sent);
m_In = m_Port.getInputStream(); m_In = m_Port.getInputStream();
m_Port.enableReceiveTimeout(1000); m_Out = m_Port.getOutputStream(); m_In = m_Port.getInputStream(); m_Out.write(sent);
/** * Connects to the current selected port. */ final void connect() { try { this.serialPort = openSerialPort(); this.serialInput = this.serialPort.getInputStream(); this.serialOutput = this.serialPort.getOutputStream(); this.terminal = new VT220Terminal( 80, 24 ); this.terminalFrontend.connect( this.serialOutput ); this.terminalFrontend.setTerminal( this.terminal ); disableControls(); } catch ( Exception exception ) { JErrorDialog.showDialog( getOwner(), "Connect failed!", exception ); } }
openPort(); m_Out = m_Port.getOutputStream(); m_In = m_Port.getInputStream();
openPort(); m_Out = m_Port.getOutputStream(); m_In = m_Port.getInputStream();