/** * Receive framing control */ public void enableReceiveFraming(int f) throws UnsupportedCommOperationException { throw new UnsupportedCommOperationException("Not supported"); }
private void updateWrappedPort() throws IOException { try { this.rxtxPort.setSerialPortParams(this.baudRate, this.dataBits.getOldValue(), this.stopBits.getOldValue(), this.parity.getOldValue()); } catch (UnsupportedCommOperationException e) { throw new IOException(e.getMessage()); } }
public int setMode(int mode) throws UnsupportedCommOperationException { try { setLPRMode(mode); } catch (UnsupportedCommOperationException e) { e.printStackTrace(); return -1; } lprmode = mode; return (0); }
@Override protected boolean connect() throws IOException { try { final CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(port); if(portIdentifier != null) { serialPort = (SerialPort) portIdentifier.open("org.openhab.binding.ebus", 2000); serialPort.setSerialPortParams(2400, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); // set timeout 10 sec. serialPort.disableReceiveThreshold(); serialPort.enableReceiveTimeout(10000); // use event to let readByte wait until data is available, optimize cpu usage serialPort.addEventListener(this); serialPort.notifyOnDataAvailable(true); outputStream = serialPort.getOutputStream(); inputStream = serialPort.getInputStream(); return super.connect(); } } catch (NoSuchPortException e) { logger.error("Unable to connect to serial port {}", port); } catch (PortInUseException e) { logger.error("Serial port {} is already in use", port); } catch (UnsupportedCommOperationException e) { logger.error(e.toString(), e); } catch (TooManyListenersException e) { logger.error("Too many listeners error!", e); } serialPort = null; return false; }
@Override public void setPortParameters(int baudRate, int dataBits, int stopBits, int parity, int flowControl) throws InvalidConfigurationException, ConnectionException { parameters = new SerialPortParameters(baudRate, dataBits, stopBits, parity, flowControl); if (serialPort != null) { try { serialPort.setSerialPortParams(baudRate, dataBits, stopBits, parity); serialPort.setFlowControlMode(flowControl); } catch (UnsupportedCommOperationException e) { throw new InvalidConfigurationException(e.getMessage(), e); } } }
public int setMode(int mode) throws UnsupportedCommOperationException { try { setLPRMode(mode); } catch(UnsupportedCommOperationException e) { e.printStackTrace(); return -1; } lprmode = mode; return(0); } public void restart()
/** * Receive framing control */ public void enableReceiveFraming(int f) throws UnsupportedCommOperationException { throw new UnsupportedCommOperationException("Not supported"); }
public static JRxTxPort openSerialPort(String portName, int baudRate, Parity parity, DataBits dataBits, StopBits stopBits, FlowControl flowControl) throws SerialPortException { try { System.setProperty("gnu.io.rxtx.SerialPorts", portName); CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); String theOwner = JRxTxPort.class.getCanonicalName() + System.currentTimeMillis(); CommPort comPort = portIdentifier.open(theOwner, 0); if (!(comPort instanceof RXTXPort)) { throw new SerialPortException("Unable to open the serial port. Port is not RXTX."); } RXTXPort rxtxPort = (RXTXPort) comPort; try { rxtxPort.setSerialPortParams(baudRate, dataBits.getOldValue(), stopBits.getOldValue(), parity.getOldValue()); setFlowControl(flowControl, rxtxPort); } catch (UnsupportedCommOperationException e) { String message = format("Unable to apply config on serial port.\n{0}", e.getMessage()); throw new SerialPortException(message); } return new JRxTxPort(rxtxPort, portName, baudRate, parity, dataBits, stopBits, flowControl); } catch (NoSuchPortException e) { String errMessage = format("Serial port {0} not found or port is busy.", portName); throw new PortNotFoundException(errMessage); } catch (PortInUseException e) { String errMessage = format("Serial port {0} is already in use.", portName); throw new PortNotFoundException(errMessage); } }
/** Receive framing control */ public void enableReceiveFraming( int f ) throws UnsupportedCommOperationException { throw new UnsupportedCommOperationException( "Not supported" ); } public void disableReceiveFraming() {}
return false; } catch ( UnsupportedCommOperationException e ) { logger.error( e.getMessage( ) , e ); return false;
/** Receive framing control */ public void enableReceiveFraming( int f ) throws UnsupportedCommOperationException { throw new UnsupportedCommOperationException( "Not supported" ); } public void disableReceiveFraming() {}
throw new InterfaceInUseException("Port " + port + " is already in use by other application(s)", e); } catch (UnsupportedCommOperationException e) { throw new InvalidConfigurationException(e.getMessage(), e); } catch (TooManyListenersException e) { throw new InvalidConfigurationException(e.getMessage(), e);
public synchronized CommPort open(FileDescriptor f) throws UnsupportedCommOperationException { if(debug) System.out.println("CommPortIdentifier:open(FileDescriptor)"); throw new UnsupportedCommOperationException(); } private native String native_psmisc_report_owner(String PortName);
/** * Receive framing control * * @param f * framming * @throws UnsupportedCommOperationException */ public void enableReceiveFraming(int f) throws UnsupportedCommOperationException { if (debug) z.reportln("RXTXPort:enableReceiveFramming() throwing exception"); throw new UnsupportedCommOperationException("Not supported"); }
/** Receive framing control */ public void enableReceiveFraming( int f ) throws UnsupportedCommOperationException { throw new UnsupportedCommOperationException( "Not supported" ); } public void disableReceiveFraming() {}
public synchronized CommPort open(FileDescriptor f) throws UnsupportedCommOperationException { if (debug) System.out.println("CommPortIdentifier:open(FileDescriptor)"); throw new UnsupportedCommOperationException(); }
/** * Receive framing control */ public void enableReceiveFraming(int f) throws UnsupportedCommOperationException { throw new UnsupportedCommOperationException("Not supported"); }
/** Receive framing control */ public void enableReceiveFraming( int f ) throws UnsupportedCommOperationException { throw new UnsupportedCommOperationException( "Not supported" ); } public void disableReceiveFraming() {}
public synchronized CommPort open(FileDescriptor f) throws UnsupportedCommOperationException { if(debug) System.out.println("CommPortIdentifier:open(FileDescriptor)"); throw new UnsupportedCommOperationException(); } private native String native_psmisc_report_owner(String PortName);
/** Receive framing control */ public void enableReceiveFraming(int f) throws UnsupportedCommOperationException { throw new UnsupportedCommOperationException("Not supported"); }