Package gnu.io

Examples of gnu.io.CommPortIdentifier.open()


    try {
      portIdentifier = CommPortIdentifier.getPortIdentifier(port);

      try {
        serialPort = (SerialPort) portIdentifier.open("openhab", 3000);
        serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8,
            SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);

        inputStream = new DataInputStream(new BufferedInputStream(
            serialPort.getInputStream()));
View Full Code Here


  public void connect(final String serialPortName)
      throws SerialInterfaceException {
    logger.info("Connecting to serial port {}", serialPortName);
    try {
      CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(serialPortName);
      CommPort commPort = portIdentifier.open("org.openhab.binding.zwave",2000);
      this.serialPort = (SerialPort) commPort;
      this.serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
      this.serialPort.enableReceiveThreshold(1);
      this.serialPort.enableReceiveTimeout(ZWAVE_RECEIVE_TIMEOUT);
      this.receiveThread = new ZWaveReceiveThread();
View Full Code Here

    if (portIdentifier.isCurrentlyOwned()) {
      throw new Exception("Serial port '" + portName + "' is in use.");
    }

    // open port
    port = (SerialPort) portIdentifier.open(this.getClass().getSimpleName(), CONNECT_TIMEOUT);
    log.info("Connected to serial port '{}'", portIdentifier.getName());

    // configure
    port.setSerialPortParams(9600, SerialPort.DATABITS_8,SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
    port.notifyOnDataAvailable(true);
View Full Code Here

  public void open() {

    try {
     
      CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(serialPortName);
      CommPort commPort = portIdentifier.open(this.getClass().getName(), 2000);
     
      serialPort = (SerialPort) commPort;
      serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
      serialPort.enableReceiveThreshold(1);
      serialPort.disableReceiveTimeout();
View Full Code Here

  public void connect() throws OpenEnergyMonitorException {

    try {
      CommPortIdentifier portIdentifier = CommPortIdentifier
          .getPortIdentifier(portName);
      CommPort commPort = portIdentifier.open(this.getClass().getName(),
          2000);
      serialPort = (SerialPort) commPort;
      serialPort.setSerialPortParams(BAUDRATE, SerialPort.DATABITS_8,
          SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
View Full Code Here

    // fixed issue as rxtx library originally used in j62056 does use
    // different version of rxtx
    // com port in their version is using gnu.io.CommPort
    RXTXPort commPort;
    try {
      commPort = portIdentifier.open(this.getClass().getName(), 2000);
    } catch (PortInUseException e) {
      throw new IOException("Serial port is currently in use.", e);
    }

    if (!(commPort instanceof SerialPort)) {
View Full Code Here

    try {
      logger.debug("Open connection to serial port '{}'", serialPortName);
      CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(serialPortName);

      CommPort commPort = portIdentifier.open(this.getClass().getName(),2000);

      serialPort = (SerialPort) commPort;
      serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8,
          SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
      serialPort.enableReceiveThreshold(1);
View Full Code Here

  @Override
  public void connect(String device) throws NoSuchPortException, PortInUseException, UnsupportedCommOperationException, IOException {
    CommPortIdentifier portIdentifier = CommPortIdentifier
        .getPortIdentifier(device);

    CommPort commPort = portIdentifier
        .open(this.getClass().getName(), 2000);

    serialPort = (SerialPort) commPort;
    serialPort.setSerialPortParams(38400, SerialPort.DATABITS_8,
        SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
View Full Code Here

         * /dev/ttyUSB*, and will so not find symlinks. The
         *  setProperty() call below helps
         */
        System.setProperty("gnu.io.rxtx.SerialPorts", m_serialDeviceName);
        CommPortIdentifier ci =  CommPortIdentifier.getPortIdentifier(m_serialDeviceName);
        CommPort cp = ci.open("openhabalarmdecoder", 10000);
        if (cp == null) {
          throw new IllegalStateException("cannot open serial port!");
        }
        if (cp instanceof SerialPort) {
          m_port = (SerialPort)cp;
View Full Code Here

    port = portName;
    try {
      portIdentifier = CommPortIdentifier.getPortIdentifier(port);

      try {
        serialPort = (SerialPort) portIdentifier.open("openhab", 3000);
        serialPort.setSerialPortParams(19200, SerialPort.DATABITS_8,SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);

        inputStream = new DataInputStream(new BufferedInputStream(serialPort.getInputStream()));
        outputStream = serialPort.getOutputStream();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.