public static void closeRxtxPort(RXTXPort port){ try{ //port.IOLocked = 0; } catch(IllegalAccessError e){ System.out.println(e.getMessage()); } port.close(); } }
public void removeEventListener() { serial.removeEventListener(); }
@Override public void setDTR(boolean state) { serialPort.setDTR(state); }
return; setDTR(false); setDSR(false); if (debug) z.reportln("RXTXPort:close( " + this.name + " ) setting monThreadisInterrupted"); if (!monThreadisInterrupted) { removeEventListener(); nativeClose(this.name); if (debug) z.reportln("RXTXPort:close( " + this.name + " ) calling super.close");
serialPort.setSerialPortParams(baudRate, parameters.dataBits, parameters.stopBits, parameters.parity); serialPort.setFlowControlMode(parameters.flowControl); serialPort.enableReceiveTimeout(receiveTimeout); inputStream = serialPort.getInputStream(); outputStream = serialPort.getOutputStream(); serialPort.notifyOnDataAvailable(true); serialPort.addEventListener(this); } catch (PortInUseException e) { throw new InterfaceInUseException("Port " + port + " is already in use by other application(s)", e);
@Override public void close() { try { if (inputStream != null) { inputStream.close(); inputStream = null; } if (outputStream != null) { outputStream.close(); outputStream = null; } } catch (IOException e) { logger.error(e.getMessage(), e); } synchronized (lock) { if (serialPort != null) { try { serialPort.notifyOnDataAvailable(false); serialPort.removeEventListener(); portIdentifier.removePortOwnershipListener(this); serialPort.close(); serialPort = null; connectionOpen = false; } catch (Exception e) { } } } }
/** */ public void disableReceiveTimeout() { if (debug) z.reportln( "RXTXPort:disableReceiveTimeout() called"); timeout = -1; NativeEnableReceiveTimeoutThreshold( timeout , threshold, InputBuffer ); if (debug) z.reportln( "RXTXPort:disableReceiveTimeout() returning"); } /**
public InputStream getInputStream() { return serial.getInputStream(); }
/** * @return int the timeout */ public int getReceiveTimeout() { if (debug) z.reportln("RXTXPort:getReceiveTimeout() called and returning " + NativegetReceiveTimeout()); return (NativegetReceiveTimeout()); }
/** */ public void disableReceiveThreshold() { if (debug) z.reportln("RXTXPort:disableReceiveThreshold() called and returning"); enableReceiveThreshold(0); }
/** * @return boolean true if recieve timeout is enabled */ public boolean isReceiveTimeoutEnabled() { if (debug) z.reportln( "RXTXPort:isReceiveTimeoutEnabled() called and returning " + NativeisReceiveTimeoutEnabled() ); return( NativeisReceiveTimeoutEnabled() ); } /**
/** * run the thread and call the event loop. */ public void run() { if (debug) z.reportln("RXTXPort:MontitorThread:run()"); monThreadisInterrupted = false; eventLoop(); if (debug) z.reportln("eventLoop() returned"); }
return; setDTR(false); setDSR(false); if (debug) z.reportln( "RXTXPort:close( " + this.name + " ) setting monThreadisInterrupted"); if ( ! monThreadisInterrupted ) removeEventListener(); nativeClose( this.name ); if (debug) z.reportln( "RXTXPort:close( " + this.name + " ) calling super.close");
/** */ public void disableReceiveTimeout() { if (debug) z.reportln( "RXTXPort:disableReceiveTimeout() called"); timeout = -1; NativeEnableReceiveTimeoutThreshold( timeout , threshold, InputBuffer ); if (debug) z.reportln( "RXTXPort:disableReceiveTimeout() returning"); } /**
public InputStream getInputStream() { return serial.getInputStream(); }
/** * @return int the timeout */ public int getReceiveTimeout() { if (debug) z.reportln( "RXTXPort:getReceiveTimeout() called and returning " + NativegetReceiveTimeout() ); return(NativegetReceiveTimeout( )); }
/** */ public void disableReceiveThreshold() { if (debug) z.reportln( "RXTXPort:disableReceiveThreshold() called and returning"); enableReceiveThreshold(0); } /**
/** * @return boolean true if recieve timeout is enabled */ public boolean isReceiveTimeoutEnabled() { if (debug) z.reportln( "RXTXPort:isReceiveTimeoutEnabled() called and returning " + NativeisReceiveTimeoutEnabled() ); return( NativeisReceiveTimeoutEnabled() ); } /**
/** * run the thread and call the event loop. */ public void run() { if (debug) z.reportln( "RXTXPort:MontitorThread:run()"); monThreadisInterrupted=false; eventLoop(); if (debug) z.reportln( "eventLoop() returned"); } protected void finalize() throws Throwable