Package tuwien.auto.calimero.exception

Examples of tuwien.auto.calimero.exception.KNXException


    try {
      RXTXVersion.getVersion();
      return new KNXNetworkLinkFT12(serialPort, new TPSettings(true));
    } catch(NoClassDefFoundError e) {
      throw new KNXException("The serial FT1.2 KNX connection requires the RXTX libraries to be available, but they could not be found!");
    } catch(KNXException knxe) {
      if(knxe.getMessage().startsWith("can not open serial port")) {
        StringBuilder sb = new StringBuilder("Available ports are:\n");
        Enumeration<?> portList = CommPortIdentifier.getPortIdentifiers();
        while (portList.hasMoreElements()) {
          CommPortIdentifier id = (CommPortIdentifier) portList.nextElement();
          if (id.getPortType() == CommPortIdentifier.PORT_SERIAL) {
            sb.append(id.getName() + "\n");
          }
        }
        sb.deleteCharAt(sb.length()-1);
        knxe = new KNXException("Serial port '" + serialPort + "' could not be opened. " + sb.toString());
      }
      throw knxe;
    }
  }
View Full Code Here

TOP

Related Classes of tuwien.auto.calimero.exception.KNXException

Copyright © 2018 www.massapicom. 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.